Skip to content

Commit

Permalink
Fail on empty password
Browse files Browse the repository at this point in the history
  • Loading branch information
benscott committed Apr 11, 2017
1 parent 2a3b511 commit 1e9e56f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ckanext/ldap/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _ldap_search(cnx, filter_str, attributes, non_unique='raise'):


def _check_ldap_password(cn, password):
"""Checkes that the given cn/password credentials work on the given CN.
"""Checks that the given cn/password credentials work on the given CN.
@param cn: Common name to log on
@param password: Password for cn
Expand All @@ -286,5 +286,9 @@ def _check_ldap_password(cn, password):
except ldap.INVALID_CREDENTIALS:
log.debug('Invalid LDAP credentials')
return False
# Fail on empty password
if password == '':
log.debug('Invalid LDAP credentials')
return False
cnx.unbind_s()
return True

0 comments on commit 1e9e56f

Please sign in to comment.