summaryrefslogtreecommitdiff
path: root/fs_sesmon/FS-SessionClient
diff options
context:
space:
mode:
authorivan <ivan>2000-12-03 20:25:20 +0000
committerivan <ivan>2000-12-03 20:25:20 +0000
commitb90f8cdac9371c219a72dda16f8deecc7c44fc28 (patch)
tree566f55939a488f29e5a79821aef6102669afe721 /fs_sesmon/FS-SessionClient
parent3a95cc316da367ffd248ba29ac594f3efbc9db61 (diff)
session monitor updates
Diffstat (limited to 'fs_sesmon/FS-SessionClient')
-rw-r--r--fs_sesmon/FS-SessionClient/MANIFEST4
-rw-r--r--fs_sesmon/FS-SessionClient/Makefile.PL2
-rw-r--r--fs_sesmon/FS-SessionClient/SessionClient.pm22
-rw-r--r--fs_sesmon/FS-SessionClient/bin/freeside-login2
-rw-r--r--fs_sesmon/FS-SessionClient/bin/freeside-logout (renamed from fs_sesmon/FS-SessionClient/bin/freeside-logoff)7
-rw-r--r--fs_sesmon/FS-SessionClient/fs_sessiond10
-rw-r--r--fs_sesmon/FS-SessionClient/test.pl3
7 files changed, 26 insertions, 24 deletions
diff --git a/fs_sesmon/FS-SessionClient/MANIFEST b/fs_sesmon/FS-SessionClient/MANIFEST
index 6da7b22e9..9da279a87 100644
--- a/fs_sesmon/FS-SessionClient/MANIFEST
+++ b/fs_sesmon/FS-SessionClient/MANIFEST
@@ -6,6 +6,6 @@ SessionClient.pm
test.pl
fs_sessiond
cgi/logon.cgi
-cgi/logoff.cgi
+cgi/logout.cgi
bin/freeside-login
-bin/freeside-logoff
+bin/freeside-logout
diff --git a/fs_sesmon/FS-SessionClient/Makefile.PL b/fs_sesmon/FS-SessionClient/Makefile.PL
index 1f598474a..137b6b8bd 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' => [ qw(fs_sessiond freeside-login freeside-logoff) ],
+ 'EXE_FILES' => [ qw(fs_sessiond bin/freeside-login bin/freeside-logout) ],
'INSTALLSCRIPT' => '/usr/local/sbin',
'PERM_RWX' => '750',
);
diff --git a/fs_sesmon/FS-SessionClient/SessionClient.pm b/fs_sesmon/FS-SessionClient/SessionClient.pm
index 97332cb26..8a0ff705f 100644
--- a/fs_sesmon/FS-SessionClient/SessionClient.pm
+++ b/fs_sesmon/FS-SessionClient/SessionClient.pm
@@ -10,7 +10,7 @@ use IO::Handle;
$VERSION = '0.01';
@ISA = qw( Exporter );
-@EXPORT_OK = qw( login logoff portnum );
+@EXPORT_OK = qw( login logout portnum );
$fs_sessiond_socket = "/usr/local/freeside/fs_sessiond_socket";
@@ -30,7 +30,7 @@ FS::SessionClient - Freeside session client API
=head1 SYNOPSIS
- use FS::SessionClient qw( login portnum logoff );
+ use FS::SessionClient qw( login portnum logout );
$error = login ( {
'username' => $username,
@@ -43,10 +43,10 @@ FS::SessionClient - Freeside session client API
$portnum = portnum( { 'nasnum' => $nasnum, 'nasport' => $nasport } )
or die "unknown nasnum/nasport";
- $error = logoff ( {
+ $error = logout ( {
'username' => $username,
'password' => $password,
- 'logoff' => $timestamp,
+ 'logout' => $timestamp,
'portnum' => $portnum,
} );
@@ -73,13 +73,13 @@ Returns a scalar error message, or the empty string for success.
=item portnum
HASHREF should contain a single key: ip, or the two keys: nasnum and nasport.
-Returns a portnum suitable for the login and logoff subroutines, or false
+Returns a portnum suitable for the login and logout subroutines, or false
on error.
-=item logoff HASHREF
+=item logout HASHREF
-HASHREF should have the following keys: usrename, password, logoff and portnum.
-logoff is a UNIX timestamp; if not specified, will default to the current time.
+HASHREF should have the following keys: usrename, password, logout and portnum.
+logout is a UNIX timestamp; if not specified, will default to the current time.
Starts a new session for the specified user and portnum. The password is
optional, but must be correct if specified.
@@ -89,9 +89,11 @@ Returns a scalar error message, or the empty string for success.
sub AUTOLOAD {
my $hashref = shift;
+ my $method = $AUTOLOAD;
+ $method =~ s/^.*:://;
socket(SOCK, PF_UNIX, SOCK_STREAM, 0) or die "socket: $!";
connect(SOCK, sockaddr_un($fs_sessiond_socket)) or die "connect: $!";
- print SOCK "$AUTOLOAD\n";
+ print SOCK "$method\n";
print SOCK join("\n", %{$hashref}, 'END' ), "\n";
SOCK->flush;
@@ -104,7 +106,7 @@ sub AUTOLOAD {
=head1 VERSION
-$Id: SessionClient.pm,v 1.2 2000-11-07 15:00:37 ivan Exp $
+$Id: SessionClient.pm,v 1.3 2000-12-03 20:25:20 ivan Exp $
=head1 BUGS
diff --git a/fs_sesmon/FS-SessionClient/bin/freeside-login b/fs_sesmon/FS-SessionClient/bin/freeside-login
index 6ca4455f8..a6d475169 100644
--- a/fs_sesmon/FS-SessionClient/bin/freeside-login
+++ b/fs_sesmon/FS-SessionClient/bin/freeside-login
@@ -1,6 +1,6 @@
#!/usr/bin/perl -Tw
-#false-laziness hack w freeside-logoff
+#false-laziness hack w freeside-logout
use strict;
use FS::SessionClient qw( login portnum );
diff --git a/fs_sesmon/FS-SessionClient/bin/freeside-logoff b/fs_sesmon/FS-SessionClient/bin/freeside-logout
index f7b876b33..9b4ecfe23 100644
--- a/fs_sesmon/FS-SessionClient/bin/freeside-logoff
+++ b/fs_sesmon/FS-SessionClient/bin/freeside-logout
@@ -3,7 +3,7 @@
#false-laziness hack w freeside-login
use strict;
-use FS::SessionClient qw( logoff portnum );
+use FS::SessionClient qw( logout portnum );
my $username = shift;
@@ -24,7 +24,7 @@ if ( scalar(@ARGV) == 1 ) {
&usage;
}
-my $error = login ( {
+my $error = logout ( {
'username' => $username,
'portnum' => $portnum,
} );
@@ -32,6 +32,5 @@ my $error = login ( {
warn $error if $error;
sub usage {
- die "Usage:\n\n freeside-logoff username ( portnum | ip | nasnum nasport )";
+ die "Usage:\n\n freeside-logout username ( portnum | ip | nasnum nasport )";
}
-
diff --git a/fs_sesmon/FS-SessionClient/fs_sessiond b/fs_sesmon/FS-SessionClient/fs_sessiond
index 74d3aab31..d7284b252 100644
--- a/fs_sesmon/FS-SessionClient/fs_sessiond
+++ b/fs_sesmon/FS-SessionClient/fs_sessiond
@@ -12,7 +12,7 @@ use vars qw( $Debug );
$Debug = 1;
-my $fs_session_socket = "/usr/local/freeside/fs_sessiond_socket";
+my $fs_sessiond_socket = "/usr/local/freeside/fs_sessiond_socket";
$ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin';
$ENV{'SHELL'} = '/bin/sh';
@@ -29,10 +29,10 @@ warn "$me starting\n" if $Debug;
#nothing to read from server
warn "$me creating $fs_sessiond_socket\n" if $Debug;
-my $uaddr = sockaddr_un($fs_signupd_socket);
+my $uaddr = sockaddr_un($fs_sessiond_socket);
my $proto = getprotobyname('tcp');
socket(Server,PF_UNIX,SOCK_STREAM,0) or die "socket: $!";
-unlink($fs_signup_socket);
+unlink($fs_sessiond_socket);
bind(Server, $uaddr) or die "bind: $!";
listen(Server,SOMAXCONN) or die "listen: $!";
@@ -44,8 +44,8 @@ for ( ; $paddr = accept(Client,Server); close Client) {
if ( $command eq 'login' || $command eq 'logout' || $command eq 'portnum' ) {
warn "$me reading data from local client\n" if $Debug;
- my @data, $dos;
- push @data, scalar(<Client>) until $dos++ == 99 || $data[$#data] != "END\n";
+ my( @data, $dos );
+ push @data, scalar(<Client>) until $dos++ == 99 || $data[$#data] eq "END\n";
if ( $dos == 99 ) {
warn "$me WARNING: DoS attempt!"
} else {
diff --git a/fs_sesmon/FS-SessionClient/test.pl b/fs_sesmon/FS-SessionClient/test.pl
index d05201b66..4b9ae17e0 100644
--- a/fs_sesmon/FS-SessionClient/test.pl
+++ b/fs_sesmon/FS-SessionClient/test.pl
@@ -8,7 +8,8 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
-use FS::SessionClient;
+#use FS::SessionClient;
+#sigh, "not running as the freeside user"
$loaded = 1;
print "ok 1\n";