Lars Erik Kolden wrote: > ldapmodify: modify operation type is missing at line 26, entry > "cn=audio,ou=Group,dc=ourdc,dc=no" > [..] > When I look in the LDAP docs, this looks reasonable, as it states that > you ned an "add: memberUid" statement with the changetype: modify. But > how come it worked before? And when I try to incorporate this into the > LDIF generator script, which uses python-ldap, it just won't work.
I don't know why it worked in the past. The LDIF generator script is wrong since it uses module ldif for generating entry records (provided by a dict) instead of providing a modification list (list type) which would make LDIFWriter.unparse() to generate a change record. See __doc__ string in ldif.py: class LDIFWriter: [..] def unparse(self,dn,record): """ dn string-representation of distinguished name record Either a dictionary holding the LDAP entry {attrtype:record} or a list with a modify list like for LDAPObject.modify(). """ > relevant code looked like this: > > ######### > # add the new user to a set of default groups: > # audio, cdrom, floppy, plugdev, video > > entry={ 'changetype' : ['modify'], > 'memberUid': [username], > } > dn='cn=audio,ou=Group,dc=ourdc,dc=no' > ldif_writer=ldif.LDIFWriter(newusers) > ldif_writer.unparse(dn,entry) Should be: modlist=[(ldap.MOD_ADD,'memberUid',[username])] ldif_writer.unparse(dn,modlist) BTW: Anyway I'd recommend to directly use a LDAP connection for this task, not generate LDIF and then using command-line tools. This would give you much better control in case of LDAP errors. Ciao, Michael. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Python-LDAP-dev mailing list Python-LDAP-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/python-ldap-dev