[ftp] Add listening timeout

jsynacek jsynacek at fedoraproject.org
Tue Sep 25 10:46:35 UTC 2012


commit 578bc308619a8267475595fccae3a86df0a93e45
Author: Jan Synacek <jsynacek at redhat.com>
Date:   Tue Sep 25 12:38:53 2012 +0200

    Add listening timeout

 ftp.spec                          |    3 +++
 netkit-ftp-0.17-lsn-timeout.patch |   24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/ftp.spec b/ftp.spec
index 4b80051..ca4b64c 100644
--- a/ftp.spec
+++ b/ftp.spec
@@ -37,6 +37,7 @@ Patch28: netkit-ftp-0.17-remove-nested-include.patch
 Patch29: netkit-ftp-0.17-linelen.patch
 Patch30: netkit-ftp-0.17-active-mode-option.patch
 Patch31: netkit-ftp-0.17-commands-leaks.patch
+Patch32: netkit-ftp-0.17-lsn-timeout.patch
 
 BuildRequires: glibc-devel, readline-devel, ncurses-devel
 
@@ -81,6 +82,7 @@ file transfers.
 %patch29 -p1 -b .linelen
 %patch30 -p1 -b .activemode
 %patch31 -p1 -b .cmds-leaks
+%patch32 -p1 -b .lsn-timeout
 
 %build
 sh configure --with-c-compiler=gcc --enable-ipv6
@@ -111,6 +113,7 @@ make INSTALLROOT=${RPM_BUILD_ROOT} install
 %changelog
 * Tue Sep 25 2012 Jan Synáček <jsynacek at redhat.com> - 0.17-60
 - Plug leaks in "put", "send", "append"
+- Add listening timeout
 
 * Tue Aug 28 2012 Jan Synáček <jsynacek at redhat.com> - 0.17-59
 - Add active mode option
diff --git a/netkit-ftp-0.17-lsn-timeout.patch b/netkit-ftp-0.17-lsn-timeout.patch
new file mode 100644
index 0000000..561ccdb
--- /dev/null
+++ b/netkit-ftp-0.17-lsn-timeout.patch
@@ -0,0 +1,24 @@
+--- netkit-ftp-0.17/ftp/ftp.c.to	2012-08-10 15:49:08.510257542 +0200
++++ netkit-ftp-0.17/ftp/ftp.c	2012-08-10 15:49:32.386220785 +0200
+@@ -1245,6 +1245,10 @@ initconn(void)
+ 	u_int ad[16], po[2], af, alen, plen;
+ 	char *pasvcmd = NULL;
+ 	char hbuf[MAXHOSTNAMELEN], pbuf[NI_MAXSERV];
++	struct timeval timeout;
++
++	timeout.tv_sec = 30;
++	timeout.tv_usec = 0;
+ 
+ #ifdef INET6
+ 	if (myctladdr.su_family == AF_INET6
+@@ -1486,6 +1490,10 @@ noport:
+ 			perror("ftp: setsockopt (reuse address)");
+ 			goto bad;
+ 		}
++	if (setsockopt (data, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,
++                sizeof(timeout)) < 0) {
++		perror("ftp: setsockopt failed\n");
++	}
+ 	if (bind(data, (struct sockaddr *)&data_addr, sizeof (data_addr)) < 0) {
+ 		perror("ftp: bind");
+ 		goto bad;


More information about the scm-commits mailing list