Hi,
My objective is to create a perl script that would grab changed entries
from one LDAP server and feed it into another (acting as an insecure
cache-like server), just so our local Eudora users can find people faster
than going to the master server through WAN, which is not always available.
The script generally works, but there are some records that bomb the
script, consistently. I think that's because I read multiple values
incorrectly, thus when the copy is written to the replica, it gives the
"segmentation fault" error. I inserted the piece of code that I think is
the culprit, but I'm stuck as to what needs to be corrected. I wonder if
you gurus could give me some pointers.
***********
use Mozilla::LDAP::Conn; # Main "OO" layer for LDAP
use Mozilla::LDAP::Utils; # LULU, utilities.
...snip...
At this point, I have the two LDAP servers queried for the same records,
and what I want to do is to copy each and every attributes and the
respective values from %Entry into %Existing, with the piece of code follows:
*************
if ($Existing) {
foreach $attr (@{$Entry->{"_oc_order_"}})
{
if (($attr =~ /^_.+_$/) || ($attr eq 'jpegphoto') || ($attr eq
'usercertificate')) {
next;
}
# Add all attributes values of the grabbed record into the found record
if (defined($Existing->{$attr})) {
$Existing->{$attr}= [ @{$Entry->{$attr}} ];
} else {
$Existing->addValue("$attr", [ @{$Entry->{$attr}} ]);
} # End if (defined ...
} # End foreach
$replica->update($Entry) || warn "can not update $dn to LDAP replica:";
}
else {
... snip ...
Eagerly waiting your assistance,
***************************************************************************
Thanks and regards,
Billy Joedono
"Courtesy comes by default, but respect I gotta earn"
***************************************************************************