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

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