mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
get_pasv_socket: Use AF_INET6 when appropriate.
When get_pasv6_socket was merged into get_pasv_socket on 2005-04-15,
the AF_INET6 of get_pasv6_socket was lost and the merged function
always returned AF_INET sockets. This then made getsockname fill
only part of the struct sockaddr_in6, and ELinks sent to the server
an EPRT command that had half the bits missing from the IPv6 address.
At least ftp.funet.fi then rejected the command, helpfully saying
what the address should have been.
This commit fixes active FTP over IPv6. Passive FTP was already fixed
in 0.11.3.GIT (887d650efe
), on 2007-05-01.
This commit is contained in:
parent
789eacc0d9
commit
0c1b52637f
2
NEWS
2
NEWS
@ -301,7 +301,7 @@ To be released as 0.11.4.
|
||||
* bug 691: don't look up bogus IPv4 addresses based on characters of a
|
||||
hostname
|
||||
* bug 712: GnuTLS works on https://www-s.uiuc.edu/[]
|
||||
* fix passive FTP over IPv6 when connect() fails with EINPROGRESS
|
||||
* fix active and passive FTP over IPv6
|
||||
* minor bug 951 in user SMJS: garbage-collect SMJS objects on 'File ->
|
||||
Flush all caches' to work around their holding cache entries busy
|
||||
* minor bug 396: never show empty filename in the what-to-do dialog
|
||||
|
@ -282,6 +282,7 @@ get_pasv_socket(struct socket *ctrl_socket, struct sockaddr_storage *addr)
|
||||
struct sockaddr *pasv_addr = (struct sockaddr *) addr;
|
||||
size_t addrlen;
|
||||
int sock = -1;
|
||||
int syspf; /* Protocol Family given to system, not EL_PF_... */
|
||||
socklen_t len;
|
||||
#ifdef CONFIG_IPV6
|
||||
struct sockaddr_in6 bind_addr6;
|
||||
@ -289,11 +290,13 @@ get_pasv_socket(struct socket *ctrl_socket, struct sockaddr_storage *addr)
|
||||
if (ctrl_socket->protocol_family == EL_PF_INET6) {
|
||||
bind_addr = (struct sockaddr *) &bind_addr6;
|
||||
addrlen = sizeof(bind_addr6);
|
||||
syspf = PF_INET6;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
bind_addr = (struct sockaddr *) &bind_addr4;
|
||||
addrlen = sizeof(bind_addr4);
|
||||
syspf = PF_INET;
|
||||
}
|
||||
|
||||
memset(pasv_addr, 0, sizeof(addrlen));
|
||||
@ -310,7 +313,7 @@ sock_error:
|
||||
|
||||
/* Get a passive socket */
|
||||
|
||||
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
sock = socket(syspf, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (sock < 0)
|
||||
goto sock_error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user