Skip to content
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

exceptions from parent ldap module #10

Open
rasathus opened this issue May 11, 2016 · 0 comments
Open

exceptions from parent ldap module #10

rasathus opened this issue May 11, 2016 · 0 comments

Comments

@rasathus
Copy link

I've run into a number of occasions where the exceptions raised are actually from the ldap module, and not from simpleldap

Traceback (most recent call last):
  File "ldap_experiments.py", line 53, in <module>
    conn = simpleldap.Connection(hostname=LDAP_SERVER, dn=QUERY_USERNAME, password=QUERY_PASS)
  File "/usr/local/lib/python2.7/site-packages/simpleldap/__init__.py", line 175, in __init__
    self.connection.simple_bind_s(dn, password)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 222, in simple_bind_s
    msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 216, in simple_bind
    return self._ldap_call(self._l.simple_bind,who,cred,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls))
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 106, in _ldap_call
    result = func(*args,**kwargs)
ldap.SERVER_DOWN: {'desc': "Can't contact LDAP server"}
Traceback (most recent call last):
  File "ldap_experiments.py", line 53, in <module>
    user = conn.get("sAMAccountName=chrisf")
  File "/usr/local/lib/python2.7/site-packages/simpleldap/__init__.py", line 247, in get
    results = self.search(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/simpleldap/__init__.py", line 236, in search
    base_dn, scope, filter, attrs, timeout=timeout, sizelimit=limit)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 591, in search_ext_s
    return self.result(msgid,all=1,timeout=timeout)[1]
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 503, in result
    resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 507, in result2
    resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 514, in result3
    resp_ctrl_classes=resp_ctrl_classes
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 521, in result4
    ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
  File "/usr/local/lib/python2.7/site-packages/ldap/ldapobject.py", line 106, in _ldap_call
    result = func(*args,**kwargs)
ldap.NO_SUCH_OBJECT: {'info': "0000208D: NameErr: DSID-031001E5, problem 2001 (NO_OBJECT), data 0, best match of:\n\t''\n", 'desc': 'No such object'}

etc.

Is this intended behaviour ? Obviously it then means I need to understand the underlaying ldap library and any exceptions that it might through, if simpleldap isn't going to catch and simplify them. I could make a pull request, but its going to significantly affect the behaviour, and anyone currently using it.

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

1 participant