diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2007-07-28 18:20:06 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2007-07-28 18:20:06 +0200 |
commit | 9e68b31911052fd5270c036366d2875f02ec3280 (patch) | |
tree | ec6d37e7cb09ab75dc94747d6da7ae94879dc421 /nslcd/passwd.c | |
parent | c8fa7714097214ca7efd94ed69d27ffaacb59a07 (diff) |
define the list of attributes to look up in searches in the service modules instead of in ldap-schema
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@337 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/passwd.c')
-rw-r--r-- | nslcd/passwd.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/nslcd/passwd.c b/nslcd/passwd.c index a564156..0f0b4b2 100644 --- a/nslcd/passwd.c +++ b/nslcd/passwd.c @@ -59,6 +59,22 @@ #define GID_NOBODY UID_NOBODY #endif +/* the attributes to request with searches */ +static const char *attlst[10]; + +static void attlst_init(void) +{ + attlst[0] = attmap_passwd_uid; + attlst[1] = attmap_passwd_userPassword; + attlst[2] = attmap_passwd_uidNumber; + attlst[3] = attmap_passwd_gidNumber; + attlst[4] = attmap_passwd_cn; + attlst[5] = attmap_passwd_homeDirectory; + attlst[6] = attmap_passwd_loginShell; + attlst[7] = attmap_passwd_gecos; + attlst[8] = attmap_objectClass; + attlst[9] = NULL; +} static inline enum nss_status _nss_ldap_assign_emptystring( char **valptr, char **buffer, size_t * buflen) @@ -195,7 +211,8 @@ int nslcd_passwd_byname(TFILE *fp) LA_INIT(a); LA_STRING(a)=name; LA_TYPE(a)=LA_TYPE_STRING; - retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwnam,LM_PASSWD,_nss_ldap_parse_pw)); + attlst_init(); + retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwnam,LM_PASSWD,attlst,_nss_ldap_parse_pw)); /* write the response */ WRITE_INT32(fp,NSLCD_VERSION); WRITE_INT32(fp,NSLCD_ACTION_PASSWD_BYNAME); @@ -227,7 +244,8 @@ int nslcd_passwd_byuid(TFILE *fp) LA_INIT(a); LA_NUMBER(a)=uid; LA_TYPE(a)=LA_TYPE_NUMBER; - retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwuid,LM_PASSWD,_nss_ldap_parse_pw)); + attlst_init(); + retv=nss2nslcd(_nss_ldap_getbyname(&a,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwuid,LM_PASSWD,attlst,_nss_ldap_parse_pw)); /* write the response */ WRITE_INT32(fp,NSLCD_VERSION); WRITE_INT32(fp,NSLCD_ACTION_PASSWD_BYUID); @@ -259,7 +277,8 @@ int nslcd_passwd_all(TFILE *fp) if (_nss_ldap_ent_context_init(&pw_context)==NULL) return -1; /* go over results */ - while ((retv=nss2nslcd(_nss_ldap_getent(&pw_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwent,LM_PASSWD,_nss_ldap_parse_pw)))==NSLCD_RESULT_SUCCESS) + attlst_init(); + while ((retv=nss2nslcd(_nss_ldap_getent(&pw_context,&result,buffer,1024,&errnop,_nss_ldap_filt_getpwent,LM_PASSWD,attlst,_nss_ldap_parse_pw)))==NSLCD_RESULT_SUCCESS) { /* write the result */ WRITE_INT32(fp,retv); |