mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
add context to exception on LdapEntry decode error
When reading the content of an invalid LDAP entry, the exception only displays the attribute name and value, but not the DN of the entry. Because of this, it is difficult to identify the root cause of the problem. The fix raises a ValueError exception which also contains the entry DN. https://fedorahosted.org/freeipa/ticket/5434 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
parent
aa734da494
commit
53524fbbff
@ -308,7 +308,11 @@ class LDAPEntry(collections.MutableMapping):
|
||||
raw.remove(value)
|
||||
|
||||
for value in raw_dels:
|
||||
value = self._conn.decode(value, name)
|
||||
try:
|
||||
value = self._conn.decode(value, name)
|
||||
except ValueError as e:
|
||||
raise ValueError("{error} in LDAP entry '{dn}'".format(
|
||||
error=e, dn=self._dn))
|
||||
if value in nice_adds:
|
||||
continue
|
||||
nice.remove(value)
|
||||
@ -320,7 +324,11 @@ class LDAPEntry(collections.MutableMapping):
|
||||
raw.append(value)
|
||||
|
||||
for value in raw_adds:
|
||||
value = self._conn.decode(value, name)
|
||||
try:
|
||||
value = self._conn.decode(value, name)
|
||||
except ValueError as e:
|
||||
raise ValueError("{error} in LDAP entry '{dn}'".format(
|
||||
error=e, dn=self._dn))
|
||||
if value in nice_dels:
|
||||
continue
|
||||
nice.append(value)
|
||||
|
Loading…
Reference in New Issue
Block a user