From: Mike D'E. <mi...@Ne...> - 2004-07-12 19:06:43
|
Hello, 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. Sample code: ... try: oldap = ldap.initialize("ldap://some_valid_host") print "inititalized ok." oldap.simple_bind_s("cn=manager,ou=someunit,dc=some_valid_host","secret") print "things are good." except ldap.LDAPError, error: print error sys.exit(1) ... this generates the following output: opened ok. {'desc': 'Encoding error'} To debug the problem, I added some debugging code (a few print statements) to the ldapobject.py code. Then to get even further information I added some debugging code to the LDAPObject.c code and suddently the binding works ? Output: ------- F:'<built-in method set_option of LDAP object at 0x1400a0080>' A:'(17, 3)' K:'{}' opened ok. F:'<built-in method simple_bind of LDAP object at 0x1400a0080>' A:'('cn=manager,ou=someunit,dc=some_valid_host', 'secret', None, None)' K:'{}' line 425 - C PROG - PRE-BIND Obj:'1075979520' who:'cn=manager,ou=someunit,dc=some_valid_host' msgid:'0' line 431 - C PROG - POST-BIND Obj:'1075979520' who:'cn=manager,ou=someunit,dc=some_valid_host' msgid:'1' ERROR:'Success' F:'<built-in method result2 of LDAP object at 0x1400a0080>' A:'(1, 1, -1)' K:'{}' bound ok. 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. Here's further information about my current environment: - python 2.3.4 - openldap-2.2.14 (tried on 2.1.23 also) - unix cc compiler (although I tried with gcc 3.0.4 also) - python-ldap 2.0.1 - OSF1 V5.1 1885 alpha Here are the diffs of my modifications to the python-ldap modules: --- python-ldap-2.0.1/Modules/LDAPObject.c.original 2004-07-12 15:01:38.000000000 -0400 +++ python-ldap-2.0.1/Modules/LDAPObject.c 2004-07-12 15:01:38.000000000 -0400 @@ -416,15 +416,18 @@ PyObject *clientctrls = Py_None; struct berval cred; if (!PyArg_ParseTuple( args, "ss#|OO", &who, &cred.bv_val, &cred.bv_len, &serverctrls, &clientctrls )) return NULL; if (not_valid(self)) return NULL; + printf("line 425 - C PROG - PRE-BIND Obj:'%d' who:'%s' msgid:'%d'\n",self->ldap,who,msgid); + LDAP_BEGIN_ALLOW_THREADS( self ); ldaperror = ldap_sasl_bind( self->ldap, who, LDAP_SASL_SIMPLE, &cred, NULL, NULL, &msgid); LDAP_END_ALLOW_THREADS( self ); + printf("line 431 - C PROG - POST-BIND Obj:'%d' who:'%s' msgid:'%d' ERROR:'%s'\n",self->ldap,who,msgid,ldap_err2string(ldaperror)); + if ( ldaperror!=LDAP_SUCCESS ) return LDAPerror( self->ldap, "ldap_simple_bind" ); --- python-ldap-2.0.1/build/lib.osf1-V5.1-alpha-2.3/ldap/ldapobject.py.original2004-07-12 15:03:07.000000000 -0400 +++ python-ldap-2.0.1/build/lib.osf1-V5.1-alpha-2.3/ldap/ldapobject.py 2004-07-12 15:04:30.000000000 -0400 @@ -91,6 +91,7 @@ self._ldap_object_lock.acquire() try: try: + print "F:'%s' A:'%s' K:'%s'"%(func,args,kwargs) result = func(*args,**kwargs) finally: self._ldap_object_lock.release() Any help in resolving this issue would be greatly appreciated, Thank you, ------------------------------------------------------------------------- Michel D'Errico System Programmer / Analyst IITS, System Software Unix Group, Concordia University ------------------------------------------------------------------------- |