Git Product home page Git Product logo

python-simpleldap's People

Contributors

gdub avatar rdrake avatar rtprio avatar wcooley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-simpleldap's Issues

import issue

[root@reports-hammer-local tests]# pip install simpleldap
Requirement already satisfied (use --upgrade to upgrade): simpleldap in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): python-ldap in /usr/local/lib/python2.7/site-packages (from simpleldap)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg (from python-ldap->simpleldap)
Cleaning up...
[root@reports-hammer-local tests]# python tests.py
Traceback (most recent call last):
File "tests.py", line 7, in
import simpleldap
ImportError: No module named simpleldap

I'm not sure how to fix this. Help?

SimpleLDAPObject has no attribute '_l'

I'm periodically getting this error from my Python script, mostly when I'm trying to unbind the LDAP connection:

ldap_connection.unbind()

Any suggestions on why this is happening and what I need to do to fix it?

Python3 compatibility

Hi,

would it be feasible to include Python3 compatibility (through 2to3 at least).
Installing via pip breaks in Py3:
print name + ': ' + cfg.get('_ldap', name)

         ^

SyntaxError: invalid syntax

Connected successfully or not?

It's not clear to me whether this is a bug or I'm doing something wrong. I'm able to make a connection, but then any attempt to use that connection says I'm not connected:

with simpleldap.Connection('directory.example.com') as conn:
    is_valid = conn.authenticate('uid=myuser,dc=directory,dc=example,dc=com', 'password')

(with my own substitutions of course) I get :

>>> is_valid
True

but then:

conn.search("(&(givenName=Joe))")

returns

ldap.LDAPError: LDAP connection invalid

exceptions from parent ldap module

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.

ldap.NO_SUCH_OBJECT AttributeError

Hi,

I'm trying to use simpleldap as installed from pip (version 0.8) and trying to issue a very simple connection:

self.conn = simpleldap.Connection(hostname=self.hostname, dn=self.dn, password=self.password, encryption=self.encryption, require_cert=False)

but I'm getting the following error:

Traceback (most recent call last):
  File "ldap.py", line 3, in <module>
    import logging, yaml, simpleldap
  File "/usr/local/lib/python2.7/dist-packages/simpleldap/__init__.py", line 93, in <module>
    class Connection(object):
  File "/usr/local/lib/python2.7/dist-packages/simpleldap/__init__.py", line 105, in Connection
    ldap.NO_SUCH_OBJECT,  # e.g. dn matches no objects.
AttributeError: 'module' object has no attribute 'NO_SUCH_OBJECT'

Am I missing something?

Thanks!

ability to deal with paginated results for LDAP servers

Most LDAP servers do have server side limits regarding the number of entries they do return to the clients, and this limits cannot be changed by the client (it's not the client specified limit).

A couple of years a ago I wrote a similar library that was on top of python-ldap, that was hiding all the complexity of working with paginated results and I would like to make it public.

Imagine that in my case I do have to work with an a tree of LDAP/AD servers that do return ~14.000 users and ~20.000 groups, and the server side limit is 1000. It would be impossible to work without pagination.

Now, my question is if I should add yet-another-ldap-pypi package or I should add my features to an existing one, like this one. Ideally I would like to bring my changes to python-ldap itself but I guess that's much harder.

What do you think about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.