aboutsummaryrefslogtreecommitdiff
path: root/tests/ftpserver.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ftpserver.pl')
-rw-r--r--tests/ftpserver.pl29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 13c4b8218..02d0fd7f4 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -433,13 +433,32 @@ sub PASV_command {
printf("229 Entering Passive Mode (|||%d|)\n", $pasvport);
}
- my $paddr = accept(SOCK, Server2);
- my($iport,$iaddr) = sockaddr_in($paddr);
- my $name = gethostbyaddr($iaddr,AF_INET);
- close(Server2); # close the listener when its served its purpose!
+ my $paddr;
+ eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ alarm 2; # assume swift operations!
+ $paddr = accept(SOCK, Server2);
+ alarm 0;
+ };
+ if ($@) {
+ # timed out
+
+ close(Server2);
+ logmsg "accept failed\n";
+ return;
+ }
+ else {
+ logmsg "accept worked\n";
- logmsg "data connection from $name [", inet_ntoa($iaddr), "] at port $iport\n";
+ my($iport,$iaddr) = sockaddr_in($paddr);
+ my $name = gethostbyaddr($iaddr,AF_INET);
+
+ close(Server2); # close the listener when its served its purpose!
+
+ logmsg "data connection from $name [", inet_ntoa($iaddr),
+ "] at port $iport\n";
+ }
return;
}