From 653c60b2f537c49e44e098ce2280568876902322 Mon Sep 17 00:00:00 2001 From: praszyk Date: Thu, 12 Jan 2006 10:39:59 +0000 Subject: [PATCH] Support for multi-homed clients, see #171621 --- ftp.spec | 8 ++- netkit-ftp-0.17-multihome.patch | 98 +++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 netkit-ftp-0.17-multihome.patch diff --git a/ftp.spec b/ftp.spec index 48c1caf..8d7e8e8 100644 --- a/ftp.spec +++ b/ftp.spec @@ -1,7 +1,7 @@ Summary: The standard UNIX FTP (File Transfer Protocol) client. Name: ftp Version: 0.17 -Release: 31.1 +Release: 32.1 License: BSD Group: Applications/Internet Source0: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/netkit-ftp-%{version}.tar.bz2 @@ -17,6 +17,7 @@ Patch9: netkit-ftp-0.17-longint.patch Patch10: netkit-ftp-0.17-vsftp165083.patch Patch11: netkit-ftp-0.17-C-Frame121.patch Patch12: netkit-ftp-0.17-data.patch +Patch13: netkit-ftp-0.17-multihome.patch BuildRoot: /var/tmp/%{name}-root BuildRequires: gcc, glibc-devel, readline-devel, ncurses-devel, perl @@ -42,6 +43,7 @@ file transfers. %patch10 -p1 -b .vsftp165083 %patch11 -p1 -b .C-Frame121 %patch12 -p1 -b .data +%patch13 -p1 -b .multihome %build sh configure --with-c-compiler=gcc --enable-ipv6 @@ -75,6 +77,10 @@ rm -rf ${RPM_BUILD_ROOT} %{_mandir}/man5/netrc.* %changelog +* Thu Jan 12 2006 Petr Raszyk - 0.17-32 +- support for multi-homed clients + See #171621, netkit-ftp-0.17-multihome.patch + * Fri Dec 09 2005 Jesse Keating - rebuilt diff --git a/netkit-ftp-0.17-multihome.patch b/netkit-ftp-0.17-multihome.patch new file mode 100644 index 0000000..9000937 --- /dev/null +++ b/netkit-ftp-0.17-multihome.patch @@ -0,0 +1,98 @@ +--- netkit-ftp-0.17/ftp/ftp_var.h.rasold 2006-01-12 11:23:16.000000000 +0100 ++++ netkit-ftp-0.17/ftp/ftp_var.h 2006-01-12 11:24:06.000000000 +0100 +@@ -69,6 +69,7 @@ + Extern int bell; /* ring bell on cmd completion */ + Extern int doglob; /* glob local file names */ + Extern int autologin; /* establish user account on connection */ ++Extern int multihome; /* multi homed host, use same interface for cmd and data channels */ + Extern int proxy; /* proxy server connection active */ + Extern int proxflag; /* proxy connection exists */ + Extern int sunique; /* store files on server with unique name */ +--- netkit-ftp-0.17/ftp/ftp.c.rasold 2006-01-12 11:14:55.000000000 +0100 ++++ netkit-ftp-0.17/ftp/ftp.c 2006-01-12 11:22:42.000000000 +0100 +@@ -132,6 +132,7 @@ + static sigjmp_buf ptabort; + static int ptabflg = 0; + static int abrtflag = 0; ++struct sockaddr_in source; + + void lostpeer(int); + extern int connected; +@@ -153,7 +154,7 @@ + char * + hookup(const char *host, const char *port) + { +- int s, tos, error; ++ int s, tos, error, alen; + socklen_t len; + static char hostnamebuf[256]; + struct addrinfo hints, *res, *res0; +@@ -278,7 +279,11 @@ + } + if (verbose) + printf("Connected to %s (%s).\n", hostname, hbuf); +- if (getreply(0) > 2) { /* read startup message from server */ ++ alen = sizeof(source); ++ getsockname(s,(struct sockaddr*)&source, &alen); ++ source.sin_port = 0; /* We just want the addr, not the port */ ++ ++ if (getreply(0) > 2) { /* read startup message from server */ + if (cin) + (void) fclose(cin); + if (cout) +@@ -1254,6 +1259,13 @@ + perror("ftp: socket"); + return(1); + } ++ if((multihome) && ++ bind(data, (struct sockaddr*)&source, sizeof(source)) == -1) { ++ close(data); ++ data = -1; ++ perror("ftp multihome bind"); ++ return(1); ++ } + if (options & SO_DEBUG && + setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on, + sizeof (on)) < 0) +--- netkit-ftp-0.17/ftp/main.c.rasold 2006-01-12 11:24:27.000000000 +0100 ++++ netkit-ftp-0.17/ftp/main.c 2006-01-12 11:27:20.000000000 +0100 +@@ -93,6 +93,7 @@ + printf("\t -n: inhibit auto-login\n"); + printf("\t -e: disable readline support, if present\n"); + printf("\t -g: disable filename globbing\n"); ++ printf("\t -m: don't force data channel interface to the same as control channel\n"); + printf("\t -v: verbose mode\n"); + printf("\t -t: enable packet tracing [nonfunctional]\n"); + printf("\t -d: enable debugging\n"); +@@ -120,6 +121,7 @@ + doglob = 1; + interactive = 1; + autologin = 1; ++ multihome = 1; + passivemode = 1; + + cp = strrchr(argv[0], '/'); +@@ -172,6 +174,10 @@ + rl_inhibit = 1; + break; + ++ case 'm': ++ multihome = 0; ++ break; ++ + case 'h': + usage(); + exit(0); +--- netkit-ftp-0.17/ftp/ftp.1.rasold 2006-01-12 11:14:09.000000000 +0100 ++++ netkit-ftp-0.17/ftp/ftp.1 2006-01-12 11:15:48.000000000 +0100 +@@ -92,6 +92,10 @@ + executable. Otherwise, does nothing. + .It Fl g + Disables file name globbing. ++.It Fl m ++The default requires that ftp explicitly binds to the same interface for the data ++channel as the control channel in passive mode. Useful on multi-homed ++clients. This option disables this behavior. + .It Fl v + Verbose option forces + .Nm ftp