Fix #2: Import escape_attribute_value from upstream

This commit is contained in:
Marco Huenseler
2017-08-04 18:12:38 +02:00
parent be8162e66a
commit e8586e954e
2 changed files with 102 additions and 2 deletions

View File

@@ -25,12 +25,15 @@ Authentication based on the ``ldap3`` module
(https://github.com/cannatag/ldap3/).
"""
import ldap3
import ldap3.core.exceptions
import ldap3.utils.dn
from radicale.auth import BaseAuth
import radicale_auth_ldap.ldap3imports
class Auth(BaseAuth):
def is_authenticated(self, user, password):
"""Check if ``user``/``password`` couple is valid."""
@@ -53,7 +56,7 @@ class Auth(BaseAuth):
except Exception as err:
self.logger.debug("LDAP error: %s" % err)
distinguished_name = "%s=%s" % (ATTRIBUTE, ldap3.utils.dn.escape_attribute_value(user))
distinguished_name = "%s=%s" % (ATTRIBUTE, ldap3imports.escape_attribute_value(user))
self.logger.debug("LDAP bind for %s in base %s" % (distinguished_name, BASE))
if FILTER: