summaryrefslogtreecommitdiff
path: root/fs_sesmon/FS-SessionClient
diff options
context:
space:
mode:
authorivan <ivan>2000-11-07 15:00:37 +0000
committerivan <ivan>2000-11-07 15:00:37 +0000
commit7f07089722bfcabe3bf42619bb2bdb81fd8d44e1 (patch)
tree8bbfe5b33182d68cd89e63176a11dcc468091ed0 /fs_sesmon/FS-SessionClient
parentb31966d5d1f9d8629bd28ff1c2ff37a5c84965c1 (diff)
session monitor
Diffstat (limited to 'fs_sesmon/FS-SessionClient')
-rw-r--r--fs_sesmon/FS-SessionClient/MANIFEST2
-rw-r--r--fs_sesmon/FS-SessionClient/Makefile.PL2
-rw-r--r--fs_sesmon/FS-SessionClient/SessionClient.pm6
-rw-r--r--fs_sesmon/FS-SessionClient/bin/freeside-login36
-rw-r--r--fs_sesmon/FS-SessionClient/bin/freeside-logoff37
5 files changed, 79 insertions, 4 deletions
diff --git a/fs_sesmon/FS-SessionClient/MANIFEST b/fs_sesmon/FS-SessionClient/MANIFEST
index 3ced1df17..6da7b22e9 100644
--- a/fs_sesmon/FS-SessionClient/MANIFEST
+++ b/fs_sesmon/FS-SessionClient/MANIFEST
@@ -7,3 +7,5 @@ test.pl
fs_sessiond
cgi/logon.cgi
cgi/logoff.cgi
+bin/freeside-login
+bin/freeside-logoff
diff --git a/fs_sesmon/FS-SessionClient/Makefile.PL b/fs_sesmon/FS-SessionClient/Makefile.PL
index 8dff176a7..1f598474a 100644
--- a/fs_sesmon/FS-SessionClient/Makefile.PL
+++ b/fs_sesmon/FS-SessionClient/Makefile.PL
@@ -4,7 +4,7 @@ use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'FS::SessionClient',
'VERSION_FROM' => 'SessionClient.pm', # finds $VERSION
- 'EXE_FILES' => [ 'fs_sessiond' ],
+ 'EXE_FILES' => [ qw(fs_sessiond freeside-login freeside-logoff) ],
'INSTALLSCRIPT' => '/usr/local/sbin',
'PERM_RWX' => '750',
);
diff --git a/fs_sesmon/FS-SessionClient/SessionClient.pm b/fs_sesmon/FS-SessionClient/SessionClient.pm
index fd50e8908..97332cb26 100644
--- a/fs_sesmon/FS-SessionClient/SessionClient.pm
+++ b/fs_sesmon/FS-SessionClient/SessionClient.pm
@@ -1,7 +1,7 @@
package FS::SessionClient;
use strict;
-use vars qw($VERSION @ISA @EXPORT_OK $fs_sessiond_socket);
+use vars qw($AUTOLOAD $VERSION @ISA @EXPORT_OK $fs_sessiond_socket);
use Exporter;
use Socket;
use FileHandle;
@@ -10,7 +10,7 @@ use IO::Handle;
$VERSION = '0.01';
@ISA = qw( Exporter );
-@EXPORT_OK = qw( login logoff );
+@EXPORT_OK = qw( login logoff portnum );
$fs_sessiond_socket = "/usr/local/freeside/fs_sessiond_socket";
@@ -104,7 +104,7 @@ sub AUTOLOAD {
=head1 VERSION
-$Id: SessionClient.pm,v 1.1 2000-10-27 20:15:50 ivan Exp $
+$Id: SessionClient.pm,v 1.2 2000-11-07 15:00:37 ivan Exp $
=head1 BUGS
diff --git a/fs_sesmon/FS-SessionClient/bin/freeside-login b/fs_sesmon/FS-SessionClient/bin/freeside-login
new file mode 100644
index 000000000..6ca4455f8
--- /dev/null
+++ b/fs_sesmon/FS-SessionClient/bin/freeside-login
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -Tw
+
+#false-laziness hack w freeside-logoff
+
+use strict;
+use FS::SessionClient qw( login 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 = login ( {
+ 'username' => $username,
+ 'portnum' => $portnum,
+} );
+
+warn $error if $error;
+
+sub usage {
+ die "Usage:\n\n freeside-login username ( portnum | ip | nasnum nasport )";
+}
diff --git a/fs_sesmon/FS-SessionClient/bin/freeside-logoff b/fs_sesmon/FS-SessionClient/bin/freeside-logoff
new file mode 100644
index 000000000..f7b876b33
--- /dev/null
+++ b/fs_sesmon/FS-SessionClient/bin/freeside-logoff
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -Tw
+
+#false-laziness hack w freeside-login
+
+use strict;
+use FS::SessionClient qw( logoff 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 = login ( {
+ 'username' => $username,
+ 'portnum' => $portnum,
+} );
+
+warn $error if $error;
+
+sub usage {
+ die "Usage:\n\n freeside-logoff username ( portnum | ip | nasnum nasport )";
+}
+