changeset 2681:8e10ce55531d beta

ldap requires only string attributes, fixes #435 ldap-does-not-work-with-non-latin-symbols
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 02 Aug 2012 17:09:55 +0200
parents 3b179f1ac3a2
children 63a980ac1bba
files rhodecode/lib/auth_ldap.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/auth_ldap.py	Thu Aug 02 20:12:16 2012 +0200
+++ b/rhodecode/lib/auth_ldap.py	Thu Aug 02 17:09:55 2012 +0200
@@ -27,6 +27,7 @@
 
 from rhodecode.lib.exceptions import LdapConnectionError, LdapUsernameError, \
     LdapPasswordError
+from rhodecode.lib.utils2 import safe_str
 
 log = logging.getLogger(__name__)
 
@@ -60,15 +61,15 @@
         self.LDAP_SERVER_PORT = port
 
         # USE FOR READ ONLY BIND TO LDAP SERVER
-        self.LDAP_BIND_DN = bind_dn
-        self.LDAP_BIND_PASS = bind_pass
+        self.LDAP_BIND_DN = safe_str(bind_dn)
+        self.LDAP_BIND_PASS = safe_str(bind_pass)
 
         self.LDAP_SERVER = "%s://%s:%s" % (ldap_server_type,
                                            self.LDAP_SERVER_ADDRESS,
                                            self.LDAP_SERVER_PORT)
 
-        self.BASE_DN = base_dn
-        self.LDAP_FILTER = ldap_filter
+        self.BASE_DN = safe_str(base_dn)
+        self.LDAP_FILTER = safe_str(ldap_filter)
         self.SEARCH_SCOPE = getattr(ldap, 'SCOPE_%s' % search_scope)
         self.attr_login = attr_login