1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

Fixed the FTP server read stuff when waiting for a connect after a PASV/EPSV.

Made the ftp server use the passed in pidfile name, and made runtests.pl
pass it in properly.
This commit is contained in:
Daniel Stenberg 2005-05-02 10:22:09 +00:00
parent 9a3e0e52cb
commit 669ebb5f71
2 changed files with 10 additions and 5 deletions

View File

@ -76,6 +76,8 @@ my $ipv6;
my $ext; # append to log/pid file names
my $grok_eprt;
my $port = 8921; # just a default
my $pidfile = ".ftpd.pid"; # a default, use --pidfile
do {
if($ARGV[0] eq "-v") {
$verbose=1;
@ -88,6 +90,10 @@ do {
$ftpdnum=$ARGV[1];
shift @ARGV;
}
elsif($ARGV[0] eq "--pidfile") {
$pidfile=$ARGV[1];
shift @ARGV;
}
elsif($ARGV[0] eq "--ipv6") {
$ipv6="--ipv6";
$ext="ipv6";
@ -129,12 +135,12 @@ sub startsf {
}
# remove the file here so that if startsf() fails, it is very noticable
unlink(".ftp$ftpdnum.pid");
unlink($pidfile);
startsf();
logmsg sprintf("FTP server started on port IPv%d/$port\n", $ipv6?6:4);
open(PID, ">.ftp$ftpdnum.pid");
open(PID, ">$pidfile");
print PID $$;
close(PID);
@ -590,9 +596,8 @@ sub PASV_command {
# Wait for 'CNCT'
my $input;
my $size;
while(sysread(DREAD, $input, $size)) {
while(sysread(DREAD, $input, 5)) {
if($input !~ /^CNCT/) {
# we wait for a connected client

View File

@ -553,7 +553,7 @@ sub runftpserver {
if($ipv6) {
$flag .="--ipv6 ";
}
my $cmd="$perl $srcdir/ftpserver.pl $flag --port $port";
my $cmd="$perl $srcdir/ftpserver.pl --pidfile $pidfile $flag --port $port";
my $ftppid = startnew($cmd);