Subtle changes in error handling with OpenLDAP 2 (was: compiling against OpenLDAP 2.0.11)

Michael Ströder michael at stroeder.com
Wed Jul 11 13:26:07 CEST 2001


Michael Ströder wrote:
> 
> Konstantin Chuguev wrote:
> >
> > Yes, OpenLDAP-2.0.11 and especially recent changes in python-ldap CVS
> > repository require a new version of patches. I've attached them.
> 
> I tried these patches. They seem to work

I noticed another subtle change in the OpenLDAP 2 behaviour: When
adding an attribute to an entry which is unknown to the server
(schema violation) there's just the base expection class
ldap.LDAPError returned containing message ("Undefined attribute
type..."). This makes it impossible to specifically catch e.g.
ldap.OBJECT_CLASS_VIOLATION.
(web2ldap makes extensive use of catching
ldap.OBJECT_CLASS_VIOLATION, ldap.NAMING_VIOLATION and friends to
enable the user to re-edit the input etc.)

I experienced similar behaviour with exceptions raised in case of
referrals received. The ldap.LDAPError base class was raised with
OpenLDAP 2.0.x lib instead of e.g. ldap.PARTIAL_RESULTS raised in
case of OpenLDAP 1.2.x lib. I thought that in this special case it
has to do with the migration from LDAPv2+ pseudo referrals to real
LDAPv3 knowledge references. Not sure about this issue though.
(web2ldap 0.9.x already contains code to handle both cases but I'd
like to get rid of that bloat in the future.)

It seems that the whole exception-based error catching needs to be
tested thoroughly because there are probably other subtle changes in
the OpenLDAP 2 libs as well.

Ciao, Michael.




More information about the python-ldap mailing list