Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss/shadow.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/shadow.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/shadow.c')
-rw-r--r--nss/shadow.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/nss/shadow.c b/nss/shadow.c
index 8132e17..2fca8d1 100644
--- a/nss/shadow.c
+++ b/nss/shadow.c
@@ -2,7 +2,7 @@
shadow.c - NSS lookup functions for shadow database
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007, 2008 Arthur de Jong
+ Copyright (C) 2006, 2007, 2008, 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
@@ -29,6 +29,7 @@
#include "common.h"
#include "compat/attrs.h"
+/* read a single shadow entry from the stream */
static nss_status_t read_spwd(
TFILE *fp,struct spwd *result,
char *buffer,size_t buflen,int *errnop)
@@ -47,7 +48,10 @@ static nss_status_t read_spwd(
return NSS_STATUS_SUCCESS;
}
-nss_status_t _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buffer,size_t buflen,int *errnop)
+/* get a shadow entry by name */
+nss_status_t _nss_ldap_getspnam_r(
+ const char *name,struct spwd *result,
+ char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_SHADOW_BYNAME,
name,
@@ -57,17 +61,22 @@ nss_status_t _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buf
/* thread-local file pointer to an ongoing request */
static __thread TFILE *spentfp;
+/* start listing all shadow users */
nss_status_t _nss_ldap_setspent(int UNUSED(stayopen))
{
NSS_SETENT(spentfp);
}
-nss_status_t _nss_ldap_getspent_r(struct spwd *result,char *buffer,size_t buflen,int *errnop)
+/* return a single shadow entry read from the stream */
+nss_status_t _nss_ldap_getspent_r(
+ struct spwd *result,
+ char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(spentfp,NSLCD_ACTION_SHADOW_ALL,
read_spwd(spentfp,result,buffer,buflen,errnop));
}
+/* close the stream opened by setspent() above */
nss_status_t _nss_ldap_endspent(void)
{
NSS_ENDENT(spentfp);