akkornel / syncrepl

Python LDAP Syncrepl client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing scope in LDAP URL confuses upstream code

akkornel opened this issue · comments

When we provide an LDAP URL that doesn't include a scope, we get a weird error from inside the LDAP code.

blargh:~ akkornel(p)$ ~/Library/Python/3.6/bin/syncrepl-client --nodir --persist 'ldaps://ldap-uatmaster.stanford.edu:636/cn=people,dc=stanford,dc=edu?suRegID,uid,suPrivilegeGroup??(&(uid=*)(suPrivilegeGroup=research-computing:*))?bindname=GSSAPI' zkarl
Data files will be stored here: zkarl
Refresh-and-persist mode will be used
CLIENT SETUP START
BIND COMPLETE!
	WE ARE: dn:uid=akkornel,cn=accounts,dc=stanford,dc=edu
Traceback (most recent call last):
  File "/Users/akkornel/Library/Python/3.6/bin/syncrepl-client", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/Users/akkornel/git/syncrepl/syncrepl-client", line 117, in <module>
    else 0
  File "/Users/akkornel/git/syncrepl/syncrepl_client/__init__.py", line 425, in __init__
    attrlist=ldap_url.attrs
  File "/Users/akkornel/Library/Python/3.6/lib/python/site-packages/ldap/syncrepl.py", line 340, in syncrepl_search
    return self.search_ext(base, scope, **search_args)
  File "/Users/akkornel/Library/Python/3.6/lib/python/site-packages/ldap/ldapobject.py", line 791, in search_ext
    timeout,sizelimit,
  File "/Users/akkornel/Library/Python/3.6/lib/python/site-packages/ldap/ldapobject.py", line 294, in _ldap_call
    result = func(*args,**kwargs)
TypeError: an integer is required (got type NoneType)

Besides dealing with it, we should throw if the scope is missing from the LDAP URL.