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