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 , 8 years ago | |
---|---|
|
|
File size: 1.9 KB |
-
netkit-ftp-0.17/ftp/ftp.c
old new 78 78 #include <netinet/in.h> 79 79 #include <netinet/ip.h> 80 80 #include <arpa/ftp.h> 81 #include <arpa/inet.h>82 81 #include <arpa/telnet.h> 83 84 82 #include <stdio.h> 85 83 #include <signal.h> 86 84 #include <string.h> … … 132 130 static sigjmp_buf ptabort; 133 131 static int ptabflg = 0; 134 132 static int abrtflag = 0; 135 struct sockaddr_ insource;133 struct sockaddr_storage source; 136 134 137 135 void lostpeer(int); 138 136 extern int connected; … … 154 152 char * 155 153 hookup(const char *host, const char *port) 156 154 { 157 int s, tos, error , alen;158 socklen_t len ;155 int s, tos, error; 156 socklen_t len, alen; 159 157 static char hostnamebuf[256]; 160 158 struct addrinfo hints, *res, *res0; 161 159 char hbuf[MAXHOSTNAMELEN], pbuf[NI_MAXSERV]; … … 281 279 printf("Connected to %s (%s).\n", hostname, hbuf); 282 280 alen = sizeof(source); 283 281 getsockname(s,(struct sockaddr*)&source, &alen); 284 source.sin_port = 0; /* We just want the addr, not the port */ 282 switch (source.ss_family) { 283 /* We just want the addr, not the port */ 284 case AF_INET: 285 ((struct sockaddr_in *) &source)->sin_port = 0; 286 break; 287 case AF_INET6: 288 ((struct sockaddr_in6 *) &source)->sin6_port = 0; 289 break; 290 } 285 291 286 292 if (getreply(0) > 2) { /* read startup message from server */ 287 293 if (cin) … … 1260 1266 return(1); 1261 1267 } 1262 1268 if((multihome) && 1263 bind(data, (struct sockaddr*)&source, sizeof(source)) == -1) {1264 1265 1266 1267 1269 bind(data, (struct sockaddr *)&source, sizeof(source)) == -1) { 1270 close(data); 1271 data = -1; 1272 perror("ftp multihome bind"); 1273 return(1); 1268 1274 } 1269 1275 if (options & SO_DEBUG && 1270 1276 setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
Note: See TracBrowser
for help on using the repository browser.