From 90a26a4844d1acfecb3bd0842da333f8bddd45c6 Mon Sep 17 00:00:00 2001 From: Avi Brender Date: Thu, 10 Dec 2015 11:37:03 +0200 Subject: Implement FR #55651 (Option to ignore the returned FTP PASV address) --- ext/ftp/ftp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/ftp/ftp.c') diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index d40e964b7f..01ec36b096 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -722,10 +722,11 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) memset(&ftp->pasvaddr, 0, n); sa = (struct sockaddr *) &ftp->pasvaddr; -#if HAVE_IPV6 if (getpeername(ftp->fd, sa, &n) < 0) { return 0; } + +#if HAVE_IPV6 if (sa->sa_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; char *endptr, delimiter; @@ -778,8 +779,9 @@ ftp_pasv(ftpbuf_t *ftp, int pasv) ipbox.c[n] = (unsigned char) b[n]; } sin = (struct sockaddr_in *) sa; - sin->sin_family = AF_INET; - sin->sin_addr = ipbox.ia[0]; + if (ftp->usepasvaddress) { + sin->sin_addr = ipbox.ia[0]; + } sin->sin_port = ipbox.s[2]; ftp->pasv = 2; -- cgit v1.2.1 From 49493a2dcfb2cd1758b69b13d9006ead3be0e066 Mon Sep 17 00:00:00 2001 From: Lior Kaplan Date: Fri, 1 Jan 2016 19:19:27 +0200 Subject: Happy new year (Update copyright to 2016) --- ext/ftp/ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/ftp/ftp.c') diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 01ec36b096..f0bfb9459c 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | -- cgit v1.2.1