[Date Prev][Date Next] [Chronological] [Thread] [Top]

HOWTO push LDAP updates via Perl's Net::LDAPapi?



Hi there

I'm trying to use Net::LDAPapi in Perl to push LDAP updates from an M$
Exchange LDAP server onto a small OpenLDAP server running in our firewall
DMZ (i.e. pull is not desirable or possible).


Running ldapmodify off a LDIF file works as expected - but really slowly
(several seconds per record), so I thought I'd try perl. But when I try to
do it with perl, the modifies fail with an error 32.

The code looks as follows:

new Net::LDAPapi(to_Exchange)
bind_s

new Net::LDAPapi(to_openldap)
bind_s($ldap_usercode,$ldap_password)

%record = %{$ldcon->get_all_entries};

  %mods = (
  "dn", $record{$dn}{'dn'}[0],
  "objectclass", $record{$dn}{'objectclass'}[0],
  "cn", $record{$dn}{'cn'}[0],
  "rfc822mailbox", $record{$dn}{'rfc822mailbox'}[0],
  "mail", $record{$dn}{'mail'}[0],
  "postaladdress", $record{$dn}{'postaladdress'}[0],
  "company", $record{$dn}{'company'}[0],
  "department", $record{$dn}{'department'}[0],
  "givenname", $record{$dn}{'givenname'}[0],
  "initials", $record{$dn}{'initials'}[0],
  "l", $record{$dn}{'l'}[0],
  "uid", $record{$dn}{'uid'}[0],
  "physicaldeliveryofficename", $record{$dn}{'physicaldeliveryofficename'}[0],
  "sn", $record{$dn}{'sn'}[0],
  "facsimiletelephonenumber", $record{$dn}{'facsimiletelephonenumber'}[0],
  "homephone", $record{$dn}{'homephone'}[0],
  "mobile", $record{$dn}{'mobile'}[0],
  "telephonenumber", $record{$dn}{'telephonenumber'}[0],
  "pager", $record{$dn}{'pager'}[0],
  "co", $record{$dn}{'co'}[0],
  "title", $record{$dn}{'title'}[0],
  "url", $record{$dn}{'url'}[0],
  "manager", $record{$dn}{'manager'}[0],
  "reports", $record{$dn}{'reports'}[0]
  );

modify($dn,\%mods);

The modify returns "32". 

Any ideas where I'm going wrong?

Perl-5.005 with Net::LDAPapi-1.42

-- 
Cheers

Jason Haar

Unix/Network Specialist, Trimble NZ
Phone: +64 3 3391 377 Fax: +64 3 3391 417