diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-04 13:01:09 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2014-05-04 13:28:00 +0200 |
commit | 15fc13ce31cd6455d7c64089425da795da5d51d2 (patch) | |
tree | 1fbb0f99f89a9b05e012c66527e9892b47fbf93f /nslcd/pam.c | |
parent | f9878913604c197a214b78f26782efd245237dda (diff) |
Warn when binddn buffer is too small
Diffstat (limited to 'nslcd/pam.c')
-rw-r--r-- | nslcd/pam.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nslcd/pam.c b/nslcd/pam.c index c194225..7bedcee 100644 --- a/nslcd/pam.c +++ b/nslcd/pam.c @@ -2,7 +2,7 @@ pam.c - pam processing routines Copyright (C) 2009 Howard Chu - Copyright (C) 2009, 2010, 2011, 2012, 2013 Arthur de Jong + Copyright (C) 2009-2014 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 @@ -55,7 +55,11 @@ static int try_bind(const char *userdn, const char *password, if (session == NULL) return LDAP_UNAVAILABLE; /* set up credentials for the session */ - myldap_set_credentials(session, userdn, password); + if (myldap_set_credentials(session, userdn, password)) + { + myldap_session_close(session); + return LDAP_LOCAL_ERROR; + } /* perform search for own object (just to do any kind of search) */ attrs[0] = "dn"; attrs[1] = NULL; @@ -686,7 +690,11 @@ static int try_pwmod(MYLDAP_SESSION *oldsession, if (session == NULL) return LDAP_UNAVAILABLE; /* set up credentials for the session */ - myldap_set_credentials(session, binddn, oldpassword); + if (myldap_set_credentials(session, userdn, oldpassword)) + { + myldap_session_close(session); + return LDAP_LOCAL_ERROR; + } /* perform search for own object (just to do any kind of search) */ if ((lookup_dn2uid(session, userdn, &rc, buffer, sizeof(buffer)) != NULL) && (rc == LDAP_SUCCESS)) |