openldap - Export/import LDAP data using perl script -


i new in openldap , perl. want export /import ldap data with/without schema ldap database. possible using perl script? if yes ,please give me sample code. create new schema using openldap , perl without dns.how that?

this many questions in 1 item. please ask 1 question @ time.

how read ldap wtih perl:

use strict; use warnings; use data::dumper; ### ldap   use convert::asn1;   use net::ldap; use net::ldap::util qw(ldap_error_name canonical_dn ldap_explode_dn ldap_error_text); use net::ldap::ldif;  %parms (   host => 'localhost',   port => 389,   binddn => 'your dn',   passwd => 'password',   base => "",   filter => "(objectclass=*)",   scope => "base",   attrs => ['*'],  ); $ldif = net::ldap::ldif->new( "out.ldif", "w", onerror => 'die', wrap  => 0 ); $ldap= net::ldap->new($parms{'host'}, port => $parms{'port'});  $bind_result = $ldap->bind($parms{'binddn'},'password' => $parms{'passwd'},'version' => '3'); if($bind_result->is_error()) {   die ('unable bind ' . $parms{'host'} . ': '.$bind_result->error());  } @search_args = (     'base'     => $parms{"base"},                    'scope'    => $parms{'scope'},                                  'filter'   => $parms{'filter'},     'attrs'    => $parms{'attrs'},     'deref'    => 'always', );  $msg = $ldap->search(@search_args); if ($msg->is_error()) {     die "error: ".dumper(\@search_args).", ".$msg->error."\n";   } while (my $entry = $msg->pop_entry()){     $cn = $entry->get_value("cn");     print "cn: $cn\n"; } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -