From: Chris R. <chr...@me...> - 2001-04-19 16:37:33
|
Roland Stigge <rol...@ep...> wrote: > Hi all, > > I've got a problem understanding the information posted earlier on this > mailing list: > > ----- begin > FROM: Graham Barr > DATE: 10/17/2000 22:20:47 > SUBJECT: RE: chasing referrals > > On Tue, Oct 17, 2000 at 05:27:49PM -0700, Robbie Allen wrote: > > Can Net::LDAP automatically chase referrals? Sample code? > > Not yet. Currently you have to follow them yourself. You can > get them with > > $mesg = $ldap->search( ... ); > @referrals = $mesg->referrals; > > Graham. > ----- end > > (We are using Net::LDAP 0.22 and OpenLDAP 1.2.11) > > It seems that my configuration doesn't return any referrals. I have > configured two servers, one holding o=epigenomics, the other on > c=us,o=epigenomics. Via PHP and ldapsearch tools, the inserted referrals > even seem to transparently redirect the client to the second server when > accessing/searching the c=us,epigenomics substructure. But with my > Net::LDAP code: > > --- begin > $ldap = Net::LDAP->new("wilson"); # connect to root server > $ldap->bind; > $mesg = $ldap->search( base => "o=epigenomics", > filter => '(&(cn=*)(objectclass=*))', > deref => 3, > ); > @referrals = $mesg->referrals; > foreach $ref (@referrals) { > print "Referral: ",$ref,"\n"; > } > > print "Return code: ",$mesg->code,"\n"; > print "Error message: \"",$mesg->error,"\"\n"; > $n = $mesg->all_entries; > print "Number of Entries: ".$n."\n"; > > foreach $entry ($mesg->entries) { > print "dn: ",$entry->dn,"\n"; > } > --- end > > I don't get any referrals (the response is:) > > --- begin > Return code: 9 > Error message: "Referral: > ldap://deledda/c=us,o=epigenomics" > Number of Entries: 2 > dn: cn=admin,o=epigenomics > dn: cn=updated,o=epigenomics > --- end > > (There should be more users. ldapsearch and PHP functions are able to > provide them.) > > Thanks for your ideas! > > bye, > Roland > -- > Roland Stigge > > Epigenomics AG Kastanienallee 24 > www.epigenomics.com 10435 Berlin > > You are binding using LDAPv2. LDAPv2 did not have referrals. Some vendors have 'patched in' some support for referrals in LDAPv2, but this is completely non-standard and not supported by Net::LDAP. Try binding with LDAPv3 instead and see what you get. Hint: pass version => 3 in the bind call. Cheers, Chris |