summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2013-02-04 11:48:58 +0100
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:47 +0100
commit5b2e0e2ba5808d6300de1cac743c96db0607121c (patch)
tree3165cccfbd01e5d76e74ae4df612cf64675fc046
parenta09c50671ecc53af63765afca13edd27ee598081 (diff)
downloadfreeipa-5b2e0e2ba5808d6300de1cac743c96db0607121c.tar.gz
freeipa-5b2e0e2ba5808d6300de1cac743c96db0607121c.tar.xz
freeipa-5b2e0e2ba5808d6300de1cac743c96db0607121c.zip
Remove DN normalization from the baseldap plugin.
-rw-r--r--ipalib/plugins/automember.py22
-rw-r--r--ipalib/plugins/automount.py4
-rw-r--r--ipalib/plugins/baseldap.py21
-rw-r--r--ipalib/plugins/dns.py18
-rw-r--r--ipalib/plugins/entitle.py4
-rw-r--r--ipalib/plugins/permission.py6
-rw-r--r--ipalib/plugins/sudorule.py8
7 files changed, 27 insertions, 56 deletions
diff --git a/ipalib/plugins/automember.py b/ipalib/plugins/automember.py
index 8bd5edc0..4f563f11 100644
--- a/ipalib/plugins/automember.py
+++ b/ipalib/plugins/automember.py
@@ -303,8 +303,7 @@ class automember_add_condition(LDAPUpdate):
entry_attrs[attr] = [key + condition for condition in options[attr]]
completed += len(entry_attrs[attr])
try:
- (dn, old_entry) = ldap.get_entry(
- dn, [attr], normalize=self.obj.normalize_dn)
+ (dn, old_entry) = ldap.get_entry(dn, [attr])
for regex in old_entry.keys():
if not isinstance(entry_attrs[regex], (list, tuple)):
entry_attrs[regex] = [entry_attrs[regex]]
@@ -325,9 +324,7 @@ class automember_add_condition(LDAPUpdate):
# Make sure to returned the failed results if there is nothing to remove
if completed == 0:
- (dn, entry_attrs) = ldap.get_entry(
- dn, attrs_list, normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
raise errors.EmptyModlist
return dn
@@ -390,16 +387,13 @@ class automember_remove_condition(LDAPUpdate):
failed = {'failed': {}}
# Check to see if there are existing exclusive conditions present.
- (dn, exclude_present) = ldap.get_entry(
- dn, [EXCLUDE_RE], normalize=self.obj.normalize_dn)
+ (dn, exclude_present) = ldap.get_entry(dn, [EXCLUDE_RE])
for attr in (INCLUDE_RE, EXCLUDE_RE):
failed['failed'][attr] = []
if attr in options and options[attr]:
entry_attrs[attr] = [key + condition for condition in options[attr]]
- (dn, entry_attrs_) = ldap.get_entry(
- dn, [attr], normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs_) = ldap.get_entry(dn, [attr])
old_entry = entry_attrs_.get(attr, [])
for regex in entry_attrs[attr]:
if regex in old_entry:
@@ -418,9 +412,7 @@ class automember_remove_condition(LDAPUpdate):
# Make sure to returned the failed results if there is nothing to remove
if completed == 0:
- (dn, entry_attrs) = ldap.get_entry(
- dn, attrs_list, normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
raise errors.EmptyModlist
return dn
@@ -550,9 +542,7 @@ class automember_default_group_remove(LDAPUpdate):
api.env.basedn)
attr = 'automemberdefaultgroup'
- (dn, entry_attrs_) = ldap.get_entry(
- dn, [attr], normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs_) = ldap.get_entry(dn, [attr])
if attr not in entry_attrs_:
raise errors.NotFound(reason=_(u'No default (fallback) group set'))
diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index 417d6a31..22017fb5 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -715,9 +715,7 @@ class automountkey(LDAPObject):
# First we look with the information given, then try to search for
# the right entry.
try:
- (dn, entry_attrs) = ldap.get_entry(
- dn, ['*'], normalize=self.normalize_dn
- )
+ (dn, entry_attrs) = ldap.get_entry(dn, ['*'])
except errors.NotFound:
if kwargs.get('automountinformation', False):
sfilter = '(&(automountkey=%s)(automountinformation=%s))' % \
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index b125b531..923a019d 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -424,7 +424,6 @@ class LDAPObject(Object):
parent_object = ''
container_dn = ''
- normalize_dn = True
object_name = _('entry')
object_name_plural = _('entries')
object_class = []
@@ -868,7 +867,7 @@ last, after all sets and adds."""),
if needldapattrs:
try:
(dn, old_entry) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, needldapattrs, normalize=self.obj.normalize_dn
+ dn, needldapattrs
)
except errors.NotFound:
self.obj.handle_not_found(*keys)
@@ -1034,7 +1033,7 @@ class LDAPCreate(BaseLDAPCommand, crud.Create):
_check_limit_object_class(self.api.Backend.ldap2.schema.attribute_types(self.obj.disallow_object_classes), entry_attrs.keys(), allow_only=False)
try:
- self._exc_wrapper(keys, options, ldap.add_entry)(dn, entry_attrs, normalize=self.obj.normalize_dn)
+ self._exc_wrapper(keys, options, ldap.add_entry)(dn, entry_attrs)
except errors.NotFound:
parent = self.obj.parent_object
if parent:
@@ -1066,7 +1065,7 @@ class LDAPCreate(BaseLDAPCommand, crud.Create):
assert isinstance(dn, DN)
else:
(dn, entry_attrs) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, attrs_list, normalize=self.obj.normalize_dn
+ dn, attrs_list
)
assert isinstance(dn, DN)
except errors.NotFound:
@@ -1190,7 +1189,7 @@ class LDAPRetrieve(LDAPQuery):
try:
(dn, entry_attrs) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, attrs_list, normalize=self.obj.normalize_dn
+ dn, attrs_list
)
assert isinstance(dn, DN)
except errors.NotFound:
@@ -1315,7 +1314,7 @@ class LDAPUpdate(LDAPQuery, crud.Update):
# mean an error occurred, just that there were no other updates to
# perform.
assert isinstance(dn, DN)
- self._exc_wrapper(keys, options, ldap.update_entry)(dn, entry_attrs, normalize=self.obj.normalize_dn)
+ self._exc_wrapper(keys, options, ldap.update_entry)(dn, entry_attrs)
except errors.EmptyModlist, e:
if not rdnupdate:
raise e
@@ -1324,7 +1323,7 @@ class LDAPUpdate(LDAPQuery, crud.Update):
try:
(dn, entry_attrs) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, attrs_list, normalize=self.obj.normalize_dn
+ dn, attrs_list
)
except errors.NotFound:
raise errors.MidairCollision(
@@ -1395,12 +1394,12 @@ class LDAPDelete(LDAPMultiQuery):
for (dn_, entry_attrs) in subentries:
delete_subtree(dn_)
try:
- self._exc_wrapper(nkeys, options, ldap.delete_entry)(base_dn, normalize=self.obj.normalize_dn)
+ self._exc_wrapper(nkeys, options, ldap.delete_entry)(base_dn)
except errors.NotFound:
self.obj.handle_not_found(*nkeys)
try:
- self._exc_wrapper(nkeys, options, ldap.delete_entry)(dn, normalize=self.obj.normalize_dn)
+ self._exc_wrapper(nkeys, options, ldap.delete_entry)(dn)
except errors.NotFound:
self.obj.handle_not_found(*nkeys)
except errors.NotAllowedOnNonLeaf:
@@ -1554,7 +1553,7 @@ class LDAPAddMember(LDAPModMember):
try:
(dn, entry_attrs) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, attrs_list, normalize=self.obj.normalize_dn
+ dn, attrs_list
)
except errors.NotFound:
self.obj.handle_not_found(*keys)
@@ -1655,7 +1654,7 @@ class LDAPRemoveMember(LDAPModMember):
try:
(dn, entry_attrs) = self._exc_wrapper(keys, options, ldap.get_entry)(
- dn, attrs_list, normalize=self.obj.normalize_dn
+ dn, attrs_list
)
except errors.NotFound:
self.obj.handle_not_found(*keys)
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index e0a5a151..a23d1b82 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -2431,9 +2431,7 @@ class dnsrecord_add(LDAPCreate):
# We always want to retrieve all DNS record attributes to test for
# record type collisions (#2601)
try:
- (dn_, old_entry) = ldap.get_entry(
- dn, _record_attributes,
- normalize=self.obj.normalize_dn)
+ (dn_, old_entry) = ldap.get_entry(dn, _record_attributes)
except errors.NotFound:
pass
else:
@@ -2527,8 +2525,7 @@ class dnsrecord_mod(LDAPUpdate):
# current entry is needed in case of per-dns-record-part updates and
# for record type collision check
try:
- (dn_, old_entry) = ldap.get_entry(dn, _record_attributes,
- normalize=self.obj.normalize_dn)
+ (dn_, old_entry) = ldap.get_entry(dn, _record_attributes)
except errors.NotFound:
self.obj.handle_not_found(*keys)
@@ -2563,9 +2560,7 @@ class dnsrecord_mod(LDAPUpdate):
keys = keys[:-1] + (rename,)
dn = self.obj.get_dn(*keys, **options)
ldap = self.obj.backend
- (dn_, old_entry) = ldap.get_entry(
- dn, _record_attributes,
- normalize=self.obj.normalize_dn)
+ (dn_, old_entry) = ldap.get_entry(dn, _record_attributes)
del_all = True
for attr in old_entry.keys():
@@ -2680,9 +2675,7 @@ class dnsrecord_del(LDAPUpdate):
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
assert isinstance(dn, DN)
try:
- (dn_, old_entry) = ldap.get_entry(
- dn, _record_attributes,
- normalize=self.obj.normalize_dn)
+ (dn_, old_entry) = ldap.get_entry(dn, _record_attributes)
except errors.NotFound:
self.obj.handle_not_found(*keys)
@@ -2957,8 +2950,7 @@ class dnsconfig(LDAPObject):
return DN(api.env.container_dns, api.env.basedn)
def get_dnsconfig(self, ldap):
- (dn, entry) = ldap.get_entry(self.get_dn(), None,
- normalize=self.normalize_dn)
+ (dn, entry) = ldap.get_entry(self.get_dn(), None)
return entry
diff --git a/ipalib/plugins/entitle.py b/ipalib/plugins/entitle.py
index e7d66a1c..05779a9f 100644
--- a/ipalib/plugins/entitle.py
+++ b/ipalib/plugins/entitle.py
@@ -633,9 +633,7 @@ class entitle_import(LDAPUpdate):
except M2Crypto.X509.X509Error:
raise errors.CertificateFormatError(error=_('Not an entitlement certificate'))
dn = DN(('ipaentitlementid', entry_attrs['ipaentitlementid']), dn)
- (dn, current_attrs) = ldap.get_entry(
- dn, ['*'], normalize=self.obj.normalize_dn
- )
+ (dn, current_attrs) = ldap.get_entry(dn, ['*'])
entry_attrs['usercertificate'] = current_attrs['usercertificate']
entry_attrs['usercertificate'].append(newcert)
except errors.NotFound:
diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index 7f9bbad7..11819890 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -330,9 +330,7 @@ class permission_mod(LDAPUpdate):
# check if permission is in LDAP
try:
- (dn, attrs) = ldap.get_entry(
- dn, attrs_list, normalize=self.obj.normalize_dn
- )
+ (dn, attrs) = ldap.get_entry(dn, attrs_list)
except errors.NotFound:
self.obj.handle_not_found(*keys)
@@ -347,7 +345,7 @@ class permission_mod(LDAPUpdate):
except (IndexError, KeyError), e:
raise ValueError("expected dn starting with 'cn=' but got '%s'" % dn)
new_dn[0].value = options['rename']
- (new_dn, attrs) = ldap.get_entry(new_dn, attrs_list, normalize=self.obj.normalize_dn)
+ (new_dn, attrs) = ldap.get_entry(new_dn, attrs_list)
raise errors.DuplicateEntry()
except errors.NotFound:
pass # permission may be renamed, continue
diff --git a/ipalib/plugins/sudorule.py b/ipalib/plugins/sudorule.py
index 8eea7732..0841457f 100644
--- a/ipalib/plugins/sudorule.py
+++ b/ipalib/plugins/sudorule.py
@@ -638,9 +638,7 @@ class sudorule_add_option(LDAPQuery):
self.obj.handle_not_found(cn)
attrs_list = self.obj.default_attributes
- (dn, entry_attrs) = ldap.get_entry(
- dn, attrs_list, normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
entry_attrs = entry_to_dict(entry_attrs, **options)
@@ -695,9 +693,7 @@ class sudorule_remove_option(LDAPQuery):
self.obj.handle_not_found(cn)
attrs_list = self.obj.default_attributes
- (dn, entry_attrs) = ldap.get_entry(
- dn, attrs_list, normalize=self.obj.normalize_dn
- )
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
entry_attrs = entry_to_dict(entry_attrs, **options)