diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-04 22:27:57 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2010-10-04 22:27:57 +0200 |
commit | d5c07d9403bc42f08de10331979a73f2db399b59 (patch) | |
tree | d4be106bf36e52c0ff2ee11132f5accbc5cb2180 /nss/services.c | |
parent | 6a2c600499039036b1fa0efcd45747b21308375c (diff) | |
parent | 24fae4c5df0c5152891893ab677edb4a9b497d11 (diff) |
merge changes from trunk
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-solaris@1242 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/services.c')
-rw-r--r-- | nss/services.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nss/services.c b/nss/services.c index 87a7c2f..61e978a 100644 --- a/nss/services.c +++ b/nss/services.c @@ -30,6 +30,7 @@ #include "common.h" #include "compat/attrs.h" +/* read a single services result entry from the stream */ static nss_status_t read_servent( TFILE *fp,struct servent *result, char *buffer,size_t buflen,int *errnop) @@ -38,6 +39,7 @@ static nss_status_t read_servent( size_t bufptr=0; READ_BUF_STRING(fp,result->s_name); READ_BUF_STRINGLIST(fp,result->s_aliases); + /* store port number in network byte order */ READ_TYPE(fp,tmpint32,int32_t); result->s_port=htons((uint16_t)tmpint32); READ_BUF_STRING(fp,result->s_proto); @@ -47,6 +49,7 @@ static nss_status_t read_servent( #ifdef NSS_FLAVOUR_GLIBC +/* get a service entry by name and protocol */ nss_status_t _nss_ldap_getservbyname_r( const char *name,const char *protocol,struct servent *result, char *buffer,size_t buflen,int *errnop) @@ -57,6 +60,7 @@ nss_status_t _nss_ldap_getservbyname_r( return retv; } +/* get a service entry by port and protocol */ nss_status_t _nss_ldap_getservbyport_r( int port,const char *protocol,struct servent *result, char *buffer,size_t buflen,int *errnop) @@ -70,19 +74,23 @@ nss_status_t _nss_ldap_getservbyport_r( /* thread-local file pointer to an ongoing request */ static __thread TFILE *protoentfp; +/* open request to get all services */ nss_status_t _nss_ldap_setservent(int UNUSED(stayopen)) { NSS_SETENT(protoentfp); } +/* read a single returned service definition */ nss_status_t _nss_ldap_getservent_r( - struct servent *result,char *buffer,size_t buflen,int *errnop) + 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)); return retv; } +/* close the stream opened by setservent() above */ nss_status_t _nss_ldap_endservent(void) { NSS_ENDENT(protoentfp); |