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

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