Very strange problem with module ldapurl

Jens Vagelpohl jens at zope.com
Fri Sep 6 21:51:07 CEST 2002


i was stepping through the creation of l2 in the debugger, and to aid  
this i made the following change::

Index: ldapurl.py
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Lib/ldapurl.py,v
retrieving revision 1.26
diff -r1.26 ldapurl.py
229c229
<     extensions=LDAPUrlExtensions({}),
---
 >     extensions=None,
238c238
<     self.extensions=extensions
---
 >     self.extensions=extensions or LDAPUrlExtensions({})

i basically moved the creation of that LDAPUrlExtensions object from  
the argument list into the function itself. that solved the problem for  
me it seems. here is my output now::

l1 before creation of l2:
ldap://host1/????X- 
BINDPW=passwd1,dummyext1=dummyvalue1,bindname=cn=User1
l1 after creation of l2:
ldap://host1/????X- 
BINDPW=passwd1,dummyext1=dummyvalue1,bindname=cn=User1
l2 itself:
ldap://host2/????X- 
BINDPW=passwd2,dummyext2=dummyvalue2,bindname=cn=User2

hmmm.... :)

jens


On Friday, Sep 6, 2002, at 14:27 US/Eastern, Michael Ströder wrote:

> HI!
>
> I have a very strange problem with ldapurl (my own source, sigh!)  
> which can also be a security problem in case of passwords stored in  
> LDAPUrlExtension instances. It drives me crazy!
>
> See this simple source:
>
> ------------------------ snip ------------------------
> from ldapurl import LDAPUrl,LDAPUrlExtension
>
> l1=LDAPUrl()
> l1.hostport='host1'
> l1.who='cn=User1'
> l1.cred='passwd1'
> l1.extensions['dummyext1']=LDAPUrlExtension(
>   extype='dummyext1',exvalue='dummyvalue1'
> )
>
> print 'l1 before creation of l2:\n',str(l1)
>
> l2=LDAPUrl()
> l2.hostport='host2'
> l2.who='cn=User2'
> l2.cred='passwd2'
> l2.extensions['dummyext2']=LDAPUrlExtension(
>   extype='dummyext2',exvalue='dummyvalue2'
> )
>
> print 'l1 after creation of l2:\n',str(l1)
> print 'l2 itself:\n',str(l2)
> ------------------------ snip ------------------------
>
> In theory l1 and l2 should be completely independent LDAPUrl  
> instances. But it seems the LDAPUrl.extensions class attributes are  
> tied by some means.
>
> The problem is the output (with Python 2.2.1):
>
> $ python Tests/ldapurl_instance_error.py
> ldap://host1/ 
> ????dummyext2=dummyvalue2,dummyext1=dummyvalue1,bindname=cn=User2,X- 
> BINDPW=passwd2
> ldap://host2/ 
> ????dummyext2=dummyvalue2,dummyext1=dummyvalue1,bindname=cn=User2,X- 
> BINDPW=passwd2
>
> Anybody here having a clue?
>
> Ciao, Michael.
>
>
>
> 


More information about the python-ldap mailing list