Laurent Birtz wrote:

> Hi,
>
> I guess I can open a new connection to the LDAP server, but that seems
> to be a cubbersome workaround to me.
> Am I missing the easier way to do this?
> Thanks,
> Laurent Birtz <[EMAIL PROTECTED]>

Because of the way perldap is implemented, you don't have a lot of choices.
The results of your search are stored in a structure that is pointed to by
your Mozilla::LDAP::Conn object, and the object can only remember one of
these at a time. Therefore, you should either create another ldap object
(thus opening up a second ldap connection) to use for your "inner search",
or just use Net::LDAP, which does not have the same restriction.

It may also be possible to hack your way into using one connection with
perldap, perhaps by
saving $ldap->{"ldres"} to a variable, carefully setting $ldap->{"ldres"} to
undef, then doing your search, then restoring $ldap->{"ldres"}, at which
point $ldap->nextEntry should return the next entry from your first search.
I doubt that this is "supported" and I'm sure that, unless your careful to
consume all the search results from your second, "inner" search (or unless
you run  ldap_msgfree yourself) , you may introduce memory leaks that are
even more cumbersome than multiple connections. Also I've never tested it
myself so it may do something utterly unexpected.

Hope this is coherent and helpful,
Dave Kernen




Reply via email to