[python-ldap] Adding msgid to LDAPError

Stephen J. Butler stephen.butler at gmail.com
Sat Sep 12 12:09:55 CEST 2015


On Sat, Sep 12, 2015 at 4:51 AM, Michael Ströder <michael at stroeder.com>
wrote:

> But just a quick question: Why not attach the msgid to also LDAPError
> instances caused by write operations? Note that LDAP allows pipe-lining of
> requests. You can send several write operations and deal with the result
> code
> later. Your patch would be handy for those situations either.
>

Should work there too. It doesn't make sense to attach msgid inside stuff
like l_ldap_add_ext() because if it fails at that point there's no valid
msgid to track. So I did it all in l_ldap_result4(), which should be
generic enough to track any type of request, read or write.


> While you're at it you could also attach the response controls (plural!)
> returned by the server in the LDAPResult messages to the LDAPError
> instance.
>
> This would e.g. solve the case of a simple bind failing because of an
> expired
> password. Up to now the response control saying "password expired" cannot
> be
> extracted.
> Also OpenLDAP's experimental "What failed?" control would require this for
> determining what went wrong when using slapo-constraint, slapo-unique...
>

That's an interesting thought. Certainly useful, but I might want to rework
the patch into an LDAPerror and LDAPerrorExt so that we're constantly
specifying parameters that aren't used. Or is the project OK with default
parameters in the header file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20150912/c6d85cec/attachment.html>


More information about the python-ldap mailing list