+2001-12-14 joe c <marcus@marcuscom.com>
+ * etc/afpd/afp_options.c, etc/afpd/afp_dsi.c, etc/afpd/globals.h:
+ Add a new option to afpd called -timeout to specify the number of
+ server tickles to send before killing a AFPoTCP session.
+
2001-12-10 joe c <marcus@marcuscom.com>
* bin/cnid/cnid_didname_verify,c: Add a utility to verify the consistency
of didname.db. Using the stock db_verify utility will fail as the sort
# -loginmesg "Message" Client will display "Message" upon logging in
# (no default, same as -l "Message" on commandline)
# -nodebug Switch off debugging
-# -tickleval <number> Specify the tickle timeout interval (in seconds)
+# -tickleval <number> Specify the tickle timeout interval (in seconds).
+# Note, this defaults to 30 seconds, and really
+# shouldn't be changed. If you want to control
+# the server idle timeout, use the -timeout option.
+# -timeout <number> Specify the number of tickles to send before
+# timing out a connection. The default is 4, therefore
+# a connection will timeout in 2 minutes.
# -icon Use the platform-specific icon.
#
# Some examples:
/*
- * $Id: afp_config.c,v 1.9 2001-12-10 20:16:53 srittau Exp $
+ * $Id: afp_config.c,v 1.10 2001-12-15 06:25:44 jmarcus Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
exit( 1 );
}
+ config->obj.handle = dsi;
+
/* we've forked. */
if (dsi->child) {
configfree(configs, config);
/*
- * $Id: afp_dsi.c,v 1.11 2001-12-10 20:16:53 srittau Exp $
+ * $Id: afp_dsi.c,v 1.12 2001-12-15 06:25:44 jmarcus Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
static struct {
AFPObj *obj;
- unsigned char tickle, flags;
+ unsigned char flags;
+ int tickle;
} child;
dsi_attention(child.obj->handle, AFPATTN_SHUTDOWN);
afp_dsi_close(child.obj);
if (sig) /* if no signal, assume dieing because logins are disabled &
- don't log it (maintenance mode)*/
+ don't log it (maintenance mode)*/
syslog (LOG_INFO, "Connection terminated");
if (sig == SIGTERM || sig == SIGALRM) {
exit( 0 );
{
/* if we're in the midst of processing something,
don't die. we'll allow 3 missed tickles before we die (2 minutes) */
- if ((child.flags & CHILD_RUNNING) || (child.tickle++ < 4)) {
+ if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
+ syslog(LOG_INFO, "afp_dsi: alarm_handler: tickling client...");
dsi_tickle(child.obj->handle);
} else { /* didn't receive a tickle. close connection */
syslog(LOG_ERR, "afp_alarm: child timed out");
/*
- * $Id: afp_options.c,v 1.14 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: afp_options.c,v 1.15 2001-12-15 06:25:44 jmarcus Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
options->transports = AFPTRANS_ALL;
options->passwdfile = _PATH_AFPDPWFILE;
options->tickleval = 30;
+ options->timeout = 4;
options->authprintdir = NULL;
options->umask = 0;
#ifdef ADMIN_GRP
options->passwdminlen = MIN(1, atoi(c));
if ((c = getoption(buf, "-loginmaxfail")))
options->loginmaxfail = atoi(c);
- if ((c = getoption(buf, "-tickleval")))
+ if ((c = getoption(buf, "-tickleval"))) {
options->tickleval = atoi(c);
+ if (options->tickleval <= 0) {
+ options->tickleval = 30;
+ }
+ }
+ if ((c = getoption(buf, "-timeout"))) {
+ options->timeout = atoi(c);
+ if (options->timeout <= 0) {
+ options->timeout = 4;
+ }
+ }
if ((c = getoption(buf, "-server_quantum")))
options->server_quantum = strtoul(c, NULL, 0);
/*
- * $Id: globals.h,v 1.7 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: globals.h,v 1.8 2001-12-15 06:25:44 jmarcus Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
/* a couple of these options could get stuck in unions to save
* space. */
struct afp_options {
- int connections, port, transports, tickleval, flags;
+ int connections, port, transports, tickleval, timeout, flags;
unsigned char passwdbits, passwdminlen, loginmaxfail;
u_int32_t server_quantum;
char hostname[MAXHOSTNAMELEN + 1], *server, *ipaddr, *configfile;
/*
- * $Id: parse_mtab.c,v 1.6 2001-12-10 20:16:54 srittau Exp $
+ * $Id: parse_mtab.c,v 1.7 2001-12-15 06:25:44 jmarcus Exp $
*
* afpd_mtab_parse & support. -- rgr, 9-Apr-01.
*/
/* global mount table; afpd_st_cnid uses this to lookup the right entry. */
static struct afpd_mount_table *afpd_mount_table;
-
+
static int
ceil_log_2 __P((int n))
/* Return the number of bits required to represent n. Only works for