fix allowmultiple for real user with ssid
authorDirk Koopman <djk@tobit.co.uk>
Thu, 21 May 2020 13:23:55 +0000 (14:23 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Thu, 21 May 2020 13:23:55 +0000 (14:23 +0100)
and put back the missing code in DXUser::close to record login
times which allow multiple users to work in the first place!

perl/DXDebug.pm
perl/DXUser.pm
perl/cluster.pl

index 691c410122c99615e5043f0059ec0934c8349d81..b0b723ce00f161b0464a7929507eb853ca6da513 100644 (file)
@@ -87,7 +87,7 @@ my $_isdbg;                                           # current dbg level we are processing
 
 sub dbg($)
 {
-       return unless $fp;
+#      return unless $fp;
        my $t = time; 
        for (@_) {
                my $r = $_;
@@ -103,7 +103,7 @@ sub dbg($)
                                shift @dbgring while (@dbgring > $dbgringlth);
                                push @dbgring, $str;
                        }
-                       $fp->writeunix($t, $str) unless $dbglevel{"nolog$_isdbg"}
+                       $fp->writeunix($t, $str) unless !$fp || $dbglevel{"nolog$_isdbg"} 
                }
        }
        $_isdbg = '';
index 5e8f2dfab50abfb600c7fe128881e892a09b44cb..85a22195f9a08de314cf0389b194cb273d4db51c 100644 (file)
@@ -474,7 +474,10 @@ sub close
        my $ip = shift;
        $self->{lastin} = $main::systime;
        # add a record to the connect list
-#      $self->put();
+       my $ref = [$startt || $self->{startt}, $main::systime];
+       push @$ref, $ip if $ip;
+       push @{$self->{connlist}}, $ref;
+       shift @{$self->{connlist}} if @{$self->{connlist}} > $maxconnlist;
 }
 
 #
index 5baf02973ac49a4c385c95d7fc1dcf8121febd09..9735aa30b10b5a42649625ad42ef03ae40eb9f60 100755 (executable)
@@ -246,23 +246,28 @@ sub new_channel
                }
 
                # is he locked out ?
+               $user = DXUser::get_current($call);
                my $basecall = $call;
                $basecall =~ s/-\d+$//; # remember this for later multiple user processing
-               my $baseuser = DXUser::get_current($basecall);
-               my $lock = $user->lockout if $user;
-               if ($baseuser && $baseuser->lockout || $lock) {
-                       if (!$user || !defined $lock || $lock) {
-                               my $host = $conn->peerhost;
-                               LogDbg('DXCommand', "$call on $host is locked out, disconnected");
-                               $conn->disconnect;
-                               return;
-                       }
+               my $lock;
+               if ($user) {
+                       # we are a real user
+                       $lock = $user->lockout;
+               } elsif ($allowmultiple) {
+                       # could we be a potential "pseudo" connection   
+                       $user = DXUser::get_current($basecall);
+                       $lock = $user->lockout if $user;
+               }
+               if ($lock) {
+                       my $host = $conn->peerhost;
+                       LogDbg('DXCommand', "$call on $host is locked out, disconnected");
+                       $conn->disconnect;
+                       return;
                }
 
                # set up the basic channel info for "Normal" Users
                # is there one already connected to me - locally?
 
-               $user = DXUser::get_current($call);
                $dxchan = DXChannel::get($call);
                my $newcall = $call;
                if ($dxchan) {
@@ -298,7 +303,7 @@ sub new_channel
                                if ($bumpexisting) {
                                        my $ip = $dxchan->hostname;
                                        $dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
-                                       LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
+                                       Log('', "$call bumped off by $ip, disconnected");
                                        $dxchan->disconnect;
                                } else {
                                        already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));