X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FExtMsg.pm;h=2edd7537962a91bd06371f0805eaef841b27aedf;hb=cde4b624b9eccd5b360d9cc7047a7f73527885aa;hp=78daffe263483b32d53a405c154ee696adadac47;hpb=407d9a80a8af1fa6c1ae2c8fbca833e49da6e816;p=spider.git diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 78daffe2..2edd7537 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -104,11 +104,34 @@ sub dequeue if (is_callsign($msg) && $msg !~ m|/| ) { my $sort = $conn->{csort}; $sort = 'local' if $conn->{peerhost} eq "127.0.0.1"; - $conn->to_connected($msg, 'A', $sort); + my $uref; + if ($main::passwdreq || ($uref = DXUser->get_current($msg)) && $uref->passwd ) { + $conn->conns($msg); + $conn->{state} = 'WP'; + $conn->{decho} = $conn->{echo}; + $conn->{echo} = 0; + $conn->send_raw('password: '); + } else { + $conn->to_connected($msg, 'A', $sort); + } } else { $conn->send_now("Sorry $msg is an invalid callsign"); $conn->disconnect; } + } elsif ($conn->{state} eq 'WP' ) { + my $uref = DXUser->get_current($conn->{call}); + $msg =~ s/[\r\n]+$//; + if ($uref && $msg eq $uref->passwd) { + my $sort = $conn->{csort}; + $conn->{echo} = $conn->{decho}; + delete $conn->{decho}; + $sort = 'local' if $conn->{peerhost} eq "127.0.0.1"; + $conn->{usedpasswd} = 1; + $conn->to_connected($conn->{call}, 'A', $sort); + } else { + $conn->send_now("Sorry"); + $conn->disconnect; + } } elsif ($conn->{state} eq 'WC') { if (exists $conn->{cmd} && @{$conn->{cmd}}) { $conn->_docmd($msg); @@ -129,6 +152,7 @@ sub to_connected delete $conn->{cmd}; $conn->{timeout}->del if $conn->{timeout}; delete $conn->{timeout}; + $conn->nolinger; &{$conn->{rproc}}($conn, "$dir$call|$sort"); $conn->_send_file("$main::data/connected") unless $conn->{outgoing}; } @@ -139,6 +163,7 @@ sub new_client { if ($sock) { my $conn = $server_conn->new($server_conn->{rproc}); $conn->{sock} = $sock; + $conn->nolinger; Msg::blocking($sock, 0); $conn->{blocking} = 0; eval {$conn->{peerhost} = $sock->peerhost};