<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- netkit-ftp-0.17/ftp/ftp.c.multiipv6	2006-08-02 15:03:26.000000000 +0200
+++ netkit-ftp-0.17/ftp/ftp.c	2006-08-02 15:06:19.000000000 +0200
@@ -78,9 +78,7 @@
 #include &lt;netinet/in.h&gt;
 #include &lt;netinet/ip.h&gt;
 #include &lt;arpa/ftp.h&gt;
-#include &lt;arpa/inet.h&gt;
 #include &lt;arpa/telnet.h&gt;
-
 #include &lt;stdio.h&gt;
 #include &lt;signal.h&gt;
 #include &lt;string.h&gt;
@@ -132,7 +130,7 @@
 static sigjmp_buf ptabort;
 static int ptabflg = 0;
 static int abrtflag = 0;
-struct sockaddr_in source;
+struct sockaddr_storage source;
 
 void lostpeer(int);
 extern int connected;
@@ -154,8 +152,8 @@
 char *
 hookup(const char *host, const char *port)
 {
-	int s, tos, error, alen;
-	socklen_t len;
+	int s, tos, error;
+	socklen_t len, alen;
 	static char hostnamebuf[256];
 	struct addrinfo hints, *res, *res0;
 	char hbuf[MAXHOSTNAMELEN], pbuf[NI_MAXSERV];
@@ -281,7 +279,15 @@
 		printf("Connected to %s (%s).\n", hostname, hbuf);
 	alen = sizeof(source);
 	getsockname(s,(struct sockaddr*)&amp;source, &amp;alen);
-	source.sin_port = 0;    /* We just want the addr, not the port */
+	switch (source.ss_family) {
+	    /* We just want the addr, not the port */
+	    case AF_INET:
+		((struct sockaddr_in *) &amp;source)-&gt;sin_port = 0;
+	        break;
+	    case AF_INET6:
+		((struct sockaddr_in6 *) &amp;source)-&gt;sin6_port = 0;
+	        break;
+	}
 
 	if (getreply(0) &gt; 2) { 	/* read startup message from server    */
 		if (cin)
@@ -1260,11 +1266,11 @@
 			return(1);
 		}
 		if((multihome) &amp;&amp;
-			bind(data, (struct sockaddr*)&amp;source, sizeof(source)) == -1) {
-			close(data);
-			data = -1;
-			perror("ftp multihome bind");
-			return(1);
+                       bind(data, (struct sockaddr *)&amp;source, sizeof(source)) == -1) {
+                       close(data);
+                       data = -1;
+                       perror("ftp multihome bind");
+                       return(1);
                 }
 		if (options &amp; SO_DEBUG &amp;&amp;
 		    setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&amp;on,
</pre></body></html>