Possible bug results in 'Encoding Error' on Tru64 5.1A..

Michael Ströder michael at stroeder.com
Tue Jul 13 08:40:03 CEST 2004


Mike D'Errico wrote:
> 
> I've currently run into a problem on our Tru64 5.1A machines when I
> try to do a simple_bind_s() to any ldap server.
 > [..]
> opened ok.
> {'desc': 'Encoding error'}

Hmm...

> To debug the problem, I added some debugging code (a few print
> statements) to the ldapobject.py code.

You know about argument trace_level?

     oldap = ldap.initialize("ldap://some_valid_host",trace_level=2)

> Then to get even further
> information I added some debugging code to the LDAPObject.c code and
> suddently the binding works ?
 > [..]
> I've added 3 print statements in all. The odd thing is that when I remove
> any one of these print statements or if I make any modifications to these
> statements (ie. try not to print out the 'who' param), the operation
> fails.
> [..]
> I suspect there is a pointer or array reference that is out of bound and
> that is clobbering another variable's space but haven't found where in the
> code exactly. Another possibility is that there is a problem somewhere
> with the fact that Tru64 is 64bit and that either python / python-ldap /
> openldap is not behaving correctly using 64 bit addresses.

Unfortunately I'm not a C programmer at all. Therefore please try to dig 
into this issue.

> - openldap-2.2.14 (tried on 2.1.23 also)

I found in CHANGES of OpenLDAP 2.2.15 Engineering (currently only available 
as branch OPENLDAP_REL_ENG_2_2 in OpenLDAP's CVS):

         Fixed libldap sasl_encode 64-bit bug (ITS#3054,3212)

I don't have a clue whether that's really related to this issue here though. 
It could be since LDAPObject.simple_bind() directly wraps ldap_sasl_bind().

This was changed in python-ldap 2.0.0pre21. Prior versions wrapped 
ldap_simple_bind() which in turn calls ldap_sasl_bind().

Could you please try to submit a LDAP search request right after invoking 
ldap.initialize() to determine if LDAPObject.simple_bind() is the only 
problem or if the issue is a more general one?

try:
   oldap = ldap.initialize("ldap://some_valid_host",trace_level=2)
   print "inititalized ok."
   # Read rootDSE
   r = oldap.search_s("",ldap.SCOPE_BASE,'(objectClass=*)')
except ldap.LDAPError, error:
   print error
else:
   print r

With tracing enabled it looks like this in the Python interpreter.

 >>> import ldap
 >>> oldap = ldap.initialize("ldap://localhost:1390",trace_level=2)
*** ldap://localhost:1390 - SimpleLDAPObject.set_option ((17, 3),{})
 >>> r = oldap.search_s("",ldap.SCOPE_BASE,'(objectClass=*)')
*** ldap://localhost:1390 - SimpleLDAPObject.search_ext (('', 0, 
'(objectClass=*)', None, 0, None, None, -1, 0),{})
=> result: 1
*** ldap://localhost:1390 - SimpleLDAPObject.result2 ((1, 1, -1),{})
=> result: (101, [('', {'objectClass': ['top', 'OpenLDAProotDSE']})], 1)
 >>>

Ciao, Michael.



More information about the python-ldap mailing list