You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2020/11/02 21:28:06 UTC

[allura] 15/15: [#8378] ldap fixes for py3

This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 637ee231abd5b836f731a1e5b58b266f85fac746
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Oct 12 18:16:36 2020 -0400

    [#8378] ldap fixes for py3
---
 Allura/allura/lib/plugin.py                         | 4 ++--
 Allura/allura/tests/unit/test_ldap_auth_provider.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 7c603b3..0809654 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -744,7 +744,7 @@ class LdapAuthenticationProvider(AuthenticationProvider):
             con = ldap_conn(ldap_ident, ldap_pass)
             new_password = self._encode_password(new_password)
             con.modify_s(
-                dn, [(ldap.MOD_REPLACE, b'userPassword', new_password)])
+                dn, [(ldap.MOD_REPLACE, 'userPassword', new_password)])
             con.unbind_s()
             user.last_password_updated = datetime.utcnow()
             session(user).flush(user)
@@ -1744,7 +1744,7 @@ class LdapUserPreferencesProvider(UserPreferencesProvider):
             con = ldap_conn()
             ldap_attr = self.fields[pref_name]
             con.modify_s(ldap_user_dn(user.username),
-                         [(ldap.MOD_REPLACE, ldap_attr.encode('utf-8'), pref_value.encode('utf-8'))])
+                         [(ldap.MOD_REPLACE, ldap_attr, pref_value.encode('utf-8'))])
             con.unbind_s()
         else:
             return LocalUserPreferencesProvider().set_pref(user, pref_name, pref_value)
diff --git a/Allura/allura/tests/unit/test_ldap_auth_provider.py b/Allura/allura/tests/unit/test_ldap_auth_provider.py
index f5dc4c7..76733ee 100644
--- a/Allura/allura/tests/unit/test_ldap_auth_provider.py
+++ b/Allura/allura/tests/unit/test_ldap_auth_provider.py
@@ -68,7 +68,7 @@ class TestLdapAuthenticationProvider(object):
         connection = ldap.initialize.return_value
         connection.bind_s.called_once_with(dn, b'old-pass')
         connection.modify_s.assert_called_once_with(
-            dn, [(ldap.MOD_REPLACE, b'userPassword', b'new-pass-hash')])
+            dn, [(ldap.MOD_REPLACE, 'userPassword', b'new-pass-hash')])
         assert_equal(connection.unbind_s.call_count, 1)
 
     @patch('allura.lib.plugin.ldap')