Blame SOURCES/netkit-ftp-0.17-multiipv6.patch

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