Skip to content

result4() mistreats operations with add_ctrls=True #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tiran opened this issue Jan 3, 2018 · 2 comments
Closed

result4() mistreats operations with add_ctrls=True #149

tiran opened this issue Jan 3, 2018 · 2 comments

Comments

@tiran
Copy link
Member

tiran commented Jan 3, 2018

For operations with add_ctrls=True, l_ldap_result4 mishandles resp_data.

  • l_ldap_result4() calls LDAPmessage_to_python() to create pmsg
  • LDAPmessage_to_python() calls LDAPControls_to_List() to convert server controls to a Python list.
  • LDAPControls_to_List() returns a tuple of (oid: str, critical: bool, ber: bytes).
  • The Python implementation of result4 uses _bytesify_results(resp_data, with_ctrls=add_ctrls) to convert results. For add_ctrls it use bytesify_result_value to convert resp_data.
  • bytesify_result_value wrongly assumes that a List[Tuple[str, bool, bytes]] is a list of referrals when it's in fact a triple of control values.

Original reported as #147 (comment)

@tiran
Copy link
Member Author

tiran commented Jan 4, 2018

I cannot reproduce the issue and I'm starting to think that my analysis is wrong, too. The pmsg object is a list of two or three elements. The first element is dn (always unicode). The second is a dict of unicode keys. The third element is the control list List[Tuple[str, bool, bytes]].

#147 (comment) may be caused by an old version of pyldap. I don't see how the error could ever occur with more recent versions of python-ldap. On the other hand the bytesification code is complicated and partly hard to understand.

@encukou
Copy link
Member

encukou commented Sep 20, 2019

The only actionable issue I can see here is clean up the bytesification code. I don't think that needs to be tracked here.

@encukou encukou closed this as completed Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants