X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=mutt-licom.pl;h=08c25022834e0e244f2948d33b863e9765e754d3;hb=088609f68349c6888d73aaa60708d7bab4a8e7d0;hp=894bd1eb8bedd01072a1917f086716d666ffa2be;hpb=668385f6b26d5280882b020656034d701157fb02;p=licom.git diff --git a/mutt-licom.pl b/mutt-licom.pl index 894bd1e..08c2502 100755 --- a/mutt-licom.pl +++ b/mutt-licom.pl @@ -2,15 +2,36 @@ use strict; use warnings; -use lib (qw(lib)); + +use FindBin (qw($Bin)); +use lib ("$Bin/lib"); use LiCoM::Config (qw(get_config)); use LiCoM::Person; -our $Config = get_config (); +our $Config; -die unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'}) - and defined ($Config->{'password'})); +if (-e $ENV{'HOME'} . '/.licomrc') +{ + $Config = get_config ($ENV{'HOME'} . '/.licomrc'); +} +elsif (-e '/etc/licom/licom.conf') +{ + $Config = get_config ('/etc/licom/licom.conf'); +} +else +{ + $Config = get_config (); +} + +unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'}) + and defined ($Config->{'password'})) +{ + die (<{'base_dn'} = $Config->{'bind_dn'} unless (defined ($Config->{'base_dn'})); @@ -28,6 +49,14 @@ for (@ARGV) die ('No (valid) patterns found.') unless (@Patterns); +LiCoM::Person->connect +( + uri => $Config->{'uri'}, + base_dn => $Config->{'base_dn'}, + bind_dn => $Config->{'bind_dn'}, + password => $Config->{'password'} +) or die; + our @Matches = LiCoM::Person->search (@Patterns, [[mail => '*']]); print STDOUT scalar (@Matches), ' ', (scalar (@Matches) == 1 ? 'entry' : 'entries'), " found.\n";