From: Giulia C. <gi...@be...> - 2000-08-07 22:59:37
|
i'm using Net::LDAP::LDIF and Net::LDAP::Entry to attempt to modify directory entries, while bound to the directory as directory manager. i get LDAP_ALREADY_EXISTS, which i don't understand-- isn't it true that an update using changetype: modify will overwrite the existing value for the attribute? i'd really appreciate feedback on the following: ################################## $debug = 1; $ldap = Net::LDAP->new('ldapserver.mydomain.com') or die "$@"; $br = $ldap->bind ( #bind to directory with privs dn => 'cn=Special Someone', password => "blahblah" ) || die $@; $bind_result = Net::LDAP::Util::ldap_error_name($br->code); print "Result of attempt to bind was $bind_result \n" if $debug; $ldif_final = "ldif.final"; $updateldif = Net::LDAP::LDIF->new("$ldif_final", "r") or die "$@"; while( $finalentry = $updateldif->read() ) { $final_dn = $finalentry->dn; @final_attrs = $finalentry->attributes; print "final dn of entry is $final_dn\n" if $debug; print "final attributes of entry are @final_attrs\n" if $debug; $ur = $finalentry->update( $ldap ); #update directory server $update_result = Net::LDAP::Util::ldap_error_name($ur->code); print "The result of the modify of $final_dn is: $update_result \n" if $debug; } $ldap->unbind(); ################################## % cat ldif.final dn: uid=sally, ou=People, dc=mydomain, dc=com changetype: modify replace: managerchain managerchain: joe lisa john bill larry thanks, giulia |