fix passive mode ftp

PR:		3955
Submitted by:	Ernest Hua <hua@chromatic.com>
This commit is contained in:
Torsten Blum 1997-11-25 08:23:54 +00:00
parent ae9aa661c5
commit f645acac38
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=8809
2 changed files with 77 additions and 0 deletions

19
ftp/mirror/files/patch-ae Normal file
View File

@ -0,0 +1,19 @@
*** ftp.pl.orig Tue May 23 23:53:25 1995
--- ftp.pl Tue Nov 25 09:20:17 1997
***************
*** 430,436 ****
return 0;
}
if( $ret == 1 ) {
! $response =~ m/^227 Entering Passive Mode \((\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\)$/;
$newhost = sprintf( "%d.%d.%d.%d", $1, $2, $3, $4 );
$newport = $5 * 256 + $6;
}
--- 430,436 ----
return 0;
}
if( $ret == 1 ) {
! $response =~ m/^227 .* \((\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\)$/;
$newhost = sprintf( "%d.%d.%d.%d", $1, $2, $3, $4 );
$newport = $5 * 256 + $6;
}

58
ftp/mirror/files/patch-af Normal file
View File

@ -0,0 +1,58 @@
*** lchat.pl.orig Wed Jun 7 22:19:22 1995
--- lchat.pl Tue Nov 25 09:20:20 1997
***************
*** 123,129 ****
# Similar to open_port, but does less. Used for PASV code with ftp.pl
# -Erez Zadok.
sub open_newport { ## public
! local($server, $port, $newsock) = @_;
local($serveraddr,$serverproc);
--- 123,129 ----
# Similar to open_port, but does less. Used for PASV code with ftp.pl
# -Erez Zadok.
sub open_newport { ## public
! local($server, $port, *newsock) = @_;
local($serveraddr,$serverproc);
***************
*** 142,159 ****
}
$serverproc = pack($sockaddr, 2, $port, $serveraddr);
! unless (connect($newsock, $serverproc)) {
! ($!) = ($!, close($newsock)); # close newsock while saving $!
return undef;
}
# We opened with the local address set to ANY, at this stage we know
# which interface we are using. This is critical if our machine is
# multi-homed, with IP forwarding off, so fix-up.
local($fam,$lport);
! ($fam,$lport,$thisaddr) = unpack($sockaddr, getsockname($newsock));
$thisproc = pack($sockaddr, 2, 0, $thisaddr);
# end of post-connect fixup
! select((select($newsock), $| = 1)[0]);
return 1;
}
##############################################################################
--- 142,159 ----
}
$serverproc = pack($sockaddr, 2, $port, $serveraddr);
! unless (connect(newsock, $serverproc)) {
! ($!) = ($!, close(newsock)); # close newsock while saving $!
return undef;
}
# We opened with the local address set to ANY, at this stage we know
# which interface we are using. This is critical if our machine is
# multi-homed, with IP forwarding off, so fix-up.
local($fam,$lport);
! ($fam,$lport,$thisaddr) = unpack($sockaddr, getsockname(newsock));
$thisproc = pack($sockaddr, 2, 0, $thisaddr);
# end of post-connect fixup
! select((select(newsock), $| = 1)[0]);
return 1;
}
##############################################################################