aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2007-05-04 15:50:33 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2007-05-04 15:50:33 +0000
commit17ec0273c2fd7c183782672e910f31d20b52abe7 (patch)
tree86399bc22e18e1736bd9dd464eb7b68a839a890b
parentbd030af75529f0f6344252983a9a1f434baedf6b (diff)
downloadmgarepo-17ec0273c2fd7c183782672e910f31d20b52abe7.tar
mgarepo-17ec0273c2fd7c183782672e910f31d20b52abe7.tar.gz
mgarepo-17ec0273c2fd7c183782672e910f31d20b52abe7.tar.bz2
mgarepo-17ec0273c2fd7c183782672e910f31d20b52abe7.tar.xz
mgarepo-17ec0273c2fd7c183782672e910f31d20b52abe7.zip
Escape values used in LDAP search filters using ldap.filter.
-rw-r--r--RepSys/plugins/ldapusers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/RepSys/plugins/ldapusers.py b/RepSys/plugins/ldapusers.py
index 6471f58..75d362c 100644
--- a/RepSys/plugins/ldapusers.py
+++ b/RepSys/plugins/ldapusers.py
@@ -118,6 +118,8 @@ def make_handler():
except ImportError:
raise Error, "LDAP support needs the python-ldap package "\
"to be installed"
+ else:
+ from ldap.filter import escape_filter_chars
def users_wrapper(section, option=None, default=None, walk=False):
global users_cache
@@ -137,7 +139,7 @@ def make_handler():
except ldap.LDAPError, e:
raise LDAPError(e)
try:
- data = {"username": option}
+ data = {"username": escape_filter_chars(option)}
filter = interpolate("ldap-filterformat", filterformat, data)
attrs = used_attributes(format)
try: