Peter Marschall a écrit : > Hi, > > On Tuesday, 18. December 2007, Guillaume Rousse wrote: >> We are using a perl script, based on Net::LDAP to sync our AD server >> with our OpenLdap directory. My colleagues told me we couldn't create >> the entries directly in AD, as those entries requires additional >> processing, so we're generating LDIFF instead, which is imported into >> some microsoft later. > Strange. I'm creating/modifying AD accounts via perl-ldap all the time > without problems. I've suggested my colleagures to enquire further :) [..] >> However, I couldn't find a way in current Net::LDAP API to write an >> Net::LDAP::Entry once for creation, and thereafter only for subsequent >> modifications in the ldiff output. > Did you try Net::LDAP::Entry's changetype('modify') method ? > >> The following code >> >> my $ldif = Net::LDAP::LDIF->new('-', 'w', change => 1); >> my $group = Net::LDAP::Entry->new(); >> $group->dn('cn=group'); >> $ldif->write_entry($group); > # Try this: > $group->changetype('modify'); >> $group->add('member' => 'cn=user'); >> $ldif->write_entry($group); Thanks, it worked, and solved my issue perfectly.
I even found using $group->changetype('modify'); allow to split different entry modification in output. -- Guillaume Rousse Moyens Informatiques - INRIA Futurs Tel: 01 69 35 69 62