summaryrefslogtreecommitdiff
path: root/nss/shadow.c
diff options
context:
space:
mode:
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);