From: Dirk Koopman Date: Wed, 8 Dec 2021 22:28:20 +0000 (+0000) Subject: fix registration checking on call+ssid X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a9286080b21d5b65f97cab08d8a493abafad8f1;p=spider.git fix registration checking on call+ssid --- diff --git a/Changes b/Changes index 64977c69..35ec0ef1 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +08Nov21======================================================================= +1. Get to the bottom of why ssid'd calls were using the base call's + credentials. This should now work as expected. 06Nov21======================================================================= 1. Improve console.pl scrolling. Split long lines (eg on announcements. 04Nov21======================================================================= diff --git a/cmd/announce.pl b/cmd/announce.pl index 7f52a461..962aebb6 100644 --- a/cmd/announce.pl +++ b/cmd/announce.pl @@ -20,7 +20,7 @@ my ($self, $line) = @_; my @f = split /\s+/, $line; return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript; return (1, $self->msg('e9')) if !@f; -return (1, $self->msg('e28')) unless $self->registered; +return (1, $self->msg('e28')) unless $self->isregistered; my $sort = uc $f[0]; my $to = '*'; diff --git a/cmd/chat.pl b/cmd/chat.pl index b65ca928..13018765 100644 --- a/cmd/chat.pl +++ b/cmd/chat.pl @@ -13,7 +13,7 @@ my ($self, $line) = @_; my @f = split /\s+/, $line, 2; return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript; return (1, $self->msg('e34')) unless @f >= 1; -return (1, $self->msg('e28')) unless $self->registered; +return (1, $self->msg('e28')) unless $self->isregistered; my $target = uc $f[0]; diff --git a/cmd/dx.pl b/cmd/dx.pl index 97ed605f..27099f24 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -18,8 +18,10 @@ my $valid = 0; my $localonly; my $oline = $line; +#$DB::single=1; + return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript; -return (1, $self->msg('e28')) unless $self->registered; +return (1, $self->msg('e28')) unless $self->isregistered; my @bad; if (@bad = BadWords::check($line)) { @@ -60,7 +62,8 @@ my $ipaddr; my $addr = $self->hostname; if ($self->conn && $self->conn->peerhost) { - $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/; +# $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/; + $ipaddr = $addr; # force a PC61 } elsif ($self->inscript) { $ipaddr = "script"; } @@ -159,9 +162,10 @@ if ($freq =~ /^69/ || $localonly) { if ($ipaddr) { $spot = DXProt::pc61($spotter, $freq, $spotted, $line, $ipaddr); - } else { - $spot = DXProt::pc11($spotter, $freq, $spotted, $line); } + #else { + # $spot = DXProt::pc11($spotter, $freq, $spotted, $line); + #} $self->dx_spot(undef, undef, @spot); if ($self->isslugged) { diff --git a/cmd/reply.pl b/cmd/reply.pl index 292316b5..22f04b85 100644 --- a/cmd/reply.pl +++ b/cmd/reply.pl @@ -67,7 +67,7 @@ if ($self->state eq "prompt") { @extra = (); } - return (1, $self->msg('e28')) unless $self->registered || $to eq $main::myalias; + return (1, $self->msg('e28')) unless $self->isregistered || $to eq $main::myalias; $loc->{to} = [ $to, @extra ]; # to is an array $loc->{subject} = $oref->subject; diff --git a/cmd/send.pl b/cmd/send.pl index 08b2aa43..0fb91e10 100644 --- a/cmd/send.pl +++ b/cmd/send.pl @@ -39,7 +39,7 @@ if ($self->state eq "prompt") { # any thing after send? return (1, $self->msg('e6')) if !@f; - return (1, $self->msg('e28')) unless $self->registered || uc $f[0] eq $main::myalias; + return (1, $self->msg('e28')) unless $self->isregistered || uc $f[0] eq $main::myalias; while (@f) { my $f = uc shift @f; diff --git a/cmd/show/registered.pl b/cmd/show/registered.pl index 71ed0e38..4876aea2 100644 --- a/cmd/show/registered.pl +++ b/cmd/show/registered.pl @@ -62,6 +62,7 @@ sub generate } my @l; + push @out, "Registration is " . ($main::reqreg ? "Required" : "NOT Required"); foreach my $call (@val) { if (@l >= 5) { push @out, sprintf "%-14s %-14s %-14s %-14s %-14s", @l; diff --git a/cmd/talk.pl b/cmd/talk.pl index acd2eba5..dae38e24 100644 --- a/cmd/talk.pl +++ b/cmd/talk.pl @@ -33,7 +33,7 @@ return (1, $self->msg('e8')) unless $to; $to = uc $to; return (1, $self->msg('e22', $to)) unless is_callsign($to); -return (1, $self->msg('e28')) unless $self->registered || $to eq $main::myalias; +return (1, $self->msg('e28')) unless $self->isregistered || $to eq $main::myalias; $via = uc $via if $via; my $call = $via || $to; diff --git a/cmd/wx.pl b/cmd/wx.pl index 73e2e566..57147190 100644 --- a/cmd/wx.pl +++ b/cmd/wx.pl @@ -23,7 +23,7 @@ my $t = ztime(time); my $tonode; my $via; return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript; -return (1, $self->msg('e28')) unless $self->registered; +return (1, $self->msg('e28')) unless $self->isregistered; if ($sort eq "FULL") { $line =~ s/^$f[0]\s+//; # remove it diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index a5ae268b..13943472 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -147,13 +147,11 @@ sub start $user->wantusstate(0) unless defined $user->{wantusstate}; # sort out registration - if ($main::reqreg == 1) { - $self->{registered} = $user->registered; - } elsif ($main::reqreg == 2) { + if ($main::reqreg == 2) { $self->{registered} = !$user->registered; } else { - $self->{registered} = 1; - } + $self->{registered} = $user->registered; + } # establish slug queue, if required $self->{sluggedpcs} = []; @@ -1039,7 +1037,7 @@ sub format_dx_spot $comment = substr($comment, 0, $clth-3) . ' ' . $_[12] if $_[12]; } - return sprintf "DX de %-9.9s%9.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment; + return sprintf "DX de %-8.8s%10.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment; } @@ -1287,7 +1285,7 @@ sub send_motd my $self = shift; my $motd; - unless ($self->{registered}) { + unless ($self->isregistered) { $motd = "${main::motd}_nor_$self->{lang}"; $motd = "${main::motd}_nor" unless -e $motd; } @@ -1398,5 +1396,20 @@ sub user_count { return ($users, $maxusers); } + +sub isregistered +{ + my $self = shift; + + # the sysop is registered! + return 1 if $self->call eq $main::myalias || $self->call eq $main::mycall; + + if ($main::reqreg) { + return $self->{registered}; + } else { + return 1; + } +} + 1; __END__ diff --git a/perl/cluster.pl b/perl/cluster.pl index 55e0badb..9416a7f3 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -263,8 +263,8 @@ sub new_channel $lock = $user->lockout; } elsif ($basecall ne $call) { # if there isn't a SSID on the $call, then try the base - $user = DXUser::get_current($basecall); - $lock = $user->lockout if $user; + my $luser = DXUser::get_current($basecall); + $lock = $luser->lockout if $luser; } # now deal with the lock diff --git a/perl/console.pl b/perl/console.pl index faf7c5ce..c175122b 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -132,23 +132,6 @@ sub doresize do_initscr(); $inscroll = 0; - dbg("resize: l=$lines c=$cols"); - dbg("resize: sh=". scalar @sh ); -# my @tsh; -# my $t; -# while (defined ($t = shift @sh)) { -# dbg("t: $t(" , length $t . ')'); -# if ($t =~ /^\t/) { -# $t =~ s/^\t/ /; -# push(@tsh, pop(@tsh) . $t) -# } else { -# push(@tsh, $t); -# } -# dbg("tsh: " . scalar @tsh); -# } -# dbg("resize: tsh=". scalar @tsh ); -# $spos = @tsh < $pagel ? 0 : @tsh - $pagel; - # addtotop(@tsh); $spos = @sh < $pagel ? 0 : @sh - $pagel; show_screen(); $conn->send_later("C$call|$cols") if $conn; @@ -184,17 +167,6 @@ sub setattr } } -# measure the no of screen lines a line will take -sub measure -{ - my $line = shift; - return 0 unless $line; - - my $l = length $line; - my $lines = int ($l / $cols); - $lines++ if $l / $cols > $lines; - return $lines; -} # display the top screen sub show_screen @@ -203,11 +175,6 @@ sub show_screen dbg("B: s:$spos h:" . scalar @sh) if isdbg('console'); my ($i, $l); -# for ($i = 0; $i < $pagel && $p >= 0; ) { -# $l = measure($sh[$p]); -# $i += $l; -# $p-- if $i < $pagel; - # } $spos = 0 if $spos < 0; my $y = $spos; @@ -216,7 +183,6 @@ sub show_screen $top->clrtobot(); for ($i = 0; $i < $pagel && $y < @sh; ++$y) { my $line = $sh[$y]; -# my $lines = measure($line); my $lines = 1; $top->move($i, 0); dbg("C: s:$spos y:$i sh:" . scalar @sh . " l:" . length($line) . " '$line'") if isdbg('console'); @@ -313,11 +279,6 @@ sub rec_stdin $bot->clrtoeol(); $bot->addstr(substr($inbuf, 0, $cols)); - # add it to the monitor window -# unless ($spos == @sh) { -# $spos = @sh; -# show_screen(); -# } if ($inscroll && $spos < @sh) { $spos = @sh - $pagel; $inscroll = 0; @@ -348,12 +309,6 @@ sub rec_stdin } } elsif ($r eq KEY_PPAGE || $r eq "\032") { if ($spos > 0 && @sh > $pagel) { -# my ($i, $l); -# for ($i = 0; $i < $pagel-1 && $spos >= 0; ) { -# $l = measure($sh[$spos]); -# $i += $l; -# --$spos if $i <= $pagel; -# } $spos -= $pagel+int($pagel/2); $spos = 0 if $spos < 0; $inscroll = 1; @@ -363,12 +318,6 @@ sub rec_stdin } } elsif ($r eq KEY_NPAGE || $r eq "\026") { if ($inscroll && $spos < @sh) { -# my ($i, $l); -# for ($i = 0; $i <= $pagel && $spos < @sh; ) { -# $l = measure($sh[$spos]); -# $i += $l; -# ++$spos if $i <= $pagel && $spos < @sh; -# } dbg("NPAGE sp:$spos $sh:". scalar @sh . " pl: $pagel") if isdbg('console'); $spos += int($pagel/2);