Blame SOURCES/netkit-ftp-0.17-lsn-timeout.patch

09d58c
--- netkit-ftp-0.17/ftp/ftp.c.to	2012-08-10 15:49:08.510257542 +0200
09d58c
+++ netkit-ftp-0.17/ftp/ftp.c	2012-08-10 15:49:32.386220785 +0200
09d58c
@@ -1245,6 +1245,10 @@ initconn(void)
09d58c
 	u_int ad[16], po[2], af, alen, plen;
09d58c
 	char *pasvcmd = NULL;
09d58c
 	char hbuf[MAXHOSTNAMELEN], pbuf[NI_MAXSERV];
09d58c
+	struct timeval timeout;
09d58c
+
09d58c
+	timeout.tv_sec = 30;
09d58c
+	timeout.tv_usec = 0;
09d58c
 
09d58c
 #ifdef INET6
09d58c
 	if (myctladdr.su_family == AF_INET6
09d58c
@@ -1486,6 +1490,10 @@ noport:
09d58c
 			perror("ftp: setsockopt (reuse address)");
09d58c
 			goto bad;
09d58c
 		}
09d58c
+	if (setsockopt (data, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout,
09d58c
+                sizeof(timeout)) < 0) {
09d58c
+		perror("ftp: setsockopt failed\n");
09d58c
+	}
09d58c
 	if (bind(data, (struct sockaddr *)&data_addr, sizeof (data_addr)) < 0) {
09d58c
 		perror("ftp: bind");
09d58c
 		goto bad;