]> scm.dxcluster.org Git - spider.git/commitdiff
Try to fix auto-locking (only for nodes)
authorDirk Koopman <djk@tobit.co.uk>
Wed, 5 Jan 2022 00:31:29 +0000 (00:31 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 5 Jan 2022 00:31:29 +0000 (00:31 +0000)
Not users as well. Sheesh.

Changes
perl/DXProtHandle.pm

diff --git a/Changes b/Changes
index 7b5e4fff1b3747c5186827783e985b77802f1c39..93ff18bbdf95f0348be3943ca10ce777a474f300 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,6 +3,9 @@
    contain trailing / in callsigns like: OH0K/6, K2PO/7 etc.
 2. Regard strange callsigns like DR4W-HB (seen in skimmer spots) as invalid. 
    This *should be* something like HB9/DR4W or (spit) DR4W/HB9.
+3. Fix the (probably) spurious locking out of users that are unknown to this 
+   node, that come in from other nodes. These create new user records which
+   where then automatically locked.  
 03Jan22=======================================================================
 1. Allow overrides (on modern versions of perl) with things in DXVars.pm, such
    $clusterport. This is really only of use for people trying to run more than
index fcff6240ae5291158dccf1dd14380d43b726ef5c..979a619a3050b92976632769c0ac0b141f013a81 100644 (file)
@@ -763,23 +763,27 @@ sub handle_18
        $self->send(pc20());
 }
 
-sub check_add_node
+sub check_add_user
 {
        my $call = shift;
        my $type = shift;
-       
+       my $homenode = shift;
 
        # add this station to the user database, if required (don't remove SSID from nodes)
        my $user = DXUser::get_current($call);
        unless ($user) {
                $user = DXUser->new($call);
-               $user->priv(1);         # I have relented and defaulted nodes
-               $user->lockout(1);
-               $user->homenode($call);
-               $user->node($call);
-               $user->sort($type || 'A');
+               $user->sort($type || 'U');
+               if ($user->is_node) {
+                       $user->priv(1);         # I have relented and defaulted nodes
+                       $user->lockout(1) if $user->is_node;
+               } else {
+                       $user->homenode($homenode) if $homenode;
+                       $user->node($homenode);
+               }
                $user->lastin($main::systime); # this make it last longer than just this invocation
                $user->put;                             # just to make sure it gets written away!!!
+               dbg("DXProt: PC92 new user record for $call created");
        }
        return $user;
 }
@@ -855,7 +859,7 @@ sub handle_19
                        next;
                }
 
-               my $user = check_add_node($call);
+               my $user = check_add_user($call, 'A');
 
 #              if (eph_dup($genline)) {
 #                      dbg("PCPROT: dup PC19 for $call detected") if isdbg('chanerr');
@@ -1599,42 +1603,31 @@ sub _add_thingy
                my $ncall = $parent->call;
                if ($ncall ne $call) {
                        my $user;
-                       unless (DXChannel::get($call)) { # i.e. external entity - create an user entry for it - ALL entities will appear in ALL user files from now on.
-                               $user = DXUser::get($call);
-                               unless ($user) {
-                                       $user = DXUser->new($call);
-                                       dbg("PCProt::_add_thingy new user $call") if isdbg('route');
-                               }
-                       }
+                       my $r;
+                       
                        if ($is_node) {
                                dbg("ROUTE: added node $call to $ncall") if isdbg('routelow');
+                               $user = check_add_user($call, 'A');
                                @rout = $parent->add($call, $version, Route::here($here), $ip);
-                               my $r = Route::Node::get($call);
+                               $r = Route::Node::get($call);
                                $r->PC92C_dxchan($dxchan->call, $hops) if $r;
-                               if ($ip) {
-                                       $r->ip($ip);
-                                       Log('DXProt', "PC92A $call -> $ip on $ncall");
-                               }
-                               if ($user && $user->sort eq 'U') {
-                                       if (defined $version) {
-                                               if ($version >= 5455 && $build > 0 || $version >= 3000 ) {
-                                                       $user->sort('S');
-                                               } else {
-                                                       $user->sort('A');
-                                               }
-                                               dbg("PCProt::_add_thingy node $call sort updated " . $user->sort) if isdbg('route');
-                                       }
+                               if ($version) {
+                                       my $old = $user->sort;
+                                       if ($version >= 5455 && defined $build && $build > 0 || $version >= 3000 ) {
+                                               $user->sort('S');
+                                               dbg("PCProt::_add_thingy node $call sort ($old) updated to " . $user->sort) if isdbg('route');
+                                       } 
                                }
                        } else {
                                dbg("ROUTE: added user $call to $ncall") if isdbg('routelow');
-                               my $user = check_add_node($call, 'U');
+                               $user = check_add_user($call, 'U', $parent->call);
                                @rout = $parent->add_user($call, Route::here($here), $ip);
                                $dxchan->tell_buddies('loginb', $call, $ncall) if $dxchan;
-                               my $r = Route::User::get($call);
-                               if ($ip) {
-                                       $r->ip($ip);
-                                       Log('DXProt', "PC92A $call -> $ip on $ncall");
-                               }
+                               $r = Route::User::get($call);
+                       }
+                       if ($ip) {
+                               $r->ip($ip);
+                               Log('DXProt', "PC92A $call -> $ip on $ncall");
                        }
                        if ($pc92_slug_changes && $parent == $main::routeroot) {
                                $things_add{$call} = Route::get($call);