summaryrefslogtreecommitdiff
path: root/libexec/ftpd/ftpd.c
diff options
context:
space:
mode:
authorbitblt <bitblt@cvs.openbsd.org>1996-12-07 09:00:23 +0000
committerbitblt <bitblt@cvs.openbsd.org>1996-12-07 09:00:23 +0000
commitfb7887bc6b72ebb68ff61bd546aa85551337837c (patch)
tree36441a479804430766cf04961c882e8fc5808f70 /libexec/ftpd/ftpd.c
parent5aecc0c00728add21a2bcc0e0f4b3fbed9579e60 (diff)
ftpd now eventually times out if a ftp client does:
pasv list and then crashes. The timeout should only apply the the accept(), so that transfers can take as long as necessary to complete. Thanks to Theo for moving toolong() to extern.h so that it can be used in ftpd.c as well as in ftpcmd.y.
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r--libexec/ftpd/ftpd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 76d3b2811ab..6376883dc97 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.25 1996/12/03 03:07:17 deraadt Exp $ */
+/* $OpenBSD: ftpd.c,v 1.26 1996/12/07 09:00:22 bitblt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -1114,7 +1114,10 @@ dataconn(name, size, mode)
struct sockaddr_in from;
int s, fromlen = sizeof(from);
+ signal (SIGALRM, toolong);
+ (void) alarm ((unsigned) timeout);
s = accept(pdata, (struct sockaddr *)&from, &fromlen);
+ (void) alarm (0);
if (s < 0) {
reply(425, "Can't open data connection.");
(void) close(pdata);