diff options
author | Andreas Schwab <schwab@suse.de> | 2015-03-25 16:35:46 +0100 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2015-05-11 10:41:49 +0200 |
commit | b13b96ca05a132a12dc5f3712b99e626670716bf (patch) | |
tree | 2b1ab6395ec3b6e44c63513858e2c53383747733 /nis/nss_compat/compat-spwd.c | |
parent | e1b6cb04f5efff7fb7415c69511d3ab3c31c6e4a (diff) | |
download | glibc-b13b96ca05a132a12dc5f3712b99e626670716bf.tar.gz glibc-b13b96ca05a132a12dc5f3712b99e626670716bf.tar.xz glibc-b13b96ca05a132a12dc5f3712b99e626670716bf.zip |
Separate internal state between getXXent and getXXbyYY NSS calls (bug 18007)
Diffstat (limited to 'nis/nss_compat/compat-spwd.c')
-rw-r--r-- | nis/nss_compat/compat-spwd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c index 73c2ed3fe0..5e4bf78e47 100644 --- a/nis/nss_compat/compat-spwd.c +++ b/nis/nss_compat/compat-spwd.c @@ -169,7 +169,7 @@ copy_spwd_changes (struct spwd *dest, struct spwd *src, } static enum nss_status -internal_setspent (ent_t *ent, int stayopen) +internal_setspent (ent_t *ent, int stayopen, int needent) { enum nss_status status = NSS_STATUS_SUCCESS; @@ -239,7 +239,7 @@ internal_setspent (ent_t *ent, int stayopen) give_spwd_free (&ent->pwd); - if (status == NSS_STATUS_SUCCESS && nss_setspent) + if (needent && status == NSS_STATUS_SUCCESS && nss_setspent) ent->setent_status = nss_setspent (stayopen); return status; @@ -256,7 +256,7 @@ _nss_compat_setspent (int stayopen) if (ni == NULL) init_nss_interface (); - result = internal_setspent (&ext_ent, stayopen); + result = internal_setspent (&ext_ent, stayopen, 1); __libc_lock_unlock (lock); @@ -267,9 +267,6 @@ _nss_compat_setspent (int stayopen) static enum nss_status internal_endspent (ent_t *ent) { - if (nss_endspent) - nss_endspent (); - if (ent->stream != NULL) { fclose (ent->stream); @@ -303,6 +300,9 @@ _nss_compat_endspent (void) __libc_lock_lock (lock); + if (nss_endspent) + nss_endspent (); + result = internal_endspent (&ext_ent); __libc_lock_unlock (lock); @@ -658,7 +658,7 @@ _nss_compat_getspent_r (struct spwd *pwd, char *buffer, size_t buflen, init_nss_interface (); if (ext_ent.stream == NULL) - result = internal_setspent (&ext_ent, 1); + result = internal_setspent (&ext_ent, 1, 1); if (result == NSS_STATUS_SUCCESS) result = internal_getspent_r (pwd, &ext_ent, buffer, buflen, errnop); @@ -830,7 +830,7 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd, __libc_lock_unlock (lock); - result = internal_setspent (&ent, 0); + result = internal_setspent (&ent, 0, 0); if (result == NSS_STATUS_SUCCESS) result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop); |