[python-ldap] dirSync control, no Cookie
Michael Ströder
michael at stroeder.com
Mon Oct 10 09:57:50 EDT 2022
On 10/10/22 13:18, Ondřej Kuzník wrote:
> On Mon, Oct 10, 2022 at 12:37:47PM +1000, William Brown via python-ldap wrote:
>> But that alone isn't everything. I can see in my testing that the
>> response controls aren't being decoded. I think in this case because
>> while you are passing in a correctly encoded control to the server,
>> there is no way for the library to decode the dirsync control.
>
> Ah, good catch, maybe we should also let the user choose to accept
> controls that we can't interpret (as a generic ResponseControl), rather
> than dropping them altogether.
First of all the complete response data received at lower protocol level
can always be observed by setting trace_level=2 when invoking
ldap.initialize() or LDAPObject() no matter whether the response control
value could be decoded.
In general the control type registry dict KNOWN_RESPONSE_CONTROLS was
never meant to be immutable. Every code part can and should register
custom response control classes therein the same like all ldap.controls
sub-modules are doing it.
Additionally LDAPObject.result4() accepts an optional key-word argument
resp_ctrl_classes which can be used to fully override
KNOWN_RESPONSE_CONTROLS in case one only wants to decode a certain
subset of acceptable response controls.
One could of course register class ResponseControl with any control type
to get access to the control value bytes. This only makes sense for
debugging purpose though.
Ciao, Michael.
More information about the python-ldap
mailing list