projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
import Net::Whois::Raw into install/5.005 directory *sigh*
[freeside.git]
/
fs_selfservice
/
FS-SelfService
/
freeside-selfservice-clientd
diff --git
a/fs_selfservice/FS-SelfService/freeside-selfservice-clientd
b/fs_selfservice/FS-SelfService/freeside-selfservice-clientd
index
438d472
..
ce9e14d
100644
(file)
--- a/
fs_selfservice/FS-SelfService/freeside-selfservice-clientd
+++ b/
fs_selfservice/FS-SelfService/freeside-selfservice-clientd
@@
-9,23
+9,25
@@
use subs qw(spawn logmsg lock_write unlock_write);
use Fcntl qw(:flock);
use POSIX qw(:sys_wait_h);
use Socket;
use Fcntl qw(:flock);
use POSIX qw(:sys_wait_h);
use Socket;
-use Storable qw(nstore_fd fd_retrieve);
+use Storable
2.09
qw(nstore_fd fd_retrieve);
use IO::Handle qw(_IONBF);
use IO::Select;
use IO::File;
#STDOUT->setbuf('');
use IO::Handle qw(_IONBF);
use IO::Select;
use IO::File;
#STDOUT->setbuf('');
+my $tag = scalar(@ARGV) ? '.'.shift : '';
+
use vars qw( $Debug );
use vars qw( $Debug );
-$Debug =
3
; #2 will turn on child logging, 3 will log packet contents,
+$Debug =
2
; #2 will turn on child logging, 3 will log packet contents,
#including potentially compromising information
#including potentially compromising information
-my $socket = "/usr/local/freeside/selfservice_socket";
+my $socket = "/usr/local/freeside/selfservice_socket
$tag
";
my $pid_file = "$socket.pid";
my $pid_file = "$socket.pid";
-my $log_file = "/usr/local/freeside/selfservice.log";
+my $log_file = "/usr/local/freeside/selfservice
$tag
.log";
-my $lock_file = "/usr/local/freeside/selfservice.writelock";
+my $lock_file = "/usr/local/freeside/selfservice
$tag
.writelock";
#my $me = '[client]';
#my $me = '[client]';
@@
-143,22
+145,22
@@
while (1) {
#handle some commands weirdly?
$packet->{_token}=$$;
#handle some commands weirdly?
$packet->{_token}=$$;
- warn "[child-$$] locking write stream" if $Debug > 1;
+ warn "[child-$$] locking write stream
\n
" if $Debug > 1;
lock_write;
lock_write;
- warn "[child-$$] sending packet to remote server" if $Debug > 1;
+ warn "[child-$$] sending packet to remote server
\n
" if $Debug > 1;
nstore_fd($packet, \*STDOUT) or die "FATAL: can't send response: $!";
nstore_fd($packet, \*STDOUT) or die "FATAL: can't send response: $!";
- warn "[child-$$] flushing write stream" if $Debug > 1;
+ warn "[child-$$] flushing write stream
\n
" if $Debug > 1;
STDOUT->flush or die "FATAL: can't flush: $!";
STDOUT->flush or die "FATAL: can't flush: $!";
- warn "[child-$$] releasing write lock" if $Debug > 1;
+ warn "[child-$$] releasing write lock
\n
" if $Debug > 1;
unlock_write;
unlock_write;
- warn "[child-$$] closing write stream" if $Debug > 1;
+ warn "[child-$$] closing write stream
\n
" if $Debug > 1;
close STDOUT or die "FATAL: can't close write stream: $!"; #??!
close STDOUT or die "FATAL: can't close write stream: $!"; #??!
- warn "[child-$$] waiting for response from parent" if $Debug > 1;
+ warn "[child-$$] waiting for response from parent
\n
" if $Debug > 1;
my $w = new IO::Select;
$w->add(\*STDIN);
until ( $w->can_read ) {
my $w = new IO::Select;
$w->add(\*STDIN);
until ( $w->can_read ) {
@@
-231,6
+233,7
@@
sub spawn {
sub _logmsg {
chomp( my $msg = shift );
my $log = new IO::File ">>$log_file";
sub _logmsg {
chomp( my $msg = shift );
my $log = new IO::File ">>$log_file";
+ die "can't open $log_file: $!" unless defined($log);
flock($log, LOCK_EX);
seek($log, 0, 2);
print $log "[client] [". scalar(localtime). "] [$$] $msg\n";
flock($log, LOCK_EX);
seek($log, 0, 2);
print $log "[client] [". scalar(localtime). "] [$$] $msg\n";