Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117902584
D720.1775383543.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D720.1775383543.diff
View Options
diff --git a/.arclint b/.arclint
--- a/.arclint
+++ b/.arclint
@@ -24,6 +24,7 @@
"E251": "disabled",
"E261": "disabled",
"E265": "disabled",
+ "E266": "disabled",
"E302": "disabled",
"E303": "disabled",
"E402": "disabled",
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -502,10 +502,12 @@
else:
base_dn = config_base_dn
+ _filter = "(%s=%s)" % (unique_attribute, ldap.filter.escape_filter_chars(entry_id))
+
_search = self.ldap.search_ext(
base_dn,
ldap.SCOPE_SUBTREE,
- '(%s=%s)' % (unique_attribute, entry_id),
+ _filter,
['entrydn']
)
@@ -718,7 +720,7 @@
__filter_prefix = "(&"
__filter_suffix = "(!(%s=%s)))" % (
self.config_get('unique_attribute'),
- exclude_entry_id
+ ldap.filter.escape_filter_chars(exclude_entry_id)
)
else:
@@ -794,7 +796,7 @@
__filter_prefix = "(&"
__filter_suffix = "(!(%s=%s)))" % (
self.config_get('unique_attribute'),
- exclude_entry_id
+ ldap.filter.escape_filter_chars(exclude_entry_id)
)
else:
@@ -849,7 +851,10 @@
for _result in _results:
(_entry_id, _entry_attrs) = _result
- _entry_dns.append(_entry_id)
+
+ # Prevent Active Directory referrals
+ if not _entry_id == None:
+ _entry_dns.append(_entry_id)
return _entry_dns
@@ -1232,7 +1237,7 @@
else:
base_dn = config_base_dn
- return self._search(
+ _results = self._search(
base_dn,
filterstr=_filter,
attrlist=[
@@ -1241,6 +1246,17 @@
override_search='_regular_search'
)
+ _entry_dns = []
+
+ for _result in _results:
+ (_entry_dn, _entry_attrs) = _result
+
+ # Prevent Active Directory referrals
+ if not _entry_dn == None:
+ _entry_dns.append(_entry_id)
+
+ return _entry_dns
+
def set_entry_attribute(self, entry_id, attribute, value):
log.debug(_("Setting entry attribute %r to %r for %r") % (attribute, value, entry_id), level=8)
self.set_entry_attributes(entry_id, { attribute: value })
@@ -1306,7 +1322,7 @@
_filter = "(&%s(modifytimestamp>=%s))" % (_filter,modified_after)
- log.debug(_("Using filter %r") % (_filter), level=8)
+ log.debug(_("Synchronization is using filter %r") % (_filter), level=8)
if not mode == 0:
override_search = mode
@@ -2304,7 +2320,8 @@
# The list of naming contexts in the LDAP server
attrs = self.get_entry_attributes("", ['namingContexts'])
- naming_contexts = attrs['namingcontexts']
+ # Lower case of naming contexts - primarily for AD
+ naming_contexts = utils.normalize(attrs['namingcontexts'])
if isinstance(naming_contexts, basestring):
naming_contexts = [ naming_contexts ]
@@ -2643,6 +2660,9 @@
# Typical for Persistent Change Control EntryChangeNotification
if kw.has_key('change_type'):
+
+ log.debug(_("change_type defined, typical for Persistent Change Control EntryChangeNotification"), level=5)
+
change_type = None
change_dict = {
@@ -2693,6 +2713,9 @@
# Typical for Paged Results Control
elif kw.has_key('entry') and isinstance(kw['entry'], list):
+
+ log.debug(_("No change_type, typical for Paged Results Control"), level=5)
+
for entry_dn,entry_attrs in kw['entry']:
# This is a referral
if entry_dn == None:
@@ -2703,7 +2726,7 @@
for attr in entry_attrs.keys():
entry[attr.lower()] = entry_attrs[attr]
- unique_attr = self.config_get('unique_attribute')
+ unique_attr = self.config_get('unique_attribute').lower()
entry['id'] = entry[unique_attr]
try:
@@ -2711,7 +2734,7 @@
except:
entry['type'] = "unknown"
- log.debug(_("Entry type: %s") % (entry['type']), level=8)
+ log.debug(_("Entry type for dn: %s is: %s") % (entry['dn'], entry['type']), level=8)
eval("self._change_none_%s(entry, None)" % (entry['type']))
@@ -2878,6 +2901,9 @@
break
+ # Remove referrals
+ _result_data = [_e for _e in _result_data if _e[0] is not None]
+
if callback:
callback(entry=_result_data)
diff --git a/pykolab/auth/ldap/cache.py b/pykolab/auth/ldap/cache.py
--- a/pykolab/auth/ldap/cache.py
+++ b/pykolab/auth/ldap/cache.py
@@ -23,6 +23,7 @@
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import Integer
+from sqlalchemy import LargeBinary
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import Table
@@ -79,7 +80,7 @@
entry_table = Table(
'entry', metadata,
Column('id', Integer, primary_key=True),
- Column('uniqueid', String(128), nullable=False),
+ Column('uniqueid', LargeBinary, nullable=False),
Column('result_attribute', String(128), nullable=False),
Column('last_change', DateTime),
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 10:05 AM (14 h, 27 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833142
Default Alt Text
D720.1775383543.diff (5 KB)
Attached To
Mode
D720: Changes required for pykolab to work with AD
Attached
Detach File
Event Timeline