From 17507eac852b2042e51984899fd18b59a17300ee Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 24 Apr 2007 21:30:39 +0000 Subject: Clear out FTP server options before each new client. Wait for child processes to die to avoid creating zombies. --- tests/ftp.pm | 1 + tests/ftpserver.pl | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/ftp.pm b/tests/ftp.pm index 738482a81..b3cc14abb 100644 --- a/tests/ftp.pm +++ b/tests/ftp.pm @@ -64,6 +64,7 @@ sub ftpkillslave { if($pid > 0) { printf ("* kill pid for %s => %d\n", "ftp-$base$id$ext", $pid) if($verbose); kill (9, $pid); # die! + waitpid($pid, 0); } unlink($f); } diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 2f789662f..c338e0dad 100644 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -139,6 +139,7 @@ sub sysread_or_die { logmsg "Failed to read input\n"; logmsg "Error: ftp$ftpdnum$ext sysread error: $!\n"; kill(9, $sfpid); + waitpid($sfpid, 0); die "Died in sysread_or_die() at $fcaller " . "line $lcaller. ftp$ftpdnum$ext sysread error: $!\n"; } @@ -147,6 +148,7 @@ sub sysread_or_die { logmsg "Failed to read input\n"; logmsg "Error: ftp$ftpdnum$ext read zero\n"; kill(9, $sfpid); + waitpid($sfpid, 0); die "Died in sysread_or_die() at $fcaller " . "line $lcaller. ftp$ftpdnum$ext read zero\n"; } @@ -167,6 +169,7 @@ sub startsf { if($pong !~ /^PONG/) { logmsg "Failed sockfilt command: $cmd\n"; kill(9, $sfpid); + waitpid($sfpid, 0); die "Failed to start sockfilt!"; } } @@ -569,6 +572,7 @@ sub PASV_command { if($pong !~ /^PONG/) { kill(9, $slavepid); + waitpid($slavepid, 0); sendcontrol "500 no free ports!\r\n"; logmsg "failed to run sockfilt for data connection\n"; return 0; @@ -697,6 +701,7 @@ sub PORT_command { if($pong !~ /^PONG/) { logmsg "Failed sockfilt for data connection\n"; kill(9, $slavepid); + waitpid($slavepid, 0); } logmsg "====> Client DATA connect to port $port\n"; @@ -712,6 +717,12 @@ sub customize { $nosave = 0; # default is to save as normal $controldelay = 0; # default is no delaying the responses + $retrweirdo = 0; + $retrnosize = 0; + $pasvbadip = 0; + $nosave = 0; + %customcount = (); + %delayreply = (); open(CUSTOM, "