Wengex / PyADLdap

Python frameWork to managing Microsoft Active Directory Objects from LDAP
GNU General Public License v2.0
3 stars 1 forks source link

Error #1

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello. My script

from pyadldap.adldap import adLDAP
dataConnection = {
"dcs" : ["ugr-dc.yass.ru"],
"username" : "svc@yass.ru",
"password" : "gFD7dghfghf"
}

ad = adLDAP(**dataConnection)

Error

  File "ad_block_user.py", line 8, in <module>
    ad = adLDAP(**dataConnection)
  File "/usr/local/lib/python2.7/dist-packages/pyadldap/adldap.py", line 49, in __init__
    if not self.connect():
  File "/usr/local/lib/python2.7/dist-packages/pyadldap/adldap.py", line 91, in connect
    self.ldapConnection = ldap.initialize(self.getController())
  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)
  File "/usr/local/lib/python2.7/dist-packages/ldap/ldapobject.py", line 79, in __init__
    self._l = ldap.functions._ldap_function_call(ldap._ldap_module_lock,_ldap.initialize,uri)
  File "/usr/local/lib/python2.7/dist-packages/ldap/functions.py", line 66, in _ldap_function_call
    result = func(*args,**kwargs)
ldap.LDAPError: (2, 'No such file or directory')
Exception AttributeError: "'adLDAP' object has no attribute 'ldapConnection'" in <bound method adLDAP.__del__ of <pyadldap.adldap.adLDAP object at 0x7fca8b46dd10>> ignored
pushkarev@pushkarev-notebook:~/python_lessons$ nano ad_block_user.py

python-ldap installed OS Ubuntu 14.04 python 2.7

Yohnah commented 7 years ago

I just saw where the error is provocated. It is a documentation mistake, sorry.

Domain controllers must be written with URI format (ldap://fqdn/ or ldaps://fqdn/)

Example:

dataConnection = {
    "dcs" : ["ldap://ugr-dc.yass.ru/"],
    "username" : "svc@yass.ru",
    "password" : "gFD7dghfghf"
}

or, If you are using SSL over LDAP

dataConnection = {
    "dcs" : ["ldap://ugr-dc.yass.ru/"],
    "username" : "svc@yass.ru",
    "password" : "gFD7dghfghf"
}

Later I will correct the documentation.

Thank you for advising me about that.

ghost commented 7 years ago

Thank you!