[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Regex pattern for LDIF
On Die, 31 Okt 2000, Michael Ströder wrote:
>Does anybody on the list have a regex pattern for LDIF-formatted
>entry at hand?
your searching something like this (?):
#!/usr/bin/perl
use Socket;
use Net::LDAP;
$dn="cn=root,o=DHW,c=DE";
$password="xxxxxxxx";
$ldaphost="your.host.domain.com";
$ldap = Net::LDAP->new($ldaphost) or die "$@";
$ldap->bind( dn => $dn, password => $password);
$base = "o=DHW,c=DE";
$uid ="uid".@ARGV[0];
$mesg = $ldap->search(base => "$base", filter => "uid=".@ARGV[0]);
print "=========================================================\n";
while( my $entry = $mesg->shift_entry) {
foreach my $attr ($entry->attributes) {
foreach my $value ($entry->get_value($attr)) {
print $attr, ": ", $value, "\n";
}
}
}
print "=========================================================\n";
Greetings,
Joerg Henner.
--
LinuxHaus Stuttgart | Tel.: +49 (7 11) 2 85 19 05
J. Henner & A. Reyer, Datentechnik GbR | D2: +49 (1 72) 7 35 31 09
| Fax: +49 (7 11) 5 78 06 92
Linux, Netzwerke, Consulting & Support | http://lihas.de