tags:

views:

121

answers:

1

Hi,

I'm using Net::LDAP to perform some operations on an openldap server.

I'm interested in performing a number of simultaneous operations, O1, O2 .. On. The normal way to do so would be to perform them sequentially with each operation involving at least 1 round trip to the server. I want to perform all of these ops within a single round trip.

Can this be achieved? I'm mostly interested in adding a directory structure 2-3 levels deep in one go.

+1  A: 

LDAP protocol does not have batch or match-more operations, and every operation must be performed separately on each entry in the DIT.

If you're trying to do bulk addition or bulk modifications you should always take a look at ldapadd and ldapmodify command line programs, they operate on ldif format, and (of course) perform in sequence operations specified in a given ldif file.

In your case you could use or in your case Net::LDAP::LDIF to create ldif file, and call ldapadd or ldapmodify with that file as an argument.

Zoran Regvart
Hi, can I add this LDIF object via Net::Ldap module (and not ldaoadd/modify commands)? I didn't find any such method in the docs.
baskin
I don't think so, the LDIF format is for bulk export/import operations, and it is just a shorthand for not doing ldap operations yourself; in fact I don't know of any API that supports LDIF operations for direct modifications of LDAP. Why shy away from a very perl-ish thing by piping to ldapadd/ldapmodify commands?
Zoran Regvart
>> "shy away from a very perl-ish thing by piping to ldapadd/ldapmodify"Time to become an extrovert then :).
baskin