diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-08-22 13:31:12 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-08-22 13:31:12 -0700 |
commit | 3cc3ef96d6c060e9d45b43f5482dc4e03945b30e (patch) | |
tree | 38fbe47c74c5109f408d107696950923d1b68ff6 /inet/getnetgrent_r.c | |
parent | 07e515506660b1d0c1934dc0ac0e2ac5e7a4a760 (diff) | |
download | glibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.tar.gz glibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.tar.xz glibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.zip |
BZ#13696: Add --disable-nscd configure option.
Diffstat (limited to 'inet/getnetgrent_r.c')
-rw-r--r-- | inet/getnetgrent_r.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index c57e7de178..8e69ec7b11 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -182,28 +182,32 @@ __internal_setnetgrent (const char *group, struct __netgrent *datap) } libc_hidden_def (__internal_setnetgrent) -int -setnetgrent (const char *group) +static int +nscd_setnetgrent (const char *group) { - int result; - - __libc_lock_lock (lock); - +#ifdef USE_NSCD if (__nss_not_use_nscd_netgroup > 0 && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY) __nss_not_use_nscd_netgroup = 0; if (!__nss_not_use_nscd_netgroup && !__nss_database_custom[NSS_DBSIDX_netgroup]) - { - result = __nscd_setnetgrent (group, &dataset); - if (result >= 0) - goto out; - } + return __nscd_setnetgrent (group, &dataset); +#endif + return -1; +} - result = __internal_setnetgrent (group, &dataset); +int +setnetgrent (const char *group) +{ + int result; + + __libc_lock_lock (lock); + + result = nscd_setnetgrent (group); + if (result < 0) + result = __internal_setnetgrent (group, &dataset); - out: __libc_lock_unlock (lock); return result; @@ -230,7 +234,7 @@ endnetgrent (void) __libc_lock_unlock (lock); } - +#ifdef USE_NSCD static enum nss_status nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen, int *errnop) @@ -248,7 +252,7 @@ nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen, return NSS_STATUS_SUCCESS; } - +#endif int internal_function @@ -267,9 +271,14 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp, int no_more = datap->nip == NULL; if (! no_more) { +#ifdef USE_NSCD + /* This bogus function pointer is a special marker left by + __nscd_setnetgrent to tell us to use the data it left + before considering any modules. */ if (datap->nip == (service_user *) -1l) fct = nscd_getnetgrent; else +#endif { fct = __nss_lookup_function (datap->nip, "getnetgrent_r"); no_more = fct == NULL; @@ -375,6 +384,7 @@ int innetgr (const char *netgroup, const char *host, const char *user, const char *domain) { +#ifdef USE_NSCD if (__nss_not_use_nscd_netgroup > 0 && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY) __nss_not_use_nscd_netgroup = 0; @@ -386,6 +396,7 @@ innetgr (const char *netgroup, const char *host, const char *user, if (result >= 0) return result; } +#endif union { |