[c5c522c] | 1 | --- netkit-ftp-0.17/ftp/ftp_var.h.rasold 2006-01-12 11:23:16.000000000 +0100 |
---|
| 2 | +++ netkit-ftp-0.17/ftp/ftp_var.h 2006-01-12 11:24:06.000000000 +0100 |
---|
| 3 | @@ -69,6 +69,7 @@ |
---|
| 4 | Extern int bell; /* ring bell on cmd completion */ |
---|
| 5 | Extern int doglob; /* glob local file names */ |
---|
| 6 | Extern int autologin; /* establish user account on connection */ |
---|
| 7 | +Extern int multihome; /* multi homed host, use same interface for cmd and data channels */ |
---|
| 8 | Extern int proxy; /* proxy server connection active */ |
---|
| 9 | Extern int proxflag; /* proxy connection exists */ |
---|
| 10 | Extern int sunique; /* store files on server with unique name */ |
---|
| 11 | --- netkit-ftp-0.17/ftp/ftp.c.rasold 2006-01-12 11:14:55.000000000 +0100 |
---|
| 12 | +++ netkit-ftp-0.17/ftp/ftp.c 2006-01-12 11:22:42.000000000 +0100 |
---|
| 13 | @@ -132,6 +132,7 @@ |
---|
| 14 | static sigjmp_buf ptabort; |
---|
| 15 | static int ptabflg = 0; |
---|
| 16 | static int abrtflag = 0; |
---|
| 17 | +struct sockaddr_in source; |
---|
| 18 | |
---|
| 19 | void lostpeer(int); |
---|
| 20 | extern int connected; |
---|
| 21 | @@ -153,7 +154,7 @@ |
---|
| 22 | char * |
---|
| 23 | hookup(const char *host, const char *port) |
---|
| 24 | { |
---|
| 25 | - int s, tos, error; |
---|
| 26 | + int s, tos, error, alen; |
---|
| 27 | socklen_t len; |
---|
| 28 | static char hostnamebuf[256]; |
---|
| 29 | struct addrinfo hints, *res, *res0; |
---|
| 30 | @@ -278,7 +279,11 @@ |
---|
| 31 | } |
---|
| 32 | if (verbose) |
---|
| 33 | printf("Connected to %s (%s).\n", hostname, hbuf); |
---|
| 34 | - if (getreply(0) > 2) { /* read startup message from server */ |
---|
| 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 | + |
---|
| 39 | + if (getreply(0) > 2) { /* read startup message from server */ |
---|
| 40 | if (cin) |
---|
| 41 | (void) fclose(cin); |
---|
| 42 | if (cout) |
---|
| 43 | @@ -1254,6 +1259,13 @@ |
---|
| 44 | perror("ftp: socket"); |
---|
| 45 | return(1); |
---|
| 46 | } |
---|
| 47 | + if((multihome) && |
---|
| 48 | + bind(data, (struct sockaddr*)&source, sizeof(source)) == -1) { |
---|
| 49 | + close(data); |
---|
| 50 | + data = -1; |
---|
| 51 | + perror("ftp multihome bind"); |
---|
| 52 | + return(1); |
---|
| 53 | + } |
---|
| 54 | if (options & SO_DEBUG && |
---|
| 55 | setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on, |
---|
| 56 | sizeof (on)) < 0) |
---|
| 57 | --- netkit-ftp-0.17/ftp/main.c.rasold 2006-01-12 11:24:27.000000000 +0100 |
---|
| 58 | +++ netkit-ftp-0.17/ftp/main.c 2006-01-12 11:27:20.000000000 +0100 |
---|
| 59 | @@ -93,6 +93,7 @@ |
---|
| 60 | printf("\t -n: inhibit auto-login\n"); |
---|
| 61 | printf("\t -e: disable readline support, if present\n"); |
---|
| 62 | printf("\t -g: disable filename globbing\n"); |
---|
| 63 | + printf("\t -m: don't force data channel interface to the same as control channel\n"); |
---|
| 64 | printf("\t -v: verbose mode\n"); |
---|
| 65 | printf("\t -t: enable packet tracing [nonfunctional]\n"); |
---|
| 66 | printf("\t -d: enable debugging\n"); |
---|
| 67 | @@ -120,6 +121,7 @@ |
---|
| 68 | doglob = 1; |
---|
| 69 | interactive = 1; |
---|
| 70 | autologin = 1; |
---|
| 71 | + multihome = 1; |
---|
| 72 | passivemode = 1; |
---|
| 73 | |
---|
| 74 | cp = strrchr(argv[0], '/'); |
---|
| 75 | @@ -172,6 +174,10 @@ |
---|
| 76 | rl_inhibit = 1; |
---|
| 77 | break; |
---|
| 78 | |
---|
| 79 | + case 'm': |
---|
| 80 | + multihome = 0; |
---|
| 81 | + break; |
---|
| 82 | + |
---|
| 83 | case 'h': |
---|
| 84 | usage(); |
---|
| 85 | exit(0); |
---|
| 86 | --- netkit-ftp-0.17/ftp/ftp.1.rasold 2006-01-12 11:14:09.000000000 +0100 |
---|
| 87 | +++ netkit-ftp-0.17/ftp/ftp.1 2006-01-12 11:15:48.000000000 +0100 |
---|
| 88 | @@ -92,6 +92,10 @@ |
---|
| 89 | executable. Otherwise, does nothing. |
---|
| 90 | .It Fl g |
---|
| 91 | Disables file name globbing. |
---|
| 92 | +.It Fl m |
---|
| 93 | +The default requires that ftp explicitly binds to the same interface for the data |
---|
| 94 | +channel as the control channel in passive mode. Useful on multi-homed |
---|
| 95 | +clients. This option disables this behavior. |
---|
| 96 | .It Fl v |
---|
| 97 | Verbose option forces |
---|
| 98 | .Nm ftp |
---|