From 24fae4c5df0c5152891893ab677edb4a9b497d11 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Mon, 4 Oct 2010 19:37:47 +0000 Subject: improve consistency of code layout git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1240 ef36b2f9-881f-0410-afb5-c4e39611909c --- nss/networks.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'nss/networks.c') diff --git a/nss/networks.c b/nss/networks.c index 3c7d10f..b3a4e39 100644 --- a/nss/networks.c +++ b/nss/networks.c @@ -29,7 +29,7 @@ #include "common.h" #include "compat/attrs.h" -/* Redifine some ERROR_OUT macros as we also want to set h_errnop. */ +/* Redefine some ERROR_OUT macros as we also want to set h_errnop. */ #undef ERROR_OUT_OPENERROR #define ERROR_OUT_OPENERROR \ @@ -107,7 +107,10 @@ static nss_status_t read_netent( WRITE_INT32(fp,4); \ WRITE_INT32(fp,htonl(addr)); -nss_status_t _nss_ldap_getnetbyname_r(const char *name,struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop) +/* get a network entry by name */ +nss_status_t _nss_ldap_getnetbyname_r( + const char *name,struct netent *result, + char *buffer,size_t buflen,int *errnop,int *h_errnop) { NSS_BYNAME(NSLCD_ACTION_NETWORK_BYNAME, name, @@ -116,7 +119,9 @@ nss_status_t _nss_ldap_getnetbyname_r(const char *name,struct netent *result,cha /* Note: the af parameter is ignored and is assumed to be AF_INET */ /* TODO: implement handling of af parameter */ -nss_status_t _nss_ldap_getnetbyaddr_r(uint32_t addr,int UNUSED(af),struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop) +nss_status_t _nss_ldap_getnetbyaddr_r( + uint32_t addr,int UNUSED(af),struct netent *result, + char *buffer,size_t buflen,int *errnop,int *h_errnop) { NSS_BYGEN(NSLCD_ACTION_NETWORK_BYADDR, WRITE_ADDRESS(fp,addr), @@ -126,17 +131,22 @@ nss_status_t _nss_ldap_getnetbyaddr_r(uint32_t addr,int UNUSED(af),struct netent /* thread-local file pointer to an ongoing request */ static __thread TFILE *netentfp; +/* start a request to read all networks */ nss_status_t _nss_ldap_setnetent(int UNUSED(stayopen)) { NSS_SETENT(netentfp); } -nss_status_t _nss_ldap_getnetent_r(struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop) +/* get a single network entry from the stream */ +nss_status_t _nss_ldap_getnetent_r( + struct netent *result, + char *buffer,size_t buflen,int *errnop,int *h_errnop) { NSS_GETENT(netentfp,NSLCD_ACTION_NETWORK_ALL, read_netent(netentfp,result,buffer,buflen,errnop,h_errnop)); } +/* close the stream opened by setnetent() above */ nss_status_t _nss_ldap_endnetent(void) { NSS_ENDENT(netentfp); -- cgit v1.2.3