On 4/11/04 11:08 am, Mike Jackson <[EMAIL PROTECTED]> wrote: > Hi, > Is there a technique to insert search references into entries, for the > explicit purpose of prototyping some new application? > > I could imagine something like this: > > $ref = new Net::LDAP::Reference('ou=remote-server,dc=foo,dc=com', > ref => > 'ldap://a.b.c/ou=remote-server/dc=foo,dc=com'); > > $entries->add($ref); > > The idea is that I want to create some entries in memory, so that I can > search > through them, and I want those entries to also contain some references. > > Any ideas?
The technique is to use the schema in RFC 3296 (if that's what your server uses to implement references) and just add an entry containing appropriate object classes and attribute values. So in perl you just add an entry like this: $ldap->add("ou=remote-server,dc=foo,dc=com', attrs => [ ou => "remote-server", objectclass => [qw(top referral extensibleObject)], ref => "ldap://a.b.c/ou=remote-server/dc=foo,dc=com", ]); (You need the extensibleObject objectclass because the ou attribute isn't permitted by either the referral or the top objectclasses.) Given the presence of extensibleObject, you could add all sorts of other gunk to the entry. You would of course only be able to read either the entry containing the ref (if you pass the control described by RFC 3296), or the entry pointed at by the ref, in any single operation. The LDAP model doesn't permit you to read both entries in the same operation. Cheers, Chris