Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss/networks.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-10-04 21:37:47 +0200
committerArthur de Jong <arthur@arthurdejong.org>2010-10-04 21:37:47 +0200
commit24fae4c5df0c5152891893ab677edb4a9b497d11 (patch)
tree298a9d6b2a657a1d1e1c8ced9348f2dbc084888a /nss/networks.c
parentb7c3c078c873b1596519b661fdc5b35d48794ace (diff)
improve consistency of code layout
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1240 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss/networks.c')
-rw-r--r--nss/networks.c18
1 files changed, 14 insertions, 4 deletions
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);