diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-08 13:56:56 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-08 13:56:56 +0200 |
commit | 611dc583a05914f81c97c165163bcce021b0dfac (patch) | |
tree | 7136faabebdef16fc8690f1fee37d209a53fa7dd | |
parent | 5afa471c1b514d82da2fde66fbed699a2e2862fa (diff) |
re-introduce {set,get,end}**ent() file handle in Solaris code path and some other miscellaneous small fixes
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1246 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | nss/ethers.c | 5 | ||||
-rw-r--r-- | nss/group.c | 5 | ||||
-rw-r--r-- | nss/hosts.c | 2 | ||||
-rw-r--r-- | nss/netgroup.c | 5 | ||||
-rw-r--r-- | nss/networks.c | 8 | ||||
-rw-r--r-- | nss/passwd.c | 3 | ||||
-rw-r--r-- | nss/protocols.c | 3 | ||||
-rw-r--r-- | nss/rpc.c | 3 | ||||
-rw-r--r-- | nss/services.c | 21 | ||||
-rw-r--r-- | nss/shadow.c | 5 |
10 files changed, 46 insertions, 14 deletions
diff --git a/nss/ethers.c b/nss/ethers.c index 72f1d9c..bc70e81 100644 --- a/nss/ethers.c +++ b/nss/ethers.c @@ -95,7 +95,9 @@ nss_status_t _nss_ldap_endetherent(void) #ifdef NSS_FLAVOUR_SOLARIS +#ifndef NSS_BUFLEN_ETHERS #define NSS_BUFLEN_ETHERS 1024 +#endif #define errnop &errno @@ -157,6 +159,9 @@ static nss_status_t _xnss_ldap_getntohost_r(nss_backend_t UNUSED(*be),void *args return retv; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *etherentfp; + static nss_status_t _xnss_ldap_setetherent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(etherentfp); diff --git a/nss/group.c b/nss/group.c index e100cf6..5a64ca5 100644 --- a/nss/group.c +++ b/nss/group.c @@ -54,8 +54,10 @@ static nss_status_t read_gids( int32_t res=(int32_t)NSLCD_RESULT_BEGIN; int32_t tmpint32,tmp2int32,tmp3int32; gid_t gid; +#ifdef NSS_FLAVOUR_GLIBC gid_t *newgroups; long int newsize; +#endif /* NSS_FLAVOUR_GLIBC */ /* loop over results */ while (res==(int32_t)NSLCD_RESULT_BEGIN) { @@ -275,6 +277,9 @@ static nss_status_t _xnss_ldap_getgrgid_r(nss_backend_t UNUSED(*be),void *args) return status; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *grentfp; + static nss_status_t _xnss_ldap_setgrent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(grentfp); diff --git a/nss/hosts.c b/nss/hosts.c index b07e56e..dbd782e 100644 --- a/nss/hosts.c +++ b/nss/hosts.c @@ -355,6 +355,8 @@ static nss_status_t _xnss_ldap_gethostbyaddr_r(nss_backend_t UNUSED(*be),void *a return retv; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *hostentfp; static nss_status_t _xnss_ldap_sethostent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { diff --git a/nss/netgroup.c b/nss/netgroup.c index d536b12..1992ece 100644 --- a/nss/netgroup.c +++ b/nss/netgroup.c @@ -189,6 +189,9 @@ static char *_nss_ldap_chase_netgroup(nss_ldap_netgr_backend_t *ngbe) return group; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *netgrentfp; + static nss_status_t _nss_nslcd_getnetgrent_r(struct __netgrent *result,char *buffer,size_t buflen,int *errnop) { NSS_GETENT(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME,buffer,buflen, @@ -196,7 +199,7 @@ static nss_status_t _nss_nslcd_getnetgrent_r(struct __netgrent *result,char *buf return retv; } -static nss_status_t _nss_nslcd_setnetgrent(const char *group,struct __netgrent UNUSED(* result)) +static nss_status_t _nss_nslcd_setnetgrent(const char *group,struct __netgrent UNUSED(*result)) { /* we cannot use NSS_SETENT() here because we have a parameter that is only available in this function */ diff --git a/nss/networks.c b/nss/networks.c index 923f562..d25f8ad 100644 --- a/nss/networks.c +++ b/nss/networks.c @@ -179,7 +179,6 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar { struct netent priv_network; struct netent *network=NSS_ARGS(args)->buf.result?(struct netent *)NSS_ARGS(args)->buf.result:&priv_network; - char *name=(char *)NSS_ARGS(args)->key.name; int af=NSS_ARGS(args)->key.netaddr.type; char *buffer=NSS_ARGS(args)->buf.buffer; size_t buflen=NSS_ARGS(args)->buf.buflen; @@ -191,7 +190,7 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar NSS_ARGS(args)->erange=1; return NSS_STATUS_TRYAGAIN; } - status=_nss_nslcd_getnetbyname_r(name,network,buffer, + status=_nss_nslcd_getnetbyname_r(NSS_ARGS(args)->key.name,network,buffer, buflen,&errno,&h_errno); if (status!=NSS_STATUS_SUCCESS) { @@ -202,7 +201,7 @@ static nss_status_t _xnss_ldap_getnetbyname_r(nss_backend_t UNUSED(*be),void *ar { /* result==NULL, return file format */ data_ptr=(char *)malloc(buflen); - sprintf(data_ptr,"%s %s",name,inet_ntoa(network->n_net)); /* ipNetworkNumber */ + sprintf(data_ptr,"%s %s",network->n_name,inet_ntoa(network->n_net)); /* ipNetworkNumber */ if (network->n_aliases) { int i; @@ -291,6 +290,9 @@ static nss_status_t _xnss_ldap_getnetbyaddr_r(nss_backend_t UNUSED(*be),void *ar return status; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *netentfp; + static nss_status_t _xnss_ldap_setnetent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(netentfp); diff --git a/nss/passwd.c b/nss/passwd.c index ec8d1c2..26327e5 100644 --- a/nss/passwd.c +++ b/nss/passwd.c @@ -158,6 +158,9 @@ static nss_status_t _nss_nslcd_getpwuid_r( return retv; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *pwentfp; + /* open a connection to the nslcd and write the request */ static nss_status_t _xnss_ldap_setpwent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { diff --git a/nss/protocols.c b/nss/protocols.c index 0ead9a3..b490fc3 100644 --- a/nss/protocols.c +++ b/nss/protocols.c @@ -203,6 +203,9 @@ static nss_status_t _xnss_ldap_getprotobynumber_r(nss_backend_t UNUSED(*be),void return status; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *protoentfp; + static nss_status_t _xnss_ldap_setprotoent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(protoentfp); @@ -116,6 +116,9 @@ static nss_status_t _nss_nslcd_getrpcbynumber_r( return retv; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *protoentfp; + static nss_status_t _xnss_ldap_setrpcent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { NSS_SETENT(protoentfp); diff --git a/nss/services.c b/nss/services.c index 61e978a..fb709a4 100644 --- a/nss/services.c +++ b/nss/services.c @@ -72,12 +72,12 @@ nss_status_t _nss_ldap_getservbyport_r( } /* thread-local file pointer to an ongoing request */ -static __thread TFILE *protoentfp; +static __thread TFILE *serventfp; /* open request to get all services */ nss_status_t _nss_ldap_setservent(int UNUSED(stayopen)) { - NSS_SETENT(protoentfp); + NSS_SETENT(serventfp); } /* read a single returned service definition */ @@ -85,15 +85,15 @@ nss_status_t _nss_ldap_getservent_r( struct servent *result, char *buffer,size_t buflen,int *errnop) { - NSS_GETENT(protoentfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen, - read_servent(protoentfp,result,buffer,buflen,errnop)); + NSS_GETENT(serventfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen, + read_servent(serventfp,result,buffer,buflen,errnop)); return retv; } /* close the stream opened by setservent() above */ nss_status_t _nss_ldap_endservent(void) { - NSS_ENDENT(protoentfp); + NSS_ENDENT(serventfp); } #endif /* NSS_FLAVOUR_GLIBC */ @@ -120,22 +120,25 @@ static nss_status_t _nss_nslcd_getservbyport_r( return retv; } +/* thread-local file pointer to an ongoing request */ +static __thread TFILE *serventfp; + static nss_status_t _xnss_ldap_setservent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { - NSS_SETENT(protoentfp); + NSS_SETENT(serventfp); } static nss_status_t _nss_nslcd_getservent_r( struct servent *result,char *buffer,size_t buflen,int *errnop) { - NSS_GETENT(protoentfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen, - read_servent(protoentfp,result,buffer,buflen,errnop)); + NSS_GETENT(serventfp,NSLCD_ACTION_SERVICE_ALL,buffer,buflen, + read_servent(serventfp,result,buffer,buflen,errnop)); return retv; } static nss_status_t _xnss_ldap_endservent(nss_backend_t UNUSED(*be),void UNUSED(*args)) { - NSS_ENDENT(protoentfp); + NSS_ENDENT(serventfp); } static nss_status_t _xnss_ldap_getservbyname_r(nss_backend_t UNUSED(*be),void *args) diff --git a/nss/shadow.c b/nss/shadow.c index 935d792..4ccb7b6 100644 --- a/nss/shadow.c +++ b/nss/shadow.c @@ -108,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) { @@ -121,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); @@ -170,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); |