From: Marc S. <msh...@bi...> - 2002-02-06 18:07:19
|
> > My question is: Is it possible for me to dive into the change > control data > in order to extract it's various values? Yes, here's my search callback which does it (warning: this is ugly test code and I'm a perl newbie) Marc sub srchCallBack { my ($r, $obj) = @_; my ($changeType, $dn, $changeNumber); print "In scrhCallBack !!\n"; if (!$obj) { print "\t", $r->error, "\n"; } elsif ($obj->isa('Net::LDAP::Entry')) { print "\tGot an entry !!\n"; print "\t\tDN = ", $obj->dn, "\n"; if (!($opt_t eq "AD")) { ($cbCtrl) = $r->control("2.16.840.1.113730.3.4.7"); if ($cbCtrl) { $cbBer = new Convert::BER($cbCtrl->value); $cbBer->decode( SEQUENCE => [ ENUM => \$changeType, STRING => \$dn, INTEGER => \$changeNumber, ] ); if ($changeType = 1) { print "\t\tAdd\n"; } elsif ($changeType = 2) { print "\t\tDelete\n"; } elsif ($changeType = 3) { print "\t\tModify\n"; } else { print "\t\tModDN\n"; print "\t\t\tPrev DN is ", $dn, "\n"; print "\t\t\tChange number is ", $changeNumber, "\n"; } } } } else { print "\tGot a reference !!\n"; } } |