remove leading 0 from ssids on login
authorDirk Koopman <djk@tobit.co.uk>
Mon, 3 Jan 2022 22:43:34 +0000 (22:43 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Mon, 3 Jan 2022 22:43:34 +0000 (22:43 +0000)
Changes
perl/DXUtil.pm
perl/ExtMsg.pm
perl/cluster.pl
perl/console.pl

diff --git a/Changes b/Changes
index 2441b64c51dc6e01ef2d2491615c6989b6c5cd17..e85130a541329ae806ba19ed72c0f99b6c7c3bd9 100644 (file)
--- 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 <ipaddr> for webclusters.
 2. Remove _add_thingy dbg message from general view.
index 6d115a7b6273540810e42bdb8ea6c1728951c153..96f0cb83af1b1e9ae1c3345356bed26a9e0c104e 100644 (file)
@@ -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;
+       
+}
index 74a2cfcd0dc8ea0c18956b005574899930ad91f2..a55de7e7600271846c0f6cf95523dedf727e401f 100644 (file)
@@ -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;
index d62b88b10840e291033e627f10b3e037b90b5698..bfd637c55f7aaa692ff4ca18e22b7d70b6bc7b23 100755 (executable)
@@ -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) {
index 32c6cf5f109d9e2cd6911d5ece1ebe6634640b27..3ad62001253fc2f8e6b97103287d186749820a41 100755 (executable)
@@ -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";
 }