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 | |
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')
-rw-r--r-- | nis/nss_compat/compat-grp.c | 6 | ||||
-rw-r--r-- | nis/nss_compat/compat-pwd.c | 6 | ||||
-rw-r--r-- | nis/nss_compat/compat-spwd.c | 16 |
3 files changed, 14 insertions, 14 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c index 5e9c527964..d8ef4be63b 100644 --- a/nis/nss_compat/compat-grp.c +++ b/nis/nss_compat/compat-grp.c @@ -194,9 +194,6 @@ _nss_compat_setgrent (int stayopen) static enum nss_status internal_endgrent (ent_t *ent) { - if (nss_endgrent) - nss_endgrent (); - if (ent->stream != NULL) { fclose (ent->stream); @@ -222,6 +219,9 @@ _nss_compat_endgrent (void) __libc_lock_lock (lock); + if (nss_endgrent) + nss_endgrent (); + result = internal_endgrent (&ext_ent); __libc_lock_unlock (lock); diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c index e3e3dbb308..9b1d671d17 100644 --- a/nis/nss_compat/compat-pwd.c +++ b/nis/nss_compat/compat-pwd.c @@ -311,9 +311,6 @@ _nss_compat_setpwent (int stayopen) static enum nss_status internal_endpwent (ent_t *ent) { - if (nss_endpwent) - nss_endpwent (); - if (ent->stream != NULL) { fclose (ent->stream); @@ -346,6 +343,9 @@ _nss_compat_endpwent (void) __libc_lock_lock (lock); + if (nss_endpwent) + nss_endpwent (); + result = internal_endpwent (&ext_ent); __libc_lock_unlock (lock); 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); |