freebsd-ports/ftp/mirror/files/patch-af
Torsten Blum f645acac38 fix passive mode ftp
PR:		3955
Submitted by:	Ernest Hua <hua@chromatic.com>
1997-11-25 08:23:54 +00:00

58 lines
1.9 KiB
Text

*** 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;
}
##############################################################################