[Python-modules-commits] [python-ldap3] 01/03: Import python-ldap3_1.0.3.orig.tar.gz

Brian May bam at moszumanska.debian.org
Sun Jan 3 04:20:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch master
in repository python-ldap3.

commit 474b0f8e4c33caf3fe6484c5f32b2e6825d73767
Author: Brian May <bam at debian.org>
Date:   Sun Jan 3 14:55:52 2016 +1100

    Import python-ldap3_1.0.3.orig.tar.gz
---
 PKG-INFO                      |   2 +-
 _version.json                 |   2 +-
 ldap3.egg-info/PKG-INFO       |   2 +-
 ldap3/__init__.py             |  35 ++--
 ldap3/abstract/entry.py       | 407 +++++++++++++++++++++---------------------
 ldap3/core/connection.py      |   6 +-
 ldap3/core/exceptions.py      |   8 +
 ldap3/operation/bind.py       |   9 +-
 ldap3/version.py              |   4 +-
 setup.cfg                     |   2 +-
 test/testAbstractionSearch.py |   2 +-
 test/testBindOperation.py     |   3 +
 test/testExtensions.py        |   2 +-
 13 files changed, 252 insertions(+), 232 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 95c44bf..400fee0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ldap3
-Version: 1.0.2
+Version: 1.0.3
 Summary: A strictly RFC 4510 conforming LDAP V3 pure Python client library. The same codebase works with Python 2, Python 3, PyPy, PyPy3 and Nuikta
 Home-page: https://github.com/cannatag/ldap3
 Author: Giovanni Cannata
diff --git a/_version.json b/_version.json
index 1894fa2..ba68788 100644
--- a/_version.json
+++ b/_version.json
@@ -6,6 +6,6 @@
     "url": "https://github.com/cannatag/ldap3",
     "description": "A strictly RFC 4510 conforming LDAP V3 pure Python client library. The same codebase works with Python 2, Python 3, PyPy, PyPy3 and Nuikta",
     "author": "Giovanni Cannata",
-    "version": "1.0.2",
+    "version": "1.0.3",
     "license": "LGPL v3"
 }
diff --git a/ldap3.egg-info/PKG-INFO b/ldap3.egg-info/PKG-INFO
index 95c44bf..400fee0 100644
--- a/ldap3.egg-info/PKG-INFO
+++ b/ldap3.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ldap3
-Version: 1.0.2
+Version: 1.0.3
 Summary: A strictly RFC 4510 conforming LDAP V3 pure Python client library. The same codebase works with Python 2, Python 3, PyPy, PyPy3 and Nuikta
 Home-page: https://github.com/cannatag/ldap3
 Author: Giovanni Cannata
diff --git a/ldap3/__init__.py b/ldap3/__init__.py
index 9e26ac0..859cfd6 100644
--- a/ldap3/__init__.py
+++ b/ldap3/__init__.py
@@ -354,48 +354,48 @@ def get_config_parameter(parameter):
     raise LDAPConfigurationParameterError('configuration parameter %s not valid' % parameter)
 
 
-def set_config_parameter(parameter):
+def set_config_parameter(parameter, value):
     if parameter == 'CASE_INSENSITIVE_ATTRIBUTE_NAMES':
         global CASE_INSENSITIVE_ATTRIBUTE_NAMES
-        CASE_INSENSITIVE_ATTRIBUTE_NAMES = parameter
+        CASE_INSENSITIVE_ATTRIBUTE_NAMES = value
     elif parameter == 'CASE_INSENSITIVE_SCHEMA_NAMES':
         global CASE_INSENSITIVE_SCHEMA_NAMES
-        CASE_INSENSITIVE_SCHEMA_NAMES = parameter
+        CASE_INSENSITIVE_SCHEMA_NAMES = value
     elif parameter == 'ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX':
         global ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX
-        ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX = parameter
+        ABSTRACTION_OPERATIONAL_ATTRIBUTE_PREFIX = value
     elif parameter == 'POOLING_LOOP_TIMEOUT':
         global POOLING_LOOP_TIMEOUT
-        POOLING_LOOP_TIMEOUT = parameter
+        POOLING_LOOP_TIMEOUT = value
     elif parameter == 'RESPONSE_SLEEPTIME':
         global RESPONSE_SLEEPTIME
-        RESPONSE_SLEEPTIME = parameter
+        RESPONSE_SLEEPTIME = value
     elif parameter == 'RESPONSE_WAITING_TIMEOUT':
         global RESPONSE_WAITING_TIMEOUT
-        RESPONSE_WAITING_TIMEOUT = parameter
+        RESPONSE_WAITING_TIMEOUT = value
     elif parameter == 'SOCKET_SIZE':
         global SOCKET_SIZE
-        SOCKET_SIZE = parameter
+        SOCKET_SIZE = value
     elif parameter == 'CHECK_AVAILABILITY_TIMEOUT':
         global CHECK_AVAILABILITY_TIMEOUT
-        CHECK_AVAILABILITY_TIMEOUT = parameter
+        CHECK_AVAILABILITY_TIMEOUT = value
     elif parameter == 'RESTARTABLE_SLEEPTIME':
         global RESTARTABLE_SLEEPTIME
-        RESTARTABLE_SLEEPTIME = parameter
+        RESTARTABLE_SLEEPTIME = value
     elif parameter == 'RESTARTABLE_TRIES':
         global RESTARTABLE_TRIES
-        RESTARTABLE_TRIES = parameter
+        RESTARTABLE_TRIES = value
     elif parameter == 'REUSABLE_THREADED_POOL_SIZE':
         global REUSABLE_THREADED_POOL_SIZE
-        REUSABLE_THREADED_POOL_SIZE = parameter
+        REUSABLE_THREADED_POOL_SIZE = value
     elif parameter == 'REUSABLE_THREADED_LIFETIME':
         global REUSABLE_THREADED_LIFETIME
-        REUSABLE_THREADED_LIFETIME = parameter
+        REUSABLE_THREADED_LIFETIME = value
     elif parameter == 'DEFAULT_THREADED_POOL_NAME':
         global DEFAULT_THREADED_POOL_NAME
-        DEFAULT_THREADED_POOL_NAME = parameter
-
-    raise LDAPConfigurationParameterError('unable to set configuration parameter %s' % parameter)
+        DEFAULT_THREADED_POOL_NAME = value
+    else:
+        raise LDAPConfigurationParameterError('unable to set configuration parameter %s' % parameter)
 
 # centralized imports
 from .version import __author__, __version__, __email__, __description__, __status__, __license__, __url__
@@ -417,7 +417,8 @@ from .core.exceptions import LDAPException, LDAPExceptionError, LDAPConfiguratio
     LDAPSSLNotSupportedError, LDAPStartTLSError, LDAPTypeError, LDAPUnknownAuthenticationMethodError, LDAPUnknownRequestError, \
     LDAPUnknownResponseError, LDAPUnknownStrategyError, LDAPDefinitionError, LDAPResponseTimeoutError, LDAPInvalidHashAlgorithmError, \
     LDAPSessionTerminatedByServerError, LDAPMaximumRetriesError, LDAPExtensionError, LDAPInvalidDnError, LDAPInvalidPortError, \
-    LDAPPackageUnavailableError, LDAPConfigurationParameterError, LDAPInvalidTlsSpecificationError
+    LDAPPackageUnavailableError, LDAPConfigurationParameterError, LDAPInvalidTlsSpecificationError, LDAPUserNameNotAllowedError, \
+    LDAPUserNameIsMandatoryError
 
 # imports result code Exceptions
 from .core.exceptions import LDAPAdminLimitExceededResult, LDAPAffectMultipleDSASResult, LDAPAliasDereferencingProblemResult,\
diff --git a/ldap3/abstract/entry.py b/ldap3/abstract/entry.py
index 0083361..9c058b2 100644
--- a/ldap3/abstract/entry.py
+++ b/ldap3/abstract/entry.py
@@ -1,203 +1,204 @@
-"""
-"""
-
-# Created on 2014.01.06
-#
-# Author: Giovanni Cannata
-#
-# Copyright 2015 Giovanni Cannata
-#
-# This file is part of ldap3.
-#
-# ldap3 is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# ldap3 is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with ldap3 in the COPYING and COPYING.LESSER files.
-# If not, see <http://www.gnu.org/licenses/>.
-
-from os import linesep
-import json
-from .. import STRING_TYPES
-from ..core.exceptions import LDAPKeyError, LDAPAttributeError, LDAPEntryError
-from ..utils.conv import check_json_dict, format_json, prepare_for_stream
-from ..protocol.rfc2849 import operation_to_ldif, add_ldif_header
-from ..utils.repr import to_stdout_encoding
-
-
-class Entry(object):
-    """The Entry object contains a single entry from the result of an LDAP
-    search.  Attributes can be accessed either by sequence, by assignment
-    or as dictionary keys. Keys are not case sensitive.
-
-    The Entry object is read only
-
-    - The DN is retrieved by get_entry_dn()
-    - The Reader reference is in get_entry_reader()
-    - Raw attributes values are retrieved by the get_raw_attributes() and
-      get_raw_attribute() methods
-
-    """
-
-    def __init__(self, dn, reader):
-        self.__dict__['_attributes'] = dict()
-        self.__dict__['_dn'] = dn
-        self.__dict__['_raw_attributes'] = None
-        self.__dict__['_response'] = None
-        self.__dict__['_reader'] = reader
-
-    def __repr__(self):
-        if self._dn is not None:
-            r = 'DN: ' + to_stdout_encoding(self._dn) + linesep
-            if self._attributes:
-                for attr in sorted(self._attributes):
-                    r += ' ' * 4 + repr(self._attributes[attr]) + linesep
-            return r
-        else:
-            return object.__repr__(self)
-
-    def __str__(self):
-        return self.__repr__()
-
-    def __iter__(self):
-        for attribute in self._attributes:
-            yield self._attributes[attribute]
-        raise StopIteration
-
-    def __contains__(self, item):
-        try:
-            return True if self.__getitem__(item) else False
-        except LDAPKeyError:
-            return False
-
-    def __getattr__(self, item):
-        if isinstance(item, STRING_TYPES):
-            item = ''.join(item.split()).lower()
-            for attr in self._attributes:
-                if item == attr.lower():
-                    break
-            else:
-                raise LDAPKeyError('key not found')
-            return self._attributes[attr]
-
-        raise LDAPKeyError('key must be a string')
-
-    def __setattr__(self, item, value):
-        if item in self._attributes:
-            raise LDAPAttributeError('attribute is read only')
-        else:
-            raise LDAPEntryError('entry is read only')
-
-    def __getitem__(self, item):
-        return self.__getattr__(item)
-
-    def __eq__(self, other):
-        if isinstance(other, Entry):
-            return self._dn == other.entry_get_dn()
-
-        return False
-
-    def __lt__(self, other):
-        if isinstance(other, Entry):
-            return self._dn <= other.entry_get_dn()
-
-        return False
-
-    def entry_get_dn(self):
-        """
-
-        :return: The distinguished name of the Entry
-        """
-        return self._dn
-
-    def entry_get_response(self):
-        """
-
-        :return: The origininal search response for the Entry
-        """
-        return self._dn
-
-    def entry_get_reader(self):
-        """
-
-        :return: the Reader object of the Entry
-        """
-        return self._reader
-
-    def entry_get_raw_attributes(self):
-        """
-
-        :return: The raw (unencoded) attributes of the Entry as bytes
-        """
-        return self._raw_attributes
-
-    def entry_get_raw_attribute(self, name):
-        """
-
-        :param name: name of the attribute
-        :return: raw (unencoded) value of the attribute, None if attribute is not found
-        """
-        return self._raw_attributes[name] if name in self._raw_attributes else None
-
-    def entry_get_attribute_names(self):
-        return list(self._raw_attributes.keys())
-
-    def entry_get_attributes_dict(self):
-        return dict((attribute_key, attribute_value.values) for (attribute_key, attribute_value) in self._attributes.items())
-
-    # noinspection PyProtectedMember
-    def entry_refresh_from_reader(self):
-        """Re-read the entry from the LDAP Server
-        """
-        if self.entry_get_reader():
-            temp_entry = self.entry_get_reader().search_object(self.entry_get_dn())
-            self.__dict__['_attributes'] = temp_entry._attributes
-            self.__dict__['_raw_attributes'] = temp_entry._raw_attributes
-            del temp_entry
-
-    def entry_to_json(self,
-                      raw=False,
-                      indent=4,
-                      sort=True,
-                      stream=None):
-
-        json_entry = dict()
-        json_entry['dn'] = self.entry_get_dn()
-        json_entry['attributes'] = self.entry_get_attributes_dict()
-        if raw:
-            json_entry['raw'] = dict(self.entry_get_raw_attributes())
-
-        if str == bytes:
-            check_json_dict(json_entry)
-
-        json_output = json.dumps(json_entry, ensure_ascii=True, sort_keys=sort, indent=indent, check_circular=True,
-                                 default=format_json, separators=(',', ': '))
-
-        if stream:
-            stream.write(json_output)
-
-        return json_output
-
-    def entry_to_ldif(self,
-                      all_base64=False,
-                      line_separator=None,
-                      sort_order=None,
-                      stream=None):
-
-        ldif_lines = operation_to_ldif('searchResponse', [self._response], all_base64, sort_order=sort_order)
-        ldif_lines = add_ldif_header(ldif_lines)
-        line_separator = line_separator or linesep
-        ldif_output = line_separator.join(ldif_lines)
-        if stream:
-            if stream.tell() == 0:
-                header = add_ldif_header(['-'])[0]
-                stream.write(prepare_for_stream(header + line_separator + line_separator))
-            stream.write(prepare_for_stream(ldif_output + line_separator + line_separator))
-        return ldif_output
+"""
+"""
+
+# Created on 2014.01.06
+#
+# Author: Giovanni Cannata
+#
+# Copyright 2015 Giovanni Cannata
+#
+# This file is part of ldap3.
+#
+# ldap3 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ldap3 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with ldap3 in the COPYING and COPYING.LESSER files.
+# If not, see <http://www.gnu.org/licenses/>.
+
+from os import linesep
+import json
+from .. import STRING_TYPES
+from ..core.exceptions import LDAPKeyError, LDAPAttributeError, LDAPEntryError
+from ..utils.conv import check_json_dict, format_json, prepare_for_stream
+from ..protocol.rfc2849 import operation_to_ldif, add_ldif_header
+from ..utils.repr import to_stdout_encoding
+
+
+class Entry(object):
+    """The Entry object contains a single entry from the result of an LDAP
+    search.  Attributes can be accessed either by sequence, by assignment
+    or as dictionary keys. Keys are not case sensitive.
+
+    The Entry object is read only
+
+    - The DN is retrieved by get_entry_dn()
+    - The Reader reference is in get_entry_reader()
+    - Raw attributes values are retrieved by the get_raw_attributes() and
+      get_raw_attribute() methods
+
+    """
+
+    def __init__(self, dn, reader):
+        self.__dict__['_attributes'] = dict()
+        self.__dict__['_dn'] = dn
+        self.__dict__['_raw_attributes'] = None
+        self.__dict__['_response'] = None
+        self.__dict__['_reader'] = reader
+
+    def __repr__(self):
+        if self._dn is not None:
+            r = 'DN: ' + to_stdout_encoding(self._dn) + linesep
+            if self._attributes:
+                for attr in sorted(self._attributes):
+                    r += ' ' * 4 + repr(self._attributes[attr]) + linesep
+            return r
+        else:
+            return object.__repr__(self)
+
+    def __str__(self):
+        return self.__repr__()
+
+    def __iter__(self):
+        for attribute in self._attributes:
+            yield self._attributes[attribute]
+        raise StopIteration
+
+    def __contains__(self, item):
+        try:
+            self.__getitem__(item)
+            return True
+        except LDAPKeyError:
+            return False
+
+    def __getattr__(self, item):
+        if isinstance(item, STRING_TYPES):
+            item = ''.join(item.split()).lower()
+            for attr in self._attributes:
+                if item == attr.lower():
+                    break
+            else:
+                raise LDAPKeyError('key not found')
+            return self._attributes[attr]
+
+        raise LDAPKeyError('key must be a string')
+
+    def __setattr__(self, item, value):
+        if item in self._attributes:
+            raise LDAPAttributeError('attribute is read only')
+        else:
+            raise LDAPEntryError('entry is read only')
+
+    def __getitem__(self, item):
+        return self.__getattr__(item)
+
+    def __eq__(self, other):
+        if isinstance(other, Entry):
+            return self._dn == other.entry_get_dn()
+
+        return False
+
+    def __lt__(self, other):
+        if isinstance(other, Entry):
+            return self._dn <= other.entry_get_dn()
+
+        return False
+
+    def entry_get_dn(self):
+        """
+
+        :return: The distinguished name of the Entry
+        """
+        return self._dn
+
+    def entry_get_response(self):
+        """
+
+        :return: The origininal search response for the Entry
+        """
+        return self._dn
+
+    def entry_get_reader(self):
+        """
+
+        :return: the Reader object of the Entry
+        """
+        return self._reader
+
+    def entry_get_raw_attributes(self):
+        """
+
+        :return: The raw (unencoded) attributes of the Entry as bytes
+        """
+        return self._raw_attributes
+
+    def entry_get_raw_attribute(self, name):
+        """
+
+        :param name: name of the attribute
+        :return: raw (unencoded) value of the attribute, None if attribute is not found
+        """
+        return self._raw_attributes[name] if name in self._raw_attributes else None
+
+    def entry_get_attribute_names(self):
+        return list(self._raw_attributes.keys())
+
+    def entry_get_attributes_dict(self):
+        return dict((attribute_key, attribute_value.values) for (attribute_key, attribute_value) in self._attributes.items())
+
+    # noinspection PyProtectedMember
+    def entry_refresh_from_reader(self):
+        """Re-read the entry from the LDAP Server
+        """
+        if self.entry_get_reader():
+            temp_entry = self.entry_get_reader().search_object(self.entry_get_dn())
+            self.__dict__['_attributes'] = temp_entry._attributes
+            self.__dict__['_raw_attributes'] = temp_entry._raw_attributes
+            del temp_entry
+
+    def entry_to_json(self,
+                      raw=False,
+                      indent=4,
+                      sort=True,
+                      stream=None):
+
+        json_entry = dict()
+        json_entry['dn'] = self.entry_get_dn()
+        json_entry['attributes'] = self.entry_get_attributes_dict()
+        if raw:
+            json_entry['raw'] = dict(self.entry_get_raw_attributes())
+
+        if str == bytes:
+            check_json_dict(json_entry)
+
+        json_output = json.dumps(json_entry, ensure_ascii=True, sort_keys=sort, indent=indent, check_circular=True,
+                                 default=format_json, separators=(',', ': '))
+
+        if stream:
+            stream.write(json_output)
+
+        return json_output
+
+    def entry_to_ldif(self,
+                      all_base64=False,
+                      line_separator=None,
+                      sort_order=None,
+                      stream=None):
+
+        ldif_lines = operation_to_ldif('searchResponse', [self._response], all_base64, sort_order=sort_order)
+        ldif_lines = add_ldif_header(ldif_lines)
+        line_separator = line_separator or linesep
+        ldif_output = line_separator.join(ldif_lines)
+        if stream:
+            if stream.tell() == 0:
+                header = add_ldif_header(['-'])[0]
+                stream.write(prepare_for_stream(header + line_separator + line_separator))
+            stream.write(prepare_for_stream(ldif_output + line_separator + line_separator))
+        return ldif_output
diff --git a/ldap3/core/connection.py b/ldap3/core/connection.py
index bfdf45a..cfcc22a 100644
--- a/ldap3/core/connection.py
+++ b/ldap3/core/connection.py
@@ -184,7 +184,8 @@ class Connection(object):
             self.strategy_type = client_strategy
             self.user = user
             self.password = password
-            if self.user and self.password and not authentication:
+
+            if not authentication and self.user:
                 self.authentication = SIMPLE
             elif not authentication:
                 self.authentication = ANONYMOUS
@@ -195,6 +196,7 @@ class Connection(object):
                 if log_enabled(ERROR):
                     log(ERROR, '%s for <%s>', self.last_error, self)
                 raise LDAPUnknownAuthenticationMethodError(self.last_error)
+
             self.version = version
             self.auto_referrals = True if auto_referrals else False
             self.request = None
@@ -456,7 +458,7 @@ class Connection(object):
                 if self.authentication == ANONYMOUS:
                     if log_enabled(PROTOCOL):
                         log(PROTOCOL, 'performing anonymous BIND for <%s>', self)
-                    request = bind_operation(self.version, self.authentication, '', '')
+                    request = bind_operation(self.version, self.authentication, self.user, '')
                     if log_enabled(PROTOCOL):
                         log(PROTOCOL, 'anonymous BIND request <%s> sent via <%s>', bind_request_to_dict(request), self)
                     response = self.post_send_single_response(self.send('bindRequest', request, controls))
diff --git a/ldap3/core/exceptions.py b/ldap3/core/exceptions.py
index 9633d00..7ba567d 100644
--- a/ldap3/core/exceptions.py
+++ b/ldap3/core/exceptions.py
@@ -438,6 +438,14 @@ class LDAPCertificateError(LDAPExceptionError):
     pass
 
 
+class LDAPUserNameNotAllowedError(LDAPExceptionError):
+    pass
+
+
+class LDAPUserNameIsMandatoryError(LDAPExceptionError):
+    pass
+
+
 class LDAPPasswordIsMandatoryError(LDAPExceptionError):
     pass
 
diff --git a/ldap3/operation/bind.py b/ldap3/operation/bind.py
index 0144cba..c2348ad 100644
--- a/ldap3/operation/bind.py
+++ b/ldap3/operation/bind.py
@@ -24,7 +24,8 @@
 # If not, see <http://www.gnu.org/licenses/>.
 
 from .. import SIMPLE, ANONYMOUS, SASL, RESULT_CODES
-from ..core.exceptions import LDAPPasswordIsMandatoryError, LDAPUnknownAuthenticationMethodError
+from ..core.exceptions import LDAPPasswordIsMandatoryError, LDAPUnknownAuthenticationMethodError, LDAPUserNameNotAllowedError, \
+    LDAPUserNameIsMandatoryError
 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
@@ -48,10 +49,12 @@ def bind_operation(version,
         name = ''
     request['name'] = name
     if authentication == SIMPLE:
+        if not name:
+            raise LDAPUserNameIsMandatoryError('user name is mandatory in simple bind')
         if password:
             request['authentication'] = AuthenticationChoice().setComponentByName('simple', Simple(validate_simple_password(password)))
         else:
-            raise LDAPPasswordIsMandatoryError('password is mandatory')
+            raise LDAPPasswordIsMandatoryError('password is mandatory in simple bind')
     elif authentication == SASL:
         sasl_creds = SaslCredentials()
         sasl_creds['mechanism'] = sasl_mechanism
@@ -59,6 +62,8 @@ def bind_operation(version,
             sasl_creds['credentials'] = sasl_credentials
         request['authentication'] = AuthenticationChoice().setComponentByName('sasl', sasl_creds)
     elif authentication == ANONYMOUS:
+        if name:
+            raise LDAPUserNameNotAllowedError('user name not allowed in anonymous bind')
         request['name'] = ''
         request['authentication'] = AuthenticationChoice().setComponentByName('simple', Simple(''))
     elif authentication == 'SICILY_PACKAGE_DISCOVERY':  # https://msdn.microsoft.com/en-us/library/cc223501.aspx
diff --git a/ldap3/version.py b/ldap3/version.py
index 3599da1..e1c4d0d 100644
--- a/ldap3/version.py
+++ b/ldap3/version.py
@@ -1,9 +1,9 @@
 # THIS FILE IS AUTO-GENERATED. PLEASE DO NOT MODIFY# version file for ldap3
-# generated on 2015-12-07 19:18:28.224952
+# generated on 2015-12-19 21:59:50.538199
 # on system uname_result(system='Windows', node='GCNBHPW8', release='post2012Server', version='6.3.9600', machine='AMD64', processor='Intel64 Family 6 Model 58 Stepping 9, GenuineIntel')
 # with Python 3.5.0 - ('v3.5.0:374f501f4567', 'Sep 13 2015 02:27:37') - MSC v.1900 64 bit (AMD64)
 #
-__version__ = '1.0.2'
+__version__ = '1.0.3'
 __author__ = 'Giovanni Cannata'
 __email__ = 'cannatag at gmail.com'
 __url__ = 'https://github.com/cannatag/ldap3'
diff --git a/setup.cfg b/setup.cfg
index b14b0bc..48b0f87 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [egg_info]
-tag_build = 
 tag_date = 0
 tag_svn_revision = 0
+tag_build = 
 
diff --git a/test/testAbstractionSearch.py b/test/testAbstractionSearch.py
index dda565a..0b8394a 100644
--- a/test/testAbstractionSearch.py
+++ b/test/testAbstractionSearch.py
@@ -31,7 +31,7 @@ testcase_id = random_id()
 
 class Test(unittest.TestCase):
     def setUp(self):
-        self.connection = get_connection(use_ssl=True)
+        self.connection = get_connection()
         self.delete_at_teardown = []
 
     def tearDown(self):
diff --git a/test/testBindOperation.py b/test/testBindOperation.py
index a76204f..e6fa805 100644
--- a/test/testBindOperation.py
+++ b/test/testBindOperation.py
@@ -40,11 +40,14 @@ class Test(unittest.TestCase):
 
     def test_bind_anonymous(self):
         connection = get_connection(bind=False, lazy_connection=False, authentication=ANONYMOUS)
+        old_user = connection.user
+        connection.user = None
         connection.open()
         connection.bind()
         self.assertTrue(connection.bound)
         drop_connection(connection)
         self.assertFalse(connection.bound)
+        connection.user = old_user
 
     def test_bind_sasl_digest_md5(self):
         connection = get_connection(bind=False, authentication=SASL, sasl_mechanism=DIGEST_MD5, sasl_credentials=(test_sasl_realm, test_sasl_user, test_sasl_password, None))
diff --git a/test/testExtensions.py b/test/testExtensions.py
index fafd14c..9db1db1 100644
--- a/test/testExtensions.py
+++ b/test/testExtensions.py
@@ -69,6 +69,6 @@ class Test(unittest.TestCase):
     def test_start_tls_extension(self):
         connection = get_connection(use_ssl=False)
         connection.server.tls = Tls()
-        result = self.connection.start_tls()
+        result = connection.start_tls()
         self.assertTrue(result)
         connection.unbind()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-ldap3.git



More information about the Python-modules-commits mailing list