Script for Mutt to query db.debian.org
Here's a little script I wrote for mutt to query the developer database.
To use it, install this script in your PATH, and add this line to
~/.muttrc:
set query_command = "debian-ldap-query '%s'"
You will need to install the libnet-ldap-perl package for this to work.
Then from within mutt hit "Q" and type in something like "ben" and you get
a nice list.
Enjoy,
Ben
--
-----------=======-=-======-=========-----------=====------------=-=------
/ Ben Collins -- ...on that fantastic voyage... -- Debian GNU/Linux \
` bcollins@debian.org -- bcollins@openldap.org -- bcollins@linux.com '
`---=========------=======-------------=-=-----=-===-======-------=--=---'
#!/usr/bin/perl
$|=1;
use Net::LDAP;
my $server = "db.debian.org";
my $base = "ou=users, dc=debian, dc=org";
my $port = 389;
die print "Usage: $0 <name> [<name> ...]\n" if ! $ARGV[0];
my @results;
my $ldap = Net::LDAP->new($server, port => $port) or
die "Could not contact LDAP server $server:$port";
$ldap->bind or die "Could not bind";
foreach my $search (@ARGV) {
my $mesg = $ldap->search (
base => "$base",
filter => "(|(cn=*$search*)(sn=*$search*))",
) || die "Failed search";
foreach my $entry ($mesg->entries) {
my @uid = $entry->get('uid');
next if !defined(@uid) || $uid[0] eq '';
my @fname = $entry->get('cn');
my @lname = $entry->get('sn');
push @results, "<$uid[0]\@debian.org>\t$fname[0] $lname[0]\t()\tDebian\n";
}
}
$ldap->unbind;
print "LDAP query: found ", scalar(@results), "\n", @results;
exit 1 if ! @results;
Reply to: