Module: check_mk
Branch: master
Commit: dcfcc2c6486e2525fb19f3a74bbdf9b67962fd11
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dcfcc2c6486e25…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 15:51:36 2018 +0100
cleanup some make_utf8() calls
Change-Id: Ie9bfdad385696dd49ad79e72f3795abf2ceb7107
---
web/plugins/userdb/htpasswd.py | 2 +-
web/plugins/userdb/ldap.py | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/web/plugins/userdb/htpasswd.py b/web/plugins/userdb/htpasswd.py
index 3c46989..71ebfea 100644
--- a/web/plugins/userdb/htpasswd.py
+++ b/web/plugins/userdb/htpasswd.py
@@ -114,7 +114,7 @@ class HtpasswdUserConnector(UserConnector):
locksym = '!'
else:
locksym = ""
- output += "%s:%s%s\n" % (make_utf8(id), locksym,
user["password"])
+ output += "%s:%s%s\n" % (id.encode("utf-8"), locksym,
user["password"])
store.save_file(cmk.paths.htpasswd_file, output)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index ff35be0..aeb1ae5 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -478,6 +478,12 @@ class LDAPUserConnector(UserConnector):
LDAP_CONTROL_PAGED_RESULTS, True, (page_size, '')
)
+ if type(base) == unicode:
+ base = base.encode("utf-8")
+
+ if type(filt) == unicode:
+ filt = filt.encode("utf-8")
+
results = []
while True:
# issue the ldap search command (async)
@@ -529,8 +535,8 @@ class LDAPUserConnector(UserConnector):
result = []
try:
- for dn, obj in self.ldap_paged_async_search(make_utf8(base),
- self.ldap_get_scope(scope), make_utf8(filt),
columns):
+ for dn, obj in self.ldap_paged_async_search(base,
+ self.ldap_get_scope(scope), filt, columns):
if dn is None:
continue # skip unwanted answers
new_obj = {}