Bug#175710: python-ldap modlist patch
Domenico Andreoli
cavok at filibusta.crema.unimi.it
Sun Apr 20 01:50:36 CEST 2003
of course i forgot the attachment..
On Sat, Apr 19, 2003 at 10:39:03PM +0200, Domenico Andreoli wrote:
> hi Michael,
>
> the patch you are referring to is already in the python-ldap version i'm
> using and the problem is right in the "modlist.append((ldap.MOD_DELETE,attrtype,None))".
> the error i get is from deletion of an inexistent entry.
>
> i attached an example to reproduce the bug.
>
> cheers
> cavok
>
> On Fri, Apr 04, 2003 at 08:53:06PM +1000, Peter Hawkins wrote:
> > Well, I'm not sure but I think I already fixed this in a different way:
> >
> > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python-ldap/python-ldap/Lib/ldap/modlist.py.diff?r1=1.11&r2=1.12
> >
> > Comment:
> > "Replace an attribute value by deleting it completely and re-add the whole
> > attribute value list. This is necessary to make it work with attributes for
> > which no matching rules are implemented. The caveat is that it might trigger
> > mor attribute indexing depending on LDAP server implementation."
> >
-----[ Domenico Andreoli, aka cavok
--[ http://filibusta.crema.unimi.it/~cavok/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50
-------------- next part --------------
#! /usr/bin/python
import ldap, ldap.modlist
uri = "ldap://localhost"
binddn = "cn=admin,dc=localnet"
passwd = "secret"
dn = "uid=fake,dc=localnet"
def make_entry(s):
return {
"objectClass" : [ "top", "person" ],
"cn" : [ "Domenico" ],
"sn" : [ "Andreoli" ],
"description" : [ s ]
}
l = ldap.initialize(uri)
l.bind_s(binddn, passwd, ldap.AUTH_SIMPLE)
try:
entry = make_entry("something")
modlist = ldap.modlist.addModlist(entry)
l.add_s(dn, modlist)
entry_old = entry
entry = make_entry(None)
modlist = ldap.modlist.modifyModlist(entry_old, entry)
l.modify_s(dn, modlist)
entry_old = entry
entry = make_entry("something")
modlist = ldap.modlist.modifyModlist(entry_old, entry)
# print modlist
l.modify_s(dn, modlist) # ooops
except:
l.delete_s(dn)
l.unbind_s()
raise
More information about the python-ldap
mailing list