From: Mike a. P. M. <mor...@te...> - 2002-02-06 17:28:12
|
Hi all, I've been experimenting with persistent searching on various LDAP server, and seem to have that code down pat. I've also taken Graham advice from a previous post about modifying Net::LDAP::Search to allow me to see (at a very high level) the Entry Change Control returned with every entry. My question is: Is it possible for me to dive into the change control data in order to extract it's various values? Here's how I've defined the 2 controls via asn->prepare() (definitions borrowed from http://www.ietf.org/proceedings/99jul/I-D/draft-ietf-ldapext-psearch-01.txt ) : $asn = Convert::ASN1->new; $asn->prepare(<<LDAP_X) or die "asn_prepare: ".$asn->error; -- Need to add the following 2 because they aren't defined -- anywhere before this (taken from Net::LDAP::ASN) LDAPString ::= OCTET STRING -- UTF8String ?? LDAPDN ::= LDAPString PersistentSearch ::= [APPLICATION 98] SEQUENCE { changeTypes INTEGER, changesOnly BOOLEAN, returnECs BOOLEAN } EntryChangeNotification ::= [APPLICATION 99] SEQUENCE { changeType ENUMERATED { add (1), delete (2), modify (4), modDN (8) } previousDN LDAPDN OPTIONAL, -- modifyDN ops. only changeNumber INTEGER OPTIONAL -- if supported } LDAP_X and here's my callback code: sub processEntry { my ($mesg,$entry) = @_; if (! defined $entry){ warn "search_cb: ".$mesg->error."\n"; } else { print $entry->dn."\n"; # Updated Net::LDAP::Search with a piece of code on the # perl-ldap mailing list that will allow us to get controls # from data returned in entries. @resp = $mesg->control( LDAP_CONTROL_ENTRYCHANGE ); my $ecASN = $asn->find('EntryChangeNotification'); foreach my $r (@resp){ print "Found control ".$r->type."\n"; } } $mesg->pop_entry; } Thanks in advance for the advice, Mike |