diff options
Diffstat (limited to 'nslcd')
-rw-r--r-- | nslcd/common.h | 1 | ||||
-rw-r--r-- | nslcd/passwd.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/nslcd/common.h b/nslcd/common.h index f6a72b9..00dd697 100644 --- a/nslcd/common.h +++ b/nslcd/common.h @@ -85,6 +85,7 @@ int nslcd_service_all(TFILE *fp,MYLDAP_SESSION *session); int nslcd_shadow_byname(TFILE *fp,MYLDAP_SESSION *session); int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session); +/* Note that our caller has to free the returned value with ldap_free() */ char *passwd_username2dn(MYLDAP_SESSION *session,const char *username); #endif /* not _SERVER_COMMON_H */ diff --git a/nslcd/passwd.c b/nslcd/passwd.c index bd0a1fb..1f5d1b8 100644 --- a/nslcd/passwd.c +++ b/nslcd/passwd.c @@ -241,12 +241,16 @@ static enum nss_status _nss_ldap_parse_pw( return NSS_STATUS_SUCCESS; } +/* Note that our caller has to free the returned value with ldap_free() */ char *passwd_username2dn(MYLDAP_SESSION *session,const char *username) { char *userdn=NULL; static const char *no_attrs[]={ NULL }; char filter[1024]; LDAPMessage *res,*e; + /* log call */ + log_log(LOG_DEBUG,"passwd_username2dn(%s)",username); + /* do the LDAP request */ mkfilter_passwd_byname(username,filter,sizeof(filter)); if (_nss_ldap_search_sync(session,passwd_base,passwd_scope,filter,no_attrs,1,&res)==NSS_STATUS_SUCCESS) { |