source: npl/system/netkit-ftp/patches/14-netkit-ftp-0.17-multiipv6.patch @ ca72aba

Last change on this file since ca72aba was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[c5c522c]1--- netkit-ftp-0.17/ftp/ftp.c.multiipv6 2006-08-02 15:03:26.000000000 +0200
2+++ netkit-ftp-0.17/ftp/ftp.c   2006-08-02 15:06:19.000000000 +0200
3@@ -78,9 +78,7 @@
4 #include <netinet/in.h>
5 #include <netinet/ip.h>
6 #include <arpa/ftp.h>
7-#include <arpa/inet.h>
8 #include <arpa/telnet.h>
9-
10 #include <stdio.h>
11 #include <signal.h>
12 #include <string.h>
13@@ -132,7 +130,7 @@
14 static sigjmp_buf ptabort;
15 static int ptabflg = 0;
16 static int abrtflag = 0;
17-struct sockaddr_in source;
18+struct sockaddr_storage source;
19 
20 void lostpeer(int);
21 extern int connected;
22@@ -154,8 +152,8 @@
23 char *
24 hookup(const char *host, const char *port)
25 {
26-       int s, tos, error, alen;
27-       socklen_t len;
28+       int s, tos, error;
29+       socklen_t len, alen;
30        static char hostnamebuf[256];
31        struct addrinfo hints, *res, *res0;
32        char hbuf[MAXHOSTNAMELEN], pbuf[NI_MAXSERV];
33@@ -281,7 +279,15 @@
34                printf("Connected to %s (%s).\n", hostname, hbuf);
35        alen = sizeof(source);
36        getsockname(s,(struct sockaddr*)&source, &alen);
37-       source.sin_port = 0;    /* We just want the addr, not the port */
38+       switch (source.ss_family) {
39+           /* We just want the addr, not the port */
40+           case AF_INET:
41+               ((struct sockaddr_in *) &source)->sin_port = 0;
42+               break;
43+           case AF_INET6:
44+               ((struct sockaddr_in6 *) &source)->sin6_port = 0;
45+               break;
46+       }
47 
48        if (getreply(0) > 2) {  /* read startup message from server    */
49                if (cin)
50@@ -1260,11 +1266,11 @@
51                        return(1);
52                }
53                if((multihome) &&
54-                       bind(data, (struct sockaddr*)&source, sizeof(source)) == -1) {
55-                       close(data);
56-                       data = -1;
57-                       perror("ftp multihome bind");
58-                       return(1);
59+                       bind(data, (struct sockaddr *)&source, sizeof(source)) == -1) {
60+                       close(data);
61+                       data = -1;
62+                       perror("ftp multihome bind");
63+                       return(1);
64                 }
65                if (options & SO_DEBUG &&
66                    setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
Note: See TracBrowser for help on using the repository browser.