summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/ldapd/run-tests.pl
blob: 8465a95969cb75d54e9563d7d2f36522cb37c6a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

use Net::LDAP;
use Net::LDAP::LDIF;
use Net::LDAP::Entry;
use Data::Dumper;

my $ldap;
my $base="dc=bar,dc=quux";
$base="dc=example,dc=com";

BEGIN {
        $ldap = Net::LDAP->new('ldapi://%2ftmp%2fldapi');
        my $mesg = $ldap->bind;
        $mesg->code && die $mesg->error;
}

END {
	$ldap->unbind;
}

        my $mesg = $ldap->search(base => $base, scope => "sub", filter => "(objectClass=inetOrgPerson)");
        $mesg->code && die $mesg->error;
        say $mesg->count." ldap entries";
        for (my $i=0 ; $i < $mesg->count ; $i++) {
                say $mesg->entry($i)->dn();
        }