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

KeyError upon LDAPConnection instantiation #26

Open
Synforge opened this issue Jan 12, 2014 · 1 comment
Open

KeyError upon LDAPConnection instantiation #26

Synforge opened this issue Jan 12, 2014 · 1 comment

Comments

@Synforge
Copy link

When connecting to an LDAP server on a remote CentOS machine I receive the following error:

>>> import ldapom
>>> c = ldapom.LDAPConnection(uri='ldap://auth-1.example.io', base='dc=example,dc=io', bind_dn='cn=Manager,dc=example,dc=io', bind_password='password')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/dist-packages/ldapom/connection.py", line 110, in __init__
    self._connect()
  File "/usr/local/lib/python3.3/dist-packages/ldapom/connection.py", line 145, in _connect
    self._fetch_attribute_types()
  File "/usr/local/lib/python3.3/dist-packages/ldapom/connection.py", line 158, in _fetch_attribute_types
    attribute_type_definitions)
  File "/usr/local/lib/python3.3/dist-packages/ldapom/attribute.py", line 246, in build_attribute_types
    type_mixin = ATTRIBUTE_SYNTAX_TO_TYPE_MIXIN[type_dict["syntax"]]
KeyError: 'syntax'
@leonhandreke
Copy link
Member

Thank you for your bug report. It looks like one of the attributes on your LDAP server doesn't have a defined SYNTAX. To better debug the issue, could you insert the line print('\n'.join(list(attribute_type_definitions))) into ldapom/connection.py at line 156 and try to instantiate the connection again?

   attribute_type_definitions = map(compat._decode_utf8,
             result[0][1][compat._encode_utf8("attributeTypes")])

 + print('\n'.join(list(attribute_type_definitions)))
 +
   self._attribute_types_by_name = attribute.build_attribute_types(
             attribute_type_definitions)

It should print a list of attribute types that it retrieved from the server. You can post the output here or send it to my personal email ([email protected]). Thanks!

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

2 participants