summaryrefslogtreecommitdiffstats
path: root/ftp/mirror/files/patch-af
blob: ab7f5db0b87743e99cbf41a91c49a9422350864b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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;
  }
  ##############################################################################
OpenPOWER on IntegriCloud