jirutka/ssh-ldap-pubkey

Installing python-ldap first causes mismatch between wrapper script and lib

n2taylor opened this issue · 1 comments

If you install the python-ldap library globally with pip before installing ssh-ldap-pubkey, the ssh-ldap-pubkey-wrapper script will import the python-ldap module at the top level, but it will attempt to use the version installed by pyldap. This leads to errors when the two libraries drift.

We experienced an issue the other day due to the mismatch in an __init__ function between python-ldap (2.5.2) and pyldap (2.4.45):

$ /usr/local/bin/ssh-ldap-pubkey-wrapper test.user
Traceback (most recent call last):
  File "/usr/local/bin/ssh-ldap-pubkey", line 144, in <module>
    main(**kwargs)
  File "/usr/local/bin/ssh-ldap-pubkey", line 108, in main
    ldapssh.connect()
  File "/usr/local/lib/python2.7/dist-packages/ssh_ldap_pubkey/__init__.py", line 101, in connect
    self._conn = conn = ldap.initialize(' '.join(conf.uris))
  File "/usr/local/lib/python2.7/dist-packages/ldap/functions.py", line 94, in initialize
    return LDAPObject(uri,trace_level,trace_file,trace_stack_limit,bytes_mode)
TypeError: __init__() takes at most 5 arguments (6 given)

I'm not sure what the correct fix is here, just passing it along.

@n2taylor newer pyldap just brings in python-ldap-3 directly, and doesn't leave anything else behind to drift.