summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-09-24 18:11:31 +0000
committerArthur de Jong <arthur@arthurdejong.org>2009-09-24 18:11:31 +0000
commit002cb7bb978c873d46eb7deed79f4f6572d92beb (patch)
tree9c98f52a5fc01e3fcacbbf76d37662c2c3ca0e8a
parentc749c3250044fc166324a17713022b21ec8132f1 (diff)
fix for problem when authenticating to LDAP entries without a uid attribute
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@992 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/pam.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/nslcd/pam.c b/nslcd/pam.c
index fc543ed..82a2a0c 100644
--- a/nslcd/pam.c
+++ b/nslcd/pam.c
@@ -73,6 +73,7 @@ static int validate_user(MYLDAP_SESSION *session,char *userdn,size_t userdnsz,
{
MYLDAP_ENTRY *entry=NULL;
const char *value;
+ const char **values;
/* check username for validity */
if (!isvalidname(username))
{
@@ -98,6 +99,16 @@ static int validate_user(MYLDAP_SESSION *session,char *userdn,size_t userdnsz,
}
/* get the "real" username */
value=myldap_get_rdn_value(entry,attmap_passwd_uid);
+ if (value==NULL)
+ {
+ /* get the username from the uid attribute */
+ values=myldap_get_values(entry,attmap_passwd_uid);
+ if ((values==NULL)||(values[0]==NULL))
+ log_log(LOG_WARNING,"\"%s\": DN %s is missing a %s attribute",
+ username,userdn,attmap_passwd_uid);
+ value=values[0];
+ }
+ /* check the username */
if ((value==NULL)||!isvalidname(value)||strlen(value)>=usernamesz)
{
log_log(LOG_WARNING,"\"%s\": DN %s has invalid username",username,userdn);