diff options
-rwxr-xr-x | fripost-searchalias | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fripost-searchalias b/fripost-searchalias index a70b900..0a6c4d7 100755 --- a/fripost-searchalias +++ b/fripost-searchalias @@ -131,31 +131,30 @@ sub perform_search { my %alias = @_; foreach my $alias ($ldap->alias->search( \%alias )->entries) { - say "From: " . (join ', ', @{$alias->{address}}); - say "Goto: " . $alias->{goto}; - say "IsActive: " . $alias->{isActive}; - say "--------------------------------" + say "" . ($alias->{isActive} ? "ACTIVE" : "INACTIVE") + . " alias for " . $alias->{goto} . " are " + . (join ', ', @{$alias->{address}}); } } +my $search = $ARGV[0]; + my $f = $conf->{from}; my $g = $conf->{goto}; my $from = $f || !$f && !$g; my $goto = $g || !$f && !$g; if ($from) { - say " Searchin 'from'"; - perform_search(address => $ARGV[0]); + perform_search(address => $search); - my ($u,$d) = split /\@/, $ARGV[0], 2; + my ($u,$d) = split /\@/, $search, 2; $d = $u if (defined $u) and not (defined $d); $ldap->domain->search({ domain => $d })->count or die "Error: Unknown domain `$d'.\n"; } if ($goto) { - say " Searchin 'goto'"; - perform_search(goto => $ARGV[0]); + perform_search(goto => $search); } $ldap->unbind(); @@ -169,6 +168,8 @@ Guilhem Moulin C<< <guilhem at fripost.org> >> Copyright 2012 Guilhem Moulin. +Copyright 2012 Stefan Kangas <skangas@skangas.se>. + =head1 LICENSE This program is free software; you can redistribute it and/or modify it |