Code Monkey home page Code Monkey logo

Comments (6)

GrayAn avatar GrayAn commented on May 20, 2024

Thanks, @donalm ! What LDAP server were you using when trying the quick start example?

It looks like I have broken LDAPSearchResultReference while porting the code for Python 3. It was not fully implemented before but certainly did not raise exceptions.

from ldaptor.

donalm avatar donalm commented on May 20, 2024

ActiveDirectory is providing our LDAP service. Thanks for looking at this @GrayAn

from ldaptor.

donalm avatar donalm commented on May 20, 2024

Also (maybe): ldaptor/protocols/pureldap.py :

1503c1503
<     oid = b'1.3.6.1.4.1.1466.20037'
---
>     oid = '1.3.6.1.4.1.1466.20037'
1528c1528
<     oid = b'1.3.6.1.4.1.1466.20037'
---
>     oid = '1.3.6.1.4.1.1466.20037'

Sorry to just dump this diff in here and run. I'll do some isolation testing with this and update the ticket.

UPDATE: I'm seeing this problem only in my Python 3 environment. When I add client.startTLS() after the connect call:

client = yield c.connect(basedn, overrides=overrides)
client.startTLS()

I get this ldaptor.protocols.ldap.ldapclient.LDAPStartTLSInvalidResponseName exception:

/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/python/reflect.py:448: DeprecationWarning: LDAPStartTLSInvalidResponseName.__str__ method is deprecated and will not be used for getting bytes representation in the future releases, use LDAPStartTLSInvalidResponseName.toWire instead
  return str(o)
/opt/pipeline/python3/lib/python3.6/traceback.py:151: DeprecationWarning: LDAPStartTLSInvalidResponseName.__str__ method is deprecated and will not be used for getting bytes representation in the future releases, use LDAPStartTLSInvalidResponseName.toWire instead
  return str(value)
[Failure instance: Traceback: <class 'ldaptor.protocols.ldap.ldapclient.LDAPStartTLSInvalidResponseName'>: <LDAPStartTLSInvalidResponseName instance at 0x7fb844bc6a68 with str error:
 Traceback (most recent call last):
  File "/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/mnt/software/dev/dmcmullan/ldap_test/bin/py/minimal3.py", line 16, in example
    client = yield client.startTLS()
  File "/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/scratch/geek/ldaptor/ldaptor/protocols/ldap/ldapclient.py", line 256, in _cbStartTLS
    raise LDAPStartTLSInvalidResponseName(msg.responseName)
ldaptor.protocols.ldap.ldapclient.LDAPStartTLSInvalidResponseName: <unprintable LDAPStartTLSInvalidResponseName object>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/python/reflect.py", line 448, in safe_str
    return str(o)
TypeError: __str__ returned non-string (type bytes)
>
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:460:callback
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:654:_runCallbacks
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:1475:gotResult
--- <exception caught here> ---
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:1416:_inlineCallbacks
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/python/failure.py:491:throwExceptionIntoGenerator
/mnt/software/dev/dmcmullan/ldap_test/bin/py/minimal3.py:16:example
/mnt/software/dev/dmcmullan/ldap_test/bin/v3/lib/python3.6/site-packages/twisted/internet/defer.py:654:_runCallbacks
/scratch/geek/ldaptor/ldaptor/protocols/ldap/ldapclient.py:256:_cbStartTLS
]

The code works fine in Python 2. The diff I pasted above suppresses the error in Python 3.

Thanks again @GrayAn

from ldaptor.

cwaldbieser avatar cwaldbieser commented on May 20, 2024

@donalm - If I want to test a patch for the SearchResultReference issue, I have access to an AD environment, but I don't really know much about administering it. Is there some kind of explicit reference I can create in the directory that I can query for testing?

from ldaptor.

donalm avatar donalm commented on May 20, 2024

I hope you won't need to jump through too many hoops - the filterText that I'm using is just:
([email protected])
...to return the directory info for one user.

(I also don't administer the AD instance - I just query it).

from ldaptor.

GrayAn avatar GrayAn commented on May 20, 2024

@donalm Maybe you can try to test the latest changes against your AD instance? You can use this branch for it: startTLS, LDAPSearchResultReference and exception issues were fixed in it.

from ldaptor.

Related Issues (20)

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.