From ace9726c5346ee68c55b18932a512a3e3e388025 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Wed, 5 Jan 2022 00:31:29 +0000 Subject: [PATCH] Try to fix auto-locking (only for nodes) Not users as well. Sheesh. --- Changes | 3 +++ perl/DXProtHandle.pm | 63 ++++++++++++++++++++------------------------ 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/Changes b/Changes index 7b5e4fff..93ff18bb 100644 --- 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 diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index fcff6240..979a619a 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -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); -- 2.43.0