Univention Bugzilla – Attachment 7342 Details for
Bug 40129
LDAP filter escaping incomplete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
40129.patch (text/plain), 2.16 KB, created by
Florian Best
on 2015-12-02 15:58 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2015-12-02 15:58 CET
Size:
2.16 KB
patch
obsolete
>diff --git a/management/univention-directory-manager-modules/modules/univention/admin/filter.py b/management/univention-directory-manager-modules/modules/univention/admin/filter.py >index f94a7a1..27cdff1 100644 >--- a/management/univention-directory-manager-modules/modules/univention/admin/filter.py >+++ b/management/univention-directory-manager-modules/modules/univention/admin/filter.py >@@ -32,19 +32,12 @@ > > import re > import types >+import ldap.filter > import univention.admin.uexceptions > > def escapeForLdapFilter(txt): >- """Escape LDAP filter value. >- Bug #19976: According to RFC2254 [*()\\\0] must be \\%02x encoded. >- >- >>> escapeForLdapFilter('key=value') >- 'key=value' >- >>> escapeForLdapFilter('description=Number (1)') >- 'description=Number \\\\281\\\\29' >- """ >- # parenthesis mess up ldap filters - they should be escaped >- return txt.replace('(', '\(').replace(')', '\)').replace('\\', '\\\\') >+ """Escape LDAP filter value.""" >+ return ldap.filter.escape_filter_chars(txt) > > class conjunction: > """LDAP filter conjunction (&) or disjunction (|).""" >diff --git a/base/univention-python/modules/uldap.py b/base/univention-python/modules/uldap.py >index 3557c64..94b8312 100644 >--- a/base/univention-python/modules/uldap.py >+++ b/base/univention-python/modules/uldap.py >@@ -32,6 +32,7 @@ > > import ldap > import ldap.schema >+import ldap.dn > import univention.debug > from univention.config_registry import ConfigRegistry > from ldapurl import LDAPUrl >@@ -43,22 +44,14 @@ def _extend_uniq(list1, list2): > list1.append(item) > > def parentDn(dn, base=''): >- _d=univention.debug.function('uldap.parentDn dn=%s base=%s' % (dn, base)) >+ univention.debug.function('uldap.parentDn dn=%s base=%s' % (dn, base)) > if dn == base: >- return None >- pos=dn.find(',')+1 >- if pos == 0: >- return None >- return dn[pos:] >+ return >+ dn = ldap.dn.str2dn(dn) >+ return ldap.dn.dn2str(dn[1:]) > > def explodeDn(dn, notypes=0): >- if not dn: >- return [] >- >- exploded_dn=dn.split(',') >- if notypes: >- return map(lambda(x): x[x.find('=')+1:], exploded_dn) >- return exploded_dn >+ return ldap.dn.explode_dn(dn, notypes) > > def getAdminConnection(start_tls=2, decode_ignorelist=[], reconnect=True): > ucr = ConfigRegistry()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 40129
:
7326
| 7342