X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcluster.pl;h=205d2fe7633060eac89f6df4f7d329b775b75e33;hb=759df8855ee49f596b8b55a95b93a0ca1c9b78b7;hp=16458073b837bf7005718fac05fe2b66e5af7aa6;hpb=892f669f9791273b2cb73d7421184f83acd5c609;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index 16458073..205d2fe7 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -23,6 +23,14 @@ BEGIN { unshift @INC, "$root/perl"; # this IS the right way round! unshift @INC, "$root/local"; + # do some validation of the input + die "The directory $root doesn't exist, please RTFM" unless -d $root; + die "$root/local doesn't exist, please RTFM" unless -d "$root/local"; + die "$root/local/DXVars.pm doesn't exist, please RTFM" unless -e "$root/local/DXVars.pm"; + + mkdir "$root/local_cmd" unless -e "$root/local_cmd"; + + # try to create and lock a lockfile (this isn't atomic but # should do for now $lockfn = "$root/perl/cluster.lck"; # lock file name @@ -293,7 +301,7 @@ sub process_inqueue while (@inqueue) { my $self = shift @inqueue; return if !$self; - + my $data = $self->{data}; my $dxchan = $self->{dxchan}; my $error; @@ -302,16 +310,20 @@ sub process_inqueue # do the really sexy console interface bit! (Who is going to do the TK interface then?) dbg("<- $sort $call $line\n") if $sort ne 'D' && isdbg('chan'); - + if ($self->{disconnecting}) { + dbg('In disconnection, ignored'); + next; + } + # handle A records my $user = $dxchan->user; if ($sort eq 'A' || $sort eq 'O') { $dxchan->start($line, $sort); } elsif ($sort eq 'I') { die "\$user not defined for $call" if !defined $user; + # normal input $dxchan->normal($line); - $dxchan->disconnect if ($dxchan->{state} eq 'bye'); } elsif ($sort eq 'Z') { $dxchan->disconnect; } elsif ($sort eq 'D') { @@ -363,7 +375,7 @@ $build = "$build.$branch" if $branch; Log('cluster', "DXSpider V$version, build $build started"); # banner -dbg("Copyright (c) 1998-2001 Dirk Koopman G1TLH"); +dbg("Copyright (c) 1998-2002 Dirk Koopman G1TLH"); dbg("DXSpider Version $version, build $build started"); # load Prefixes @@ -378,6 +390,14 @@ Bands::load(); dbg("loading user file system ..."); DXUser->init($userfn, 1); +# look for the sysop and the alias user and complain if they aren't there +{ + my $ref = DXUser->get($mycall); + die "$mycall missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; + $ref = DXUser->get($myalias); + die "$myalias missing, run the create_sysop.pl script and please RTFM" unless $ref && $ref->priv == 9; +} + # start listening for incoming messages/connects dbg("starting listeners ..."); my $conn = IntMsg->new_server($clusteraddr, $clusterport, \&login);