Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss/group.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/group.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/group.c')
-rw-r--r--nss/group.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/nss/group.c b/nss/group.c
index 45cfeaa..68d9ef8 100644
--- a/nss/group.c
+++ b/nss/group.c
@@ -2,7 +2,7 @@
group.c - NSS lookup functions for group database
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008, 2009 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 2009, 2010 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -30,6 +30,7 @@
#include "common.h"
#include "compat/attrs.h"
+/* read a single group entry from the stream */
static nss_status_t read_group(
TFILE *fp,struct group *result,
char *buffer,size_t buflen,int *errnop)
@@ -99,14 +100,20 @@ static nss_status_t read_gids(
return NSS_STATUS_SUCCESS;
}
-nss_status_t _nss_ldap_getgrnam_r(const char *name,struct group *result,char *buffer,size_t buflen,int *errnop)
+/* get a group entry by name */
+nss_status_t _nss_ldap_getgrnam_r(
+ const char *name,struct group *result,
+ char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_GROUP_BYNAME,
name,
read_group(fp,result,buffer,buflen,errnop));
}
-nss_status_t _nss_ldap_getgrgid_r(gid_t gid,struct group *result,char *buffer,size_t buflen,int *errnop)
+/* get a group entry by numeric gid */
+nss_status_t _nss_ldap_getgrgid_r(
+ gid_t gid,struct group *result,
+ char *buffer,size_t buflen,int *errnop)
{
NSS_BYTYPE(NSLCD_ACTION_GROUP_BYGID,
gid,gid_t,
@@ -144,17 +151,22 @@ nss_status_t _nss_ldap_initgroups_dyn(
/* thread-local file pointer to an ongoing request */
static __thread TFILE *grentfp;
+/* start a request to read all groups */
nss_status_t _nss_ldap_setgrent(int UNUSED(stayopen))
{
NSS_SETENT(grentfp);
}
-nss_status_t _nss_ldap_getgrent_r(struct group *result,char *buffer,size_t buflen,int *errnop)
+/* read a single group from the stream */
+nss_status_t _nss_ldap_getgrent_r(
+ struct group *result,
+ char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(grentfp,NSLCD_ACTION_GROUP_ALL,
read_group(grentfp,result,buffer,buflen,errnop));
}
+/* close the stream opened with setgrent() above */
nss_status_t _nss_ldap_endgrent(void)
{
NSS_ENDENT(grentfp);