Here's the patch for iRedAdmin-Pro-LDAP-2.3.1 to fix this issue:
diff -Naur a/controllers/ldap/domain.py b/controllers/ldap/domain.py
--- a/controllers/ldap/domain.py 2015-06-03 15:09:16.000000000 +0800
+++ b/controllers/ldap/domain.py 2015-12-01 08:41:49.000000000 +0800
@@ -31,11 +31,13 @@
search_filter = None
if 'starts_with' in web_input:
first_char = web_input.get('starts_with')[:1].upper()
- if iredutils.is_valid_account_first_char(first_char):
- search_filter = '(&(objectClass=mailDomain)(domainName=%s*))' % first_char
+ if not iredutils.is_valid_account_first_char(first_char):
+ first_char = None
domainLib = domainlib.Domain()
- result = domainLib.list_accounts(search_filter=search_filter)
+ result = domainLib.list_accounts(search_filter=search_filter,
+ starts_with=first_char)
if result[0] is True:
allDomains = result[1]
diff -Naur a/libs/ldaplib/connUtils.py b/libs/ldaplib/connUtils.py
--- a/libs/ldaplib/connUtils.py 2015-06-03 15:09:16.000000000 +0800
+++ b/libs/ldaplib/connUtils.py 2015-12-01 08:43:48.000000000 +0800
@@ -613,7 +613,8 @@
def get_all_domains(self,
attributes=attrs.DOMAIN_SEARCH_ATTRS,
search_filter=None,
- names_only=False):
+ names_only=False,
+ starts_with=None):
admin = session['username']
if not search_filter:
@@ -621,11 +622,15 @@
if session.get('is_global_admin'):
search_filter = '(objectClass=mailDomain)'
+ if starts_with:
+ if iredutils.is_valid_account_first_char(starts_with):
+ search_filter = '(&' + search_filter + ('(domainName=%s*)' % starts_with) + ')'
+
try:
qr = self.conn.search_s(settings.ldap_basedn,
- ldap.SCOPE_ONELEVEL,
- search_filter,
- attributes)
+ ldap.SCOPE_ONELEVEL,
+ search_filter,
+ attributes)
if names_only:
domain_names = []
for r in qr:
diff -Naur a/libs/ldaplib/domain.py b/libs/ldaplib/domain.py
--- a/libs/ldaplib/domain.py 2015-08-19 19:45:38.000000000 +0800
+++ b/libs/ldaplib/domain.py 2015-12-01 08:44:22.000000000 +0800
@@ -134,11 +134,13 @@
def list_accounts(self,
attributes=attrs.DOMAIN_SEARCH_ATTRS,
search_filter=None,
- names_only=False):
+ names_only=False,
+ starts_with=None):
connutils = connUtils.Utils()
result = connutils.get_all_domains(attributes=attributes,
search_filter=search_filter,
- names_only=names_only)
+ names_only=names_only,
+ starts_with=starts_with)
if result[0] is True:
all_domains = result[1]
all_domains.sort()
Post's attachmentsstarts_with.patch 3.21 kb, file has never been downloaded.
You don't have the permssions to download the attachments of this post.