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

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