From: Dirk Koopman Date: Mon, 3 Jan 2022 22:43:34 +0000 (+0000) Subject: remove leading 0 from ssids on login X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=36cf78e5660c745f32be2f1d63be738a0c537c48;p=spider.git remove leading 0 from ssids on login --- diff --git a/Changes b/Changes index 2441b64c..e85130a5 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,9 @@ 2. Fix who command to make RBN connections as RBN and not USER. 3. Prevent other nodes claiming that $myalias or $mycall is a different type (user or node) from changing our route table and thence the user type. +4. Normalise callsigns of incoming connections to G1TST if G1TST-0 or G1TST-00 + amd G1TST-2 if G1TST-02. There are 800+ instances of callsigns with extra + 0 characters in the SSID in my users file. Allow SSIDs up to 99. 02Jan22======================================================================= 1. Fix dx bug introduced to handle dx by ip for webclusters. 2. Remove _add_thingy dbg message from general view. diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 6d115a7b..96f0cb83 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -29,6 +29,7 @@ require Exporter; is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem is_prefix dd is_ipaddr $pi $d2r $r2d localdata localdata_mv diffms _diffms _diffus difft parraydifft is_ztime basecall + normalise_call ); @@ -601,3 +602,13 @@ sub basecall my ($r) = $_[0] =~ m|^(?:[\w\d]+/)?([\w\d]+).*$|; return $r; } + +sub normalise_call +{ + my ($c, $ssid) = $_[0] =~ m|^((?:[\w\d]+/)?[\d\w]+(?:/[\w\d]+)?)-?(\d+)?$|; + my $ncall = $c; + $ssid += 0; + $ncall .= "-$ssid" if $ssid; + return $ncall; + +} diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 74a2cfcd..a55de7e7 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -134,12 +134,13 @@ sub dequeue $conn->disconnect; } } elsif (is_callsign($msg)) { + my $call = normalise_call($msg); if ($main::allowslashcall || $msg !~ m|/|) { my $sort = $conn->{csort}; $sort = 'local' if $conn->{peerhost} =~ /127\.\d+\.\d+\.\d+$/ || $conn->{peerhost} eq '::1'; my $uref; - if ($main::passwdreq || ($uref = DXUser::get_current($msg)) && $uref->passwd ) { - $conn->conns($msg); + if ($main::passwdreq || ($uref = DXUser::get_current($call)) && $uref->passwd ) { + $conn->conns($call); $conn->{state} = 'WP'; $conn->{decho} = $conn->{echo}; $conn->{echo} = 0; diff --git a/perl/cluster.pl b/perl/cluster.pl index d62b88b1..bfd637c5 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -233,7 +233,8 @@ sub new_channel already_conn($conn, $call, "Maximum no of web connected connects ($Web::maxssid) exceeded"); return; } - $call = $newcall; + $call = normalise_call($newcall); + $user = DXUser::get_current($call); unless ($user) { $user = DXUser->new($call); @@ -255,6 +256,15 @@ sub new_channel $conn->send_now("C$call"); } else { # "Normal" connections + + # normalise calls like G1TST-0/G1TST-00/G1TST-01 to G1TST and G1TST-1 respectively + my $ncall = normalise_call($call); + if ($call ne $ncall) { + LogDbg('err', "new_channel login invalid $call converted to $ncall"); + $msg =~ s/$call/$ncall/; + $call = $ncall; + } + # is it a valid callsign (in format)? unless (is_callsign($call)) { already_conn($conn, $call, DXM::msg($lang, "illcall", $call)); return; @@ -262,8 +272,8 @@ sub new_channel # is he locked out ? my $lock; - $user = DXUser::get_current($call); $conn->conns($call); + $user = DXUser::get_current($call); my $basecall = $call; $basecall =~ s/-\d+$//; # remember this for later multiple user processing, it's used for other stuff than checking lockout status if ($user) { diff --git a/perl/console.pl b/perl/console.pl index 32c6cf5f..3ad62001 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -534,10 +534,11 @@ $call = uc shift @ARGV if @ARGV; $call = uc $myalias unless $call; $node = uc $mycall unless $node; +$call = normalise_call($call); my ($scall, $ssid) = split /-/, $call; $ssid = undef unless $ssid && $ssid =~ /^\d+$/; if ($ssid) { - $ssid = 15 if $ssid > 15; + $ssid = 99 if $ssid > 99; $call = "$scall-$ssid"; }