summaryrefslogtreecommitdiff
path: root/ftp/mirror/files/patch-af
blob: 8a659e1080c1892eec3ab138a68f5ff3a2a8a270 (plain) (blame)
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	Fri May 29 21:05:46 1998
--- lchat.pl	Mon Jun  8 14:34:37 1998
***************
*** 161,167 ****
  # 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);
  
--- 161,167 ----
  # 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);
  
***************
*** 180,197 ****
  	}
  	$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;
  }
  ##############################################################################
--- 180,197 ----
  	}
  	$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;
  }
  ##############################################################################