mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-12 16:32:01 -05:00
Add option to not normalize a DN when adding/updating a record.
The KDC ldap plugin is very picky about the format of DNs. It does not allow spacing between elements so we can't normalize it.
This commit is contained in:
1 parent
0d70c68395
commit
aa7792a000
1 file changed
+6
-4
@@ -330,9 +330,10 @@ class ldap2(CrudBackend, Encoder):
|
||||
del entry_attrs[k]
|
||||
|
||||
@encode_args(1, 2)
|
||||
def add_entry(self, dn, entry_attrs):
|
||||
def add_entry(self, dn, entry_attrs, normalize=True):
|
||||
"""Create a new entry."""
|
||||
dn = self.normalize_dn(dn)
|
||||
if normalize:
|
||||
dn = self.normalize_dn(dn)
|
||||
# remove all None values, python-ldap hates'em
|
||||
entry_attrs = dict(
|
||||
(k, v) for (k, v) in entry_attrs.iteritems() if v is not None
|
||||
@@ -602,9 +603,10 @@ class ldap2(CrudBackend, Encoder):
|
||||
_handle_errors(e, **{})
|
||||
|
||||
@encode_args(1)
|
||||
def delete_entry(self, dn):
|
||||
def delete_entry(self, dn, normalize=True):
|
||||
"""Delete entry."""
|
||||
dn = self.normalize_dn(dn)
|
||||
if normalize:
|
||||
dn = self.normalize_dn(dn)
|
||||
try:
|
||||
self.conn.delete_s(dn)
|
||||
except _ldap.LDAPError, e:
|
||||
|
||||
Reference in new issue
Block a user