1 |
#!/usr/bin/perl -w |
2 |
|
3 |
# 2003-10-30 Dobrica Pavlinusic <dpavlin@rot13.org> |
4 |
# |
5 |
# fingers server and allows to add users to .htusers file with |
6 |
# auth_pop3 for user authentification |
7 |
# |
8 |
# uses Net::Finger from CPAN |
9 |
# |
10 |
# usage: |
11 |
# |
12 |
# finger2htusers.pl something@server >> .htusers |
13 |
# |
14 |
|
15 |
use strict; |
16 |
use Net::Finger; |
17 |
|
18 |
|
19 |
if (! @ARGV) { |
20 |
print "usage: $0 something\@server >> .htusers\n"; |
21 |
exit 1; |
22 |
} |
23 |
|
24 |
print "# finger2htuser.pl start of output on ",scalar localtime(time),"\n"; |
25 |
|
26 |
foreach my $addr (@ARGV) { |
27 |
my @lines = finger($addr); |
28 |
my ($f_what,$f_server) = split(/@/,$addr); |
29 |
$f_server="localhost" if (! $f_server); |
30 |
foreach (@lines) { |
31 |
if (m/Login:\s*(\S+)\s+Name:\s*(.+)\s*$/i) { |
32 |
my ($login,$name) = ($1,$2); |
33 |
print "$login:$name:auth_pop3:$login\@$f_server\n"; |
34 |
} |
35 |
} |
36 |
} |
37 |
|
38 |
exit; |