From a7ac27ed9e31c8b6bfca11b73816d62528cef286 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 9 Oct 2010 20:10:27 +0000 Subject: have one shared file handle per flavour instead of one global one (for now) and re-introduce some other minor changes that got lost in r1247 git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1249 ef36b2f9-881f-0410-afb5-c4e39611909c --- nss/shadow.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nss/shadow.c') diff --git a/nss/shadow.c b/nss/shadow.c index 7e5e7ce..403dd3a 100644 --- a/nss/shadow.c +++ b/nss/shadow.c @@ -30,9 +30,6 @@ #include "common.h" #include "compat/attrs.h" -/* thread-local file pointer to an ongoing request */ -static __thread TFILE *spentfp; - /* read a single shadow entry from the stream */ static nss_status_t read_spwd( TFILE *fp,struct spwd *result, @@ -66,7 +63,7 @@ nss_status_t _nss_ldap_getspnam_r( } /* thread-local file pointer to an ongoing request */ -/* static __thread TFILE *spentfp; */ +static __thread TFILE *spentfp; /* start listing all shadow users */ nss_status_t _nss_ldap_setspent(int UNUSED(stayopen)) @@ -111,6 +108,7 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args) char *buffer=NSS_ARGS(args)->buf.buffer; size_t buflen=NSS_ARGS(args)->buf.buflen; char *data_ptr; + char field_buf[128]; nss_status_t status; if (NSS_ARGS(args)->buf.buflen<0) { @@ -124,7 +122,6 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args) { /* result==NULL, return file format */ data_ptr=(char *)malloc(buflen); - char field_buf[128]; sprintf(data_ptr,"%s:%s:",sp->sp_namp,sp->sp_pwdp); if (sp->sp_lstchg >= 0) sprintf(field_buf,"%d:",sp->sp_lstchg); @@ -173,6 +170,9 @@ static nss_status_t _xnss_ldap_getspnam_r(nss_backend_t UNUSED(*be),void *args) return status; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *spentfp; + static nss_status_t _xnss_ldap_setspent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(spentfp); @@ -193,6 +193,7 @@ static nss_status_t _xnss_ldap_getspent_r(nss_backend_t UNUSED(*be),void *args) char *buffer=NSS_ARGS(args)->buf.buffer; size_t buflen=NSS_ARGS(args)->buf.buflen; char *data_ptr; + char field_buf[128]; nss_status_t status; if (NSS_ARGS(args)->buf.buflen<0) { @@ -206,7 +207,6 @@ static nss_status_t _xnss_ldap_getspent_r(nss_backend_t UNUSED(*be),void *args) { /* result==NULL, return file format */ data_ptr=(char *)malloc(buflen); - char field_buf[128]; sprintf(data_ptr,"%s:%s:",sp->sp_namp,sp->sp_pwdp); if (sp->sp_lstchg >= 0) sprintf(field_buf,"%d:",sp->sp_lstchg); -- cgit v1.2.3