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