about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/tcp.c3
-rw-r--r--Src/Modules/zftp.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index eb4685b39..5f5f432c6 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -322,13 +322,14 @@ tcp_connect(Tcp_session sess, char *addrp, struct hostent *zhost, int d_port)
 # ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
 	sess->peer.in6.sin6_scope_id = 0;
 # endif
+	sess->peer.in6.sin6_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in6);
     } else
 #endif /* SUPPORT_IPV6 */
     {
 	memcpy(&(sess->peer.in.sin_addr), addrp, zhost->h_length);
 	sess->peer.in.sin_port = d_port;
-	sess->peer.a.sa_family = zhost->h_addrtype;
+	sess->peer.in.sin_family = zhost->h_addrtype;
 	salen = sizeof(struct sockaddr_in);
     }
 
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 6ee0f0156..80e09045c 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -863,7 +863,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep)
 	zwarnnam(name, "Must set preference S or P to transfer data", NULL, 0);
 	return 1;
     }
-    zfsess->dfd = socket(AF_INET, SOCK_STREAM, 0);
+    zfsess->dfd = socket(zfsess->control->peer.a.sa_family, SOCK_STREAM, 0);
     if (zfsess->dfd < 0) {
 	zwarnnam(name, "can't get data socket: %e", NULL, errno);
 	return 1;
@@ -907,7 +907,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep)
 	    delim = ptr[1];
 	    if(delim < 33 || delim > 126 || ptr[2] != delim || ptr[3] != delim)
 		goto bad_epsv;
-	    ptr += 3;
+	    ptr += 4;
 	    end = strchr(ptr, delim);
 	    if(!end || end[1] != ')')
 		goto bad_epsv;