blob: 9b4ecfe231a8e1df02f36d039eda18b71086dda7 (
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
32
33
34
35
36
|
#!/usr/bin/perl -Tw
#false-laziness hack w freeside-login
use strict;
use FS::SessionClient qw( logout portnum );
my $username = shift;
my $portnum;
if ( scalar(@ARGV) == 1 ) {
my $arg = shift;
if ( $arg =~ /^(\d+)$/ ) {
$portnum = $1;
} elsif ( $arg =~ /^([\d\.]+)$/ ) {
$portnum = portnum( { 'ip' => $1 } ) or die "unknown ip!"
} else {
&usage;
}
} elsif ( scalar(@ARGV) == 2 ) {
$portnum = portnum( { 'nasnum' => shift, 'nasport' => shift } )
or die "unknown nasnum/nasport";
} else {
&usage;
}
my $error = logout ( {
'username' => $username,
'portnum' => $portnum,
} );
warn $error if $error;
sub usage {
die "Usage:\n\n freeside-logout username ( portnum | ip | nasnum nasport )";
}
|