Skip to content

Some default arguments are not compatible with bytes_mode=True #147

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
17 tasks done
tiran opened this issue Dec 21, 2017 · 5 comments
Closed
17 tasks done

Some default arguments are not compatible with bytes_mode=True #147

tiran opened this issue Dec 21, 2017 · 5 comments

Comments

@tiran
Copy link
Member

tiran commented Dec 21, 2017

With bytes_mode=True, all arguments must be bytes. However some functions have default keyword arguments of type str (unicode). One example is search_ext(..., filterstr='(objectClass=*), ...').

function signature

  • simple_bind(self,who='',cred='',serverctrls=None,clientctrls=None)
  • simple_bind_s(self,who='',cred='',serverctrls=None,clientctrls=None)
  • search_ext(self,base,scope,filterstr='(objectClass=*)', ...)
  • search_ext_s(self,base,scope,filterstr='(objectClass=*)', ...)
  • search(self,base,scope,filterstr='(objectClass=*)', ...)
  • search_s(self,base,scope,filterstr='(objectClass=*)', ...)
  • search_st(self,base,scope,filterstr='(objectClass=*)', ...)
  • search_subschemasubentry_s(self,dn='')
  • find_unique_entry(self,base,scope=ldap.SCOPE_SUBTREE,filterstr='(objectClass=*)', ...)
  • read_rootdse_s(self, filterstr='(objectClass=*)', attrlist=None)

function body

  • search_subschemasubentry_s
  • read_subschemasubentry_s
  • find_unique_entry
  • read_rootdse_s
  • get_naming_contexts
  • ReconnectLDAPObject._apply_last_bind

After fixing this

  • Remove filterstr workaround in Tests/t_ldap_syncrepl.py
@anazmy
Copy link

anazmy commented Dec 31, 2017

Could this be related ?

Dec 31 05:46:28 server systemd: Starting IPA key daemon...
Dec 31 05:46:29 server ipa-dnskeysyncd: ipa         : INFO     LDAP bind...
Dec 31 05:46:29 server ipa-dnskeysyncd: ipa         : INFO     Commencing sync process
Dec 31 05:46:29 server ipa-dnskeysyncd: Traceback (most recent call last):
Dec 31 05:46:29 server ipa-dnskeysyncd: File "/usr/libexec/ipa/ipa-dnskeysyncd", line 114, in <module>
Dec 31 05:46:29 server ipa-dnskeysyncd: while ldap_connection.syncrepl_poll(all=1, msgid=ldap_search):
Dec 31 05:46:29 server ipa-dnskeysyncd: File "/usr/lib64/python2.7/site-packages/ldap/syncrepl.py", line 355, in syncrepl_poll
Dec 31 05:46:29 server ipa-dnskeysyncd: add_intermediates=1, add_ctrls=1, all = 0
Dec 31 05:46:29 server ipa-dnskeysyncd: File "/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 735, in result4
Dec 31 05:46:29 server ipa-dnskeysyncd: resp_data = self._bytesify_results(resp_data, with_ctrls=add_ctrls)
Dec 31 05:46:29 server ipa-dnskeysyncd: File "/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 260, in _bytesify_results
Dec 31 05:46:29 server ipa-dnskeysyncd: for (dn, fields, ctrls) in results
Dec 31 05:46:29 server ipa-dnskeysyncd: File "/usr/lib64/python2.7/site-packages/ldap/ldapobject.py", line 218, in _maybe_rebytesify_text
Dec 31 05:46:29 server ipa-dnskeysyncd: assert isinstance(value, text_type), "Should return text, got bytes instead (%r)" % (value,)
Dec 31 05:46:29 server ipa-dnskeysyncd: AssertionError: Should return text, got bytes instead ('1.3.6.1.4.1.4203.1.9.1.4')
Dec 31 05:46:29 server systemd: ipa-dnskeysyncd.service: main process exited, code=exited, status=1/FAILURE
Dec 31 05:46:29 server systemd: Unit ipa-dnskeysyncd.service entered failed state.

@tiran
Copy link
Member Author

tiran commented Jan 4, 2018

@anazmy I cannot reproduce your traceback. Which version of FreeIPA and python-ldap / pyldap are you using?

@encukou
Copy link
Member

encukou commented Jan 5, 2018

This will hold 3.0 back :(

@encukou encukou added this to the 3.0 milestone Jan 5, 2018
tiran added a commit to tiran/python-ldap that referenced this issue Jan 5, 2018
Tests marked with expected failure are currently affected by bug python-ldap#147.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Jan 5, 2018
Several default arguments are not compatible with bytes mode. Default to
bytes in bytes mode.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran mentioned this issue Jan 5, 2018
tiran added a commit to tiran/python-ldap that referenced this issue Jan 5, 2018
Tests marked with expected failure are currently affected by bug python-ldap#147.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Jan 5, 2018
Several default arguments are not compatible with bytes mode. Default to
bytes in bytes mode.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
encukou pushed a commit to tiran/python-ldap that referenced this issue Jan 10, 2018
Tests marked with expected failure are currently affected by bug python-ldap#147.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
encukou pushed a commit to tiran/python-ldap that referenced this issue Jan 10, 2018
Several default arguments are not compatible with bytes mode. Default to
bytes in bytes mode.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@encukou
Copy link
Member

encukou commented Jan 10, 2018

Should be fixed in #152

@encukou encukou closed this as completed Jan 10, 2018
@encukou encukou reopened this Jan 10, 2018
@encukou
Copy link
Member

encukou commented Jan 10, 2018

... but not everything on the checklist is fixed

@encukou encukou modified the milestones: 3.0, 3.1 Jan 10, 2018
tiran added a commit to tiran/python-ldap that referenced this issue Jan 10, 2018
sasl_bind_s() has accepted None for who and cred for a long time. Now
simple_bind() and simple_bind_s() default to and accept None, too.

See: python-ldap#147

Signed-off-by: Christian Heimes <cheimes@redhat.com>
tiran added a commit to tiran/python-ldap that referenced this issue Jan 10, 2018
Closes: python-ldap#147
Signed-off-by: Christian Heimes <cheimes@redhat.com>
encukou pushed a commit that referenced this issue Jan 16, 2018
#159
Closes: #147
Signed-off-by: Christian Heimes <cheimes@redhat.com>
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

3 participants