]> dxcluster.net Git - spider.git/commitdiff
fix DXCommandmode::run_cmd to detect errors earlier
authorDirk Koopman <djk@tobit.co.uk>
Tue, 19 Feb 2008 17:10:50 +0000 (17:10 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 19 Feb 2008 17:10:50 +0000 (17:10 +0000)
Also fix localhost detection better both for IPV4 and IPV6 systems.
Add CTY1801 cty changes.

Changes
data/cty.dat
data/prefix_data.pl
perl/DXCommandmode.pm
perl/ExtMsg.pm
perl/Version.pm

diff --git a/Changes b/Changes
index 4066aee45bec3a970d17d5607488f3bda89e3e66..48c17ba80836a8848a311f35b2d73ad43a7df342 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+19Feb08=======================================================================
+1. Added CTY-1801 cty.dat data.
+2. Fix problem with entering non-ascii data and then executing commands that
+are guessed from the "cleaned up" version of the string. Now if you enter
+commands with invalid characters, it will error immediately.
+3. fix a problem detecting IPV4 localhost on IPV6 enabled systems.
 10Feb08=======================================================================
 1. sort sh/node output. Also show more information.
 05Feb08=======================================================================
index 429dfcbef852990dbfcc83a6a2fe4b3a539bde8b..16a953773794fd9317940dbce410d57c2adde908 100644 (file)
@@ -19,7 +19,7 @@ Fiji:                     32:  56:  OC:  -18.10:  -178.40:   -12.0:  3D2:
 Conway Reef:              32:  56:  OC:  -21.40:  -174.40:   -13.0:  3D2/c:
     3D2CI,3D2CY;
 Rotuma:                   32:  56:  OC:  -12.30:  -177.70:   -12.0:  3D2/r:
-    3D2RR,3D2RX;
+    3D2AG/P,3D2RR,3D2RX;
 Swaziland:                38:  57:  AF:  -26.30:   -31.10:    -2.0:  3DA:
     3DA;
 Tunisia:                  33:  37:  AF:   36.80:   -10.20:    -1.0:  3V:
@@ -54,7 +54,7 @@ Israel:                   20:  39:  AS:   31.80:   -35.20:    -2.0:  4X:
 Libya:                    34:  38:  AF:   32.50:   -12.50:    -2.0:  5A:
     5A;
 Cyprus:                   20:  39:  AS:   35.20:   -33.40:    -2.0:  5B:
-    5B,C4,H2,P3;
+    5B,C4,EURO,H2,P3;
 Tanzania:                 37:  53:  AF:   -7.00:   -39.50:    -3.0:  5H:
     5H,5I;
 Nigeria:                  35:  46:  AF:    6.50:    -3.40:    -1.0:  5N:
@@ -339,7 +339,7 @@ Shetland:                 14:  27:  EU:   60.40:     1.50:     0.0:  *GM/s:
     GM4SLV,GM4SSA,GM4SWU,GM4WXQ,GM4ZHL,GM7AFE,GM7GWW,GM8LNH,GM8MMA,GM8YEC,
     MM0LSM,MM0XAU,MM0ZAL,MM1FJM,MM3VQO,MM5PSL,MS0ZCG;
 Guernsey:                 14:  27:  EU:   49.50:     2.70:     0.0:  GU:
-    2P,2U,GP,GU,MP,MU,GB0GUC,GB0JAG,GB0ON,GB2ECG,GB2GU,GB50LIB;
+    2P,2U,GP,GU,MP,MU,GB0GUC,GB0JAG,GB0ON,GB0U,GB2ECG,GB2GU,GB50LIB;
 Wales:                    14:  27:  EU:   51.50:     3.20:     0.0:  GW:
     2C,2W,2X,2Y,GC,GW,MC,MW,GB0CCE,GB0CLC,GB0CVA,GB0GCR,GB0GIW,GB0GLV,GB0HEL,
     GB0HMT,GB0ML,GB0MPA,GB0MWL,GB0NEW,GB0PSG,GB0RPO,GB0RSC,GB0SDD,GB0SH,
@@ -450,9 +450,9 @@ United States:            05:  08:  NA:   43.00:    87.90:     5.0:  K:
     KH6QAI(3)[6],KH6QAJ(3)[6],KH6RW(3)[6],KI6DY(4)[7],KK9A(5),KL0ET(4)[8],
     KL0LN(4)[8],KL1IF(4)[8],KL7FDQ(3)[6],KL7WP(3)[6],KL7XX(4)[8],KM4FO(4),
     KM6JD(5)[8],KN4Q(4),KN4QS(4)[7],KN5H(3)[6],KN6RO(5)[8],KN8J(5),KO7X(4)[7],
-    KP2N(5)[8],KP4E(4)[8],KS7T(4)[6],KU1CW(4)[7],KU8E(5),KY1V(4),KY4AA(4),
-    KY4Z(4)[7],N0AX(3)[6],N1LN(4)[7],N1SZ(4)[7],N1WI(4),N1ZP(4),N2BJ(4),
-    N2BJL(5),N2IC(4)[7],N2LA(4)[7],N2NB(3)[6],N2WN(4),N3AIU(4)[7],N3BB(4)[7],
+    KP2N(5)[8],KS7T(4)[6],KU1CW(4)[7],KU8E(5),KY1V(4),KY4AA(4),KY4Z(4)[7],
+    N0AX(3)[6],N1LN(4)[7],N1SZ(4)[7],N1WI(4),N1ZP(4),N2BJ(4),N2BJL(5),
+    N2IC(4)[7],N2LA(4)[7],N2NB(3)[6],N2WN(4),N3AIU(4)[7],N3BB(4)[7],
     N3ZZ(3)[6],N4CVO(4),N4DD(4),N4DW(4),N4GK(4),N4GN(4),N4IR(4),N4IRR(5),
     N4JF(4),N4KG(4),N4KZ(4),N4NO(4),N4OGW(4)[7],N4QS(4),N4SL(3)[6],N4TN(4),
     N4TZ(4),N4UW(4),N4VV(4),N4XM(4),N4ZZ(4),N6AR(5)[8],N6MW(5)[8],N6MWA(3)[6],
@@ -462,20 +462,21 @@ United States:            05:  08:  NA:   43.00:    87.90:     5.0:  K:
     NH7C(5)[8],NJ4I(4),NL7AU(5)[8],NL7CO(4)[7],NL7XM(5)[8],NP3D(5)[8],NQ4U(4),
     NU4B(4),NU4BP(5),NW7MT(4)[6],NW8U(5),NX9T(5),NY4N(4),NY6DX(5)[8],
     W0RLI(3)[6],W0UCE(5)[8],W0YK(3)[6],W0YR(5)[8],W0YRN(4)[7],W0ZZ(3)[6],
-    W0ZZQ(4)[7],W1DY(4)[7],W1DYH(5)[8],W1DYJ(5)[8],W1MVY(3)[6],W1RH(3)[6],
-    W1SRD(3)[6],W2OO(4),W2VJN(3)[6],W3CP(3)[6],W3HDH(4),W4BCG(4),W4CID(4),
-    W4DAN(4),W4DHE(4),W4DVG(4),W4EEH(4),W4EF(3)[6],W4FMS(4),W4GKM(4),W4HZD(4),
-    W4JSI(4),W4KW(4),W4LC(4),W4LIA(4),W4NBS(4),W4NI(4),W4NTI(4),W4NZ(4),
-    W4PA(4),W4RYW(4),W4TDB(4),W4TYU(4),W4YOK(4)[7],W5KI(5)[8],W5REA(5)[8],
-    W6AAN(5)[8],W6DSQ(4)[8],W6FC(5)[8],W6IHG(5)[8],W6JV(5)[8],W6LFB(4)[7],
-    W6NWS(5)[8],W6TER(4)[7],W6UB(4)[8],W6XR(5)[8],W6YJ(4)[7],W7FG(4)[7],
-    W7LPF(5)[8],W7LR(4)[6],W7LRD(3)[6],W7QF(5)[8],W7SE(4)[7],W8AEF(3)[6],
-    W8FJ(5),W8HGH(5),W8TN(5),W8WEJ(5),W8ZA(5),W9GE(5),W9GEN(4),W9IGJ(5),
-    W9MAK(3)[6],W9NGA(3)[6],WA0KDS(3)[6],WA1FCN(4),WA1MKE(4),WA1UJU(4),
-    WA2MNO(4)[7],WA4GLH(4),WA4JA(4),WA4OSD(4),WA5VGI(3)[6],WA8WV(5),WB2ORD(4),
-    WB4YDL(4),WB4ZBI(4),WB6BWZ(5)[8],WB8YQJ(3)[6],WB8YYY(5),WD4K(4),WD4OHD(4),
-    WG7Y(4)[7],WH0AI(4)[8],WH6ASW/M(3)[6],WJ9B(5),WL7BPY(4)[7],WL7K(3)[6],
-    WN4M(4),WO4O(4),WO5D(5)[8],WP4JBG(4)[8],WS4Y(4)[7],WT5L(5)[8],WX4TM(4);
+    W0ZZQ(4)[7],W1AA/MSC(5)[8],W1DY(4)[7],W1DYH(5)[8],W1DYJ(5)[8],W1MVY(3)[6],
+    W1RH(3)[6],W1SRD(3)[6],W2OO(4),W2VJN(3)[6],W3CP(3)[6],W3HDH(4),W4BCG(4),
+    W4CID(4),W4DAN(4),W4DHE(4),W4DVG(4),W4EEH(4),W4EF(3)[6],W4FMS(4),W4GKM(4),
+    W4HZD(4),W4JSI(4),W4KW(4),W4LC(4),W4LIA(4),W4NBS(4),W4NI(4),W4NTI(4),
+    W4NZ(4),W4PA(4),W4RYW(4),W4TDB(4),W4TYU(4),W4YOK(4)[7],W5KI(5)[8],
+    W5REA(5)[8],W6AAN(5)[8],W6DSQ(4)[8],W6FC(5)[8],W6IHG(5)[8],W6JV(5)[8],
+    W6LFB(4)[7],W6NWS(5)[8],W6TER(4)[7],W6UB(4)[8],W6XR(5)[8],W6YJ(4)[7],
+    W7FG(4)[7],W7LPF(5)[8],W7LR(4)[6],W7LRD(3)[6],W7QF(5)[8],W7SE(4)[7],
+    W8AEF(3)[6],W8FJ(5),W8HGH(5),W8TN(5),W8WEJ(5),W8ZA(5),W9GE(5),W9GEN(4),
+    W9IGJ(5),W9MAK(3)[6],W9NGA(3)[6],WA0KDS(3)[6],WA1FCN(4),WA1MKE(4),
+    WA1UJU(4),WA2MNO(4)[7],WA4GLH(4),WA4JA(4),WA4OSD(4),WA5VGI(3)[6],WA8WV(5),
+    WB2ORD(4),WB4YDL(4),WB4ZBI(4),WB6BWZ(5)[8],WB8YQJ(3)[6],WB8YYY(5),WD4K(4),
+    WD4OHD(4),WG7Y(4)[7],WH0AI(4)[8],WH6ASW/M(3)[6],WJ9B(5),WL7BPY(4)[7],
+    WL7K(3)[6],WN4M(4),WO4O(4),WO5D(5)[8],WP4JBG(4)[8],WS4Y(4)[7],WT5L(5)[8],
+    WX4TM(4);
 Guantanamo Bay:           08:  11:  NA:   19.90:    75.20:     5.0:  KG4:
     KG4,KG44;
 Mariana Is.:              27:  64:  OC:   15.20:  -145.80:   -10.0:  KH0:
@@ -676,7 +677,7 @@ Mali:                     35:  46:  AF:   12.70:     8.00:     0.0:  TZ:
     TZ;
 European Russia:          16:  29:  EU:   55.80:   -37.60:    -3.0:  UA:
     R,RD4W[30],RK4W[30],RM4W[30],RN4W[30],RU4W[30],RV4W[30],RW4W[30],U,
-    UA4W[30],R7C,R7C/1,R7C/3,R7C/4;
+    UA4W[30],R245GS,R7C,R7C/1,R7C/3,R7C/4;
 Kaliningrad:              15:  29:  EU:   55.00:   -20.50:    -2.0:  UA2:
     R2,RA2,RB2,RC2,RD2,RE2,RF2,RG2,RH2,RI2,RJ2,RK2,RL2,RM2,RN2,RO2,RP2,RQ2,
     RR2,RS2,RT2,RU2,RV2,RW2,RX2,RY2,RZ2,U2,UA2,UB2,UC2,UD2,UE2,UF2,UG2,UH2,
@@ -764,7 +765,7 @@ Canada:                   05:  09:  NA:   45.00:    80.00:     4.0:  VE:
     VE2III(2),VE2IM(2),VE2KK(2),VE2MTA(2),VE2MTB(2),VE2NN(2),VE2NRK(2),
     VE2PR(2),VE2QRZ(2),VE2RB(2),VE2TVU(2),VE2UA(2),VE2VH(2),VE2WDX(2),
     VE2WT(2),VE2XAA/2(2),VE2XY(2),VE2YM(2),VE2Z(2),VE2ZC(5),VE2ZM(5),VE2ZV(5),
-    VE3EY/2(2),VE3NE/2(2),VE3RHJ/2(2),VE8AJ(2),VE8PW(2),VE8RCS(2),VER20080110,
+    VE3EY/2(2),VE3NE/2(2),VE3RHJ/2(2),VE8AJ(2),VE8PW(2),VE8RCS(2),VER20080212,
     VY0AA(4)[3],VY0PW(4)[3],VY2MGY/3(4)[4];
 Australia:                30:  59:  OC:  -22.00:  -135.00:   -10.0:  VK:
     AX,VH,VI,VJ,VK,VL,VM,VN,VZ;
@@ -782,7 +783,7 @@ Mellish Reef:             30:  56:  OC:  -17.60:  -155.80:   -10.0:  VK9M:
 Norfolk I.:               32:  60:  OC:  -29.00:  -168.00:   -11.5:  VK9N:
     AX9,VH9,VI9,VJ9,VK9,VK9CN,VL9,VM9,VN9,VZ9;
 Willis I.:                30:  55:  OC:  -16.30:  -149.50:   -10.0:  VK9W:
-    AX9W,VH9W,VI9W,VJ9W,VK9FW,VK9KW,VK9W,VL9W,VM9W,VN9W,VZ9W;
+    AX9W,VH9W,VI9W,VJ9W,VK9FW,VK9KW,VK9W,VL9W,VM9W,VN9W,VZ9W,VK9DWX;
 Christmas I.:             29:  54:  OC:  -10.50:  -105.70:    -7.0:  VK9X:
     AX9X,VH9X,VI9X,VJ9X,VK9FX,VK9KX,VK9X,VL9X,VM9X,VN9X,VZ9X;
 Anguilla:                 08:  11:  NA:   18.30:    63.00:     4.0:  VP2E:
@@ -802,7 +803,7 @@ Falkland Is.:             13:  16:  SA:  -51.70:    57.90:     4.0:  VP8:
 South Georgia:            13:  73:  SA:  -54.30:    36.80:     2.0:  VP8/g:
     VP8DKX,VP8SGK;
 South Shetland:           13:  73:  SA:  -62.00:    58.30:     4.0:  VP8/h:
-    DT8A,HF0POL,HL8KSJ,LU/R1ANF,LU1ZC,LZ0A,R1ANF,VP8/LZ1UQ,VP8DJK;
+    DT8A,ED3RKL,HF0POL,HL8KSJ,LU/R1ANF,LU1ZC,LZ0A,R1ANF,VP8/LZ1UQ,VP8DJK;
 South Orkney:             13:  73:  SA:  -60.00:    45.50:     3.0:  VP8/o:
     AY1ZA,LU1ZA,LU2ERA/Z;
 South Sandwich:           13:  73:  SA:  -57.00:    26.70:     2.0:  VP8/s:
index b8c840add89d6097a608e022d92b5c301252a292..facaada8a829434d3d489ade3bc54d6681235146 100644 (file)
@@ -34,6 +34,7 @@
   '3D2/C' => '311',
   '3D2/F' => '268',
   '3D2/R' => '314',
+  '3D2AG/P' => '314',
   '3D2CI' => '311',
   '3D2CY' => '311',
   '3D2RR' => '314',
   'EC8' => '36',
   'EC9' => '347,348',
   'ED' => '34',
+  'ED3RKL' => '208',
   'ED5ON/6' => '35',
   'ED6' => '35',
   'ED8' => '36',
   'ES' => '190',
   'ET' => '41',
   'EU' => '178',
+  'EURO' => '278',
   'EV' => '178',
   'EW' => '178',
   'EX' => '186',
   'GB0TCH' => '62',
   'GB0TD' => '66',
   'GB0TTT' => '66',
+  'GB0U' => '65',
   'GB0WCY' => '61',
   'GB0WOA' => '62',
   'GB0WRC' => '66',
   'KP2N' => '220',
   'KP3' => '115',
   'KP4' => '115',
-  'KP4E' => '220',
   'KP5' => '116',
   'KQ0' => '468,474,478,485,486,490,491,503',
   'KQ1' => '469,481,483,492,501,508',
   'R1FJ' => '174',
   'R1MV' => '312',
   'R2' => '175',
+  'R245GS' => '173,419,420,421,422',
   'R3' => '420',
   'R30ZF' => '176,426,431',
   'R35NP' => '176,426,431',
   'VE8PW' => '191',
   'VE8RCS' => '191',
   'VE9' => '437',
-  'VER20080110' => '191',
+  'VER20080212' => '191',
   'VERSION' => '537',
   'VF' => '435',
   'VF0' => '191',
   'VK9C' => '195',
   'VK9CL' => '193',
   'VK9CN' => '197',
+  'VK9DWX' => '198',
   'VK9FC' => '195',
   'VK9FL' => '193',
   'VK9FM' => '196',
   'W0ZZ' => '220',
   'W0ZZQ' => '220',
   'W1' => '469,481,483,492,501,508',
+  'W1AA/MSC' => '220',
   'W1DY' => '220',
   'W1DYH' => '220',
   'W1DYJ' => '220',
index a00e0be808a9d19afb85db07f9f2b3da7c1b54a0..0a42e510852834fede44e4417b7904dcfb45de0a 100644 (file)
@@ -484,6 +484,20 @@ sub send_ans
                }
        } 
 }
+
+sub _error_out
+{
+       my $self = shift;
+       my $e = shift;
+       if (++$self->{errors} > $maxerrors) {
+               $self->send($self->msg('e26'));
+               $self->disconnect;
+               return ();
+       } else {
+               return ($self->msg($e));
+       }
+}
+
 # 
 # this is the thing that runs the command, it is done like this for the 
 # benefit of remote command execution
@@ -497,19 +511,22 @@ sub run_cmd
        my $cmdline = shift;
        my @ans;
        
-
        return () if length $cmdline == 0;
        
-       
        # split the command line up into parts, the first part is the command
        my ($cmd, $args) = split /\s+/, $cmdline, 2;
        $args = "" unless defined $args;
                
        if ($cmd) {
+
+               # check cmd
+               if ($cmd =~ m|^/| || $cmd =~ m|[^-?\w/]|) {
+                       LogDbg('DXCommand', "cmd: invalid characters in '$cmd'");
+                       return $self->_error_out('e1');
+               }
+
                # strip out // on command only
                $cmd =~ s|//|/|g;
-               $cmd =~ s|^/||g;                # no leading / either
-               $cmd =~ s|[^-?\w/]||g;          # and no funny characters either
                                        
                my ($path, $fcmd);
                        
@@ -520,7 +537,7 @@ sub run_cmd
                if ($acmd) {
                        ($cmd, $args) = split /\s+/, "$acmd $args", 2;
                        $args = "" unless defined $args;
-                       dbg("aliased cmd: $cmd $args") if isdbg('command');
+                       dbg("cmd: aliased $cmd $args") if isdbg('command');
                }
                        
                # first expand out the entry to a command
@@ -528,26 +545,23 @@ sub run_cmd
                ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
 
                if ($path && $cmd) {
-                       dbg("path: $cmd cmd: $fcmd") if isdbg('command');
+                       dbg("cmd: path $cmd cmd: $fcmd") if isdbg('command');
                        
                        my $package = find_cmd_name($path, $fcmd);
                        return ($@) if $@;
                                
-                       if ($package) {
+                       if ($package && DXCommandmode->can($package)) {
                                no strict 'refs';
-                               dbg("package: $package") if isdbg('command');
+                               dbg("cmd: package $package") if isdbg('command');
                                eval { @ans = &$package($self, $args) };
                                return (DXDebug::shortmess($@)) if $@;
+                       } else {
+                               dbg("cmd: $package not present") if isdbg('command');
+                               return $self->_error_out('e1');
                        }
                } else {
                        dbg("cmd: $cmd not found") if isdbg('command');
-                       if (++$self->{errors} > $maxerrors) {
-                               $self->send($self->msg('e26'));
-                               $self->disconnect;
-                               return ();
-                       } else {
-                               return ($self->msg('e1'));
-                       }
+                       return $self->_error_out('e1');
                }
        }
        
@@ -831,14 +845,15 @@ sub find_cmd_name {
                no strict 'refs';
 
                if (exists $Cache{$package}) {
-                       dbg("Redefining $package") if isdbg('command');
+                       dbg("find_cmd_name: Redefining $package") if isdbg('command');
                        undef *$package;
                } else {
-                       dbg("Defining $package") if isdbg('command');
+                       dbg("find_cmd_name: Defining $package") if isdbg('command');
                }
+
                eval $eval;
-               
-               $Cache{$package} = {mtime => $mtime };
+
+               $Cache{$package} = {mtime => $mtime } unless $@;
            
        }
 
index dd97475aaa6a336be70186f2155e629f708d2f30..ae50f036568c57a02596f1d70b40c38260289876 100644 (file)
@@ -104,7 +104,7 @@ sub dequeue
                                $msg = uc $msg;
                                if (is_callsign($msg) && $msg !~ m|/| ) {
                                        my $sort = $conn->{csort};
-                                       $sort = 'local' if $conn->{peerhost} eq "127.0.0.1";
+                                       $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);
@@ -126,7 +126,7 @@ sub dequeue
                                        my $sort = $conn->{csort};
                                        $conn->{echo} = $conn->{decho};
                                        delete $conn->{decho};
-                                       $sort = 'local' if $conn->{peerhost} eq "127.0.0.1";
+                                       $sort = 'local' if $conn->{peerhost} =~ /127\.\d+\.\d+\.\d+$/ || $conn->{peerhost} eq '::1';
                                        $conn->{usedpasswd} = 1;
                                        $conn->to_connected($conn->{call}, 'A', $sort);
                                } else {
index e832e37d5eb89dcd9ce06ffbc626f4830d549174..4c97d8866f4d78a1519c2404eba22f7ac5daa647 100644 (file)
@@ -11,6 +11,6 @@ use vars qw($version $subversion $build);
 
 $version = '1.54';
 $subversion = '0';
-$build = '205';
+$build = '206';
 
 1;