OctaneLending / lpconnector

Python client for syncing LastPass Enterprise with a remote directory over LDAP
Apache License 2.0
15 stars 3 forks source link

No memberOf in kwargs causing TypeError #14

Open danielsmay opened 5 years ago

danielsmay commented 5 years ago

I'm trying to set up this connector with JumpCloud but even basic commands seem to be failing. I'm running it with Python2.7 on Ubuntu 16.04.

(venv) lpconnector@ubuntu:~/projects/lpconnector$ lpconnector ldapusers
Traceback (most recent call last):
  File "/home/lpconnector/projects/lpconnector/venv/bin/lpconnector", line 11, in <module>
    load_entry_point('lpconnector==0.9.0', 'console_scripts', 'lpconnector')()
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/__main__.py", line 6, in main
    lpconnector.main()
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/lpconnector.py", line 48, in main
    command.execute()
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/commands/ldapusers.py", line 23, in execute
    result = self.ldap_server.get_all_users()
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/ldap/server.py", line 42, in get_all_users
    return self.do_search(search_filter, LDAPUser.OBJECT_CLASS)
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/ldap/server.py", line 106, in do_search
    result_set.append(LDAPUser(**result_data[0][1]))
  File "/home/lpconnector/projects/lpconnector/venv/local/lib/python2.7/site-packages/lpconnector-0.9.0-py2.7.egg/lpconnector/ldap/objects.py", line 58, in __init__
    for group_dn in ldap_attr:
TypeError: 'NoneType' object is not iterable

It was failing when the attr was "memberOf" because "memberOf" didn't exist in the kwargs.

When I broke out before the for loop at line 58, things seemed to work as I might expect.

What would cause there not to be a "memberOf" in the kwargs?

jixson12 commented 5 years ago

Sorry for the delay, there would be no memberOf in kwargs if that LDAP user isn't part of any groups