1*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate /****************************************************************************
4*0Sstevel@tonic-gate Copyright (c) 1999,2000 WU-FTPD Development Group.
5*0Sstevel@tonic-gate All rights reserved.
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gate Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994
8*0Sstevel@tonic-gate The Regents of the University of California.
9*0Sstevel@tonic-gate Portions Copyright (c) 1993, 1994 Washington University in Saint Louis.
10*0Sstevel@tonic-gate Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc.
11*0Sstevel@tonic-gate Portions Copyright (c) 1989 Massachusetts Institute of Technology.
12*0Sstevel@tonic-gate Portions Copyright (c) 1998 Sendmail, Inc.
13*0Sstevel@tonic-gate Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman.
14*0Sstevel@tonic-gate Portions Copyright (c) 1997 by Stan Barber.
15*0Sstevel@tonic-gate Portions Copyright (c) 1997 by Kent Landfield.
16*0Sstevel@tonic-gate Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
17*0Sstevel@tonic-gate Free Software Foundation, Inc.
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gate Use and distribution of this software and its source code are governed
20*0Sstevel@tonic-gate by the terms and conditions of the WU-FTPD Software License ("LICENSE").
21*0Sstevel@tonic-gate
22*0Sstevel@tonic-gate If you did not receive a copy of the license, it may be obtained online
23*0Sstevel@tonic-gate at http://www.wu-ftpd.org/license.html.
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate $Id: timeout.c,v 1.5 2000/07/01 18:17:39 wuftpd Exp $
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate ****************************************************************************/
28*0Sstevel@tonic-gate #include "config.h"
29*0Sstevel@tonic-gate #include "proto.h"
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate #include <stdio.h>
32*0Sstevel@tonic-gate #include <errno.h>
33*0Sstevel@tonic-gate #include <stdlib.h>
34*0Sstevel@tonic-gate #include <string.h>
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gate #include "extensions.h"
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gate unsigned int timeout_idle = 900; /* Command idle: 15 minutes */
39*0Sstevel@tonic-gate unsigned int timeout_maxidle = 7200; /* Command idle (MAX): 2 hours */
40*0Sstevel@tonic-gate unsigned int timeout_data = 1200; /* Data idle: 20 minutes */
41*0Sstevel@tonic-gate unsigned int timeout_rfc931 = 10; /* RFC931 session, total: 10 seconds */
42*0Sstevel@tonic-gate unsigned int timeout_accept = 120; /* Accepting data connection: 2 minutes */
43*0Sstevel@tonic-gate unsigned int timeout_connect = 120; /* Establishing data connection: 2 minutes */
44*0Sstevel@tonic-gate
load_timeouts(void)45*0Sstevel@tonic-gate void load_timeouts(void)
46*0Sstevel@tonic-gate {
47*0Sstevel@tonic-gate struct aclmember *entry = NULL;
48*0Sstevel@tonic-gate while (getaclentry("timeout", &entry)) {
49*0Sstevel@tonic-gate if ((ARG0 != NULL) && (ARG1 != NULL)) {
50*0Sstevel@tonic-gate unsigned long value = strtoul(ARG1, NULL, 0);
51*0Sstevel@tonic-gate if (strcasecmp(ARG0, "rfc931") == 0)
52*0Sstevel@tonic-gate timeout_rfc931 = value;
53*0Sstevel@tonic-gate else if (value > 0)
54*0Sstevel@tonic-gate if (strcasecmp(ARG0, "idle") == 0) {
55*0Sstevel@tonic-gate timeout_idle = value;
56*0Sstevel@tonic-gate if (timeout_maxidle < timeout_idle)
57*0Sstevel@tonic-gate timeout_maxidle = timeout_idle;
58*0Sstevel@tonic-gate }
59*0Sstevel@tonic-gate else if (strcasecmp(ARG0, "maxidle") == 0) {
60*0Sstevel@tonic-gate timeout_maxidle = value;
61*0Sstevel@tonic-gate if (timeout_idle > timeout_maxidle)
62*0Sstevel@tonic-gate timeout_idle = timeout_maxidle;
63*0Sstevel@tonic-gate }
64*0Sstevel@tonic-gate else if (strcasecmp(ARG0, "data") == 0)
65*0Sstevel@tonic-gate timeout_data = value;
66*0Sstevel@tonic-gate else if (strcasecmp(ARG0, "accept") == 0)
67*0Sstevel@tonic-gate timeout_accept = value;
68*0Sstevel@tonic-gate else if (strcasecmp(ARG0, "connect") == 0)
69*0Sstevel@tonic-gate timeout_connect = value;
70*0Sstevel@tonic-gate }
71*0Sstevel@tonic-gate }
72*0Sstevel@tonic-gate }
73