diff options
author | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-04-22 22:42:05 +0200 |
---|---|---|
committer | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2020-04-22 22:42:05 +0200 |
commit | f6fd16282811d1a686b5ae611351b0f8eed3c008 (patch) | |
tree | dc37399cc3aefb4e733c3307d8a4fdd5c0438e74 /ldap3/operation/bind.py | |
parent | 4083ce411fb1d311316baa250fb271bfb0b63058 (diff) |
New upstream version 2.7
Diffstat (limited to 'ldap3/operation/bind.py')
-rw-r--r-- | ldap3/operation/bind.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ldap3/operation/bind.py b/ldap3/operation/bind.py index a74b04a..43ad1fb 100644 --- a/ldap3/operation/bind.py +++ b/ldap3/operation/bind.py @@ -5,7 +5,7 @@ #
# Author: Giovanni Cannata
#
-# Copyright 2013 - 2018 Giovanni Cannata
+# Copyright 2013 - 2020 Giovanni Cannata
#
# This file is part of ldap3.
#
@@ -25,7 +25,7 @@ from .. import SIMPLE, ANONYMOUS, SASL, STRING_TYPES
from ..core.results import RESULT_CODES
-from ..core.exceptions import LDAPPasswordIsMandatoryError, LDAPUnknownAuthenticationMethodError, LDAPUserNameNotAllowedError
+from ..core.exceptions import LDAPUserNameIsMandatoryError, LDAPPasswordIsMandatoryError, LDAPUnknownAuthenticationMethodError, LDAPUserNameNotAllowedError
from ..protocol.sasl.sasl import validate_simple_password
from ..protocol.rfc4511 import Version, AuthenticationChoice, Simple, BindRequest, ResultCode, SaslCredentials, BindResponse, \
LDAPDN, LDAPString, Referral, ServerSaslCreds, SicilyPackageDiscovery, SicilyNegotiate, SicilyResponse
@@ -52,7 +52,7 @@ def bind_operation(version, request['name'] = to_unicode(name) if auto_encode else name
if authentication == SIMPLE:
if not name:
- raise LDAPPasswordIsMandatoryError('user name is mandatory in simple bind')
+ raise LDAPUserNameIsMandatoryError('user name is mandatory in simple bind')
if password:
request['authentication'] = AuthenticationChoice().setComponentByName('simple', Simple(validate_simple_password(password)))
else:
@@ -122,7 +122,7 @@ def bind_response_to_dict(response): 'description': ResultCode().getNamedValues().getName(response['resultCode']),
'dn': str(response['matchedDN']),
'message': str(response['diagnosticMessage']),
- 'referrals': referrals_to_list(response['referral']),
+ 'referrals': referrals_to_list(response['referral']) if response['referral'] is not None and response['referral'].hasValue() else [],
'saslCreds': bytes(response['serverSaslCreds']) if response['serverSaslCreds'] is not None and response['serverSaslCreds'].hasValue() else None}
|