Index: include/dynconf.h
===================================================================
RCS file: /home/cmunk/ircsystems/cvsroot/unreal/include/dynconf.h,v
retrieving revision 1.1.1.1.6.1.2.59
diff -u -r1.1.1.1.6.1.2.59 dynconf.h
--- include/dynconf.h	16 Dec 2006 16:56:31 -0000	1.1.1.1.6.1.2.59
+++ include/dynconf.h	2 May 2007 01:37:41 -0000
@@ -77,6 +77,7 @@
 	unsigned check_target_nick_bans:1;
 	unsigned use_egd;
 	long host_timeout;
+        long max_bantime;
 	int  host_retries;
 	char *name_server;
 	char *dns_bindip;
@@ -169,6 +170,7 @@
 #define AUTO_JOIN_CHANS			iConf.auto_join_chans
 #define OPER_AUTO_JOIN_CHANS		iConf.oper_auto_join_chans
 #define HOST_TIMEOUT			iConf.host_timeout
+#define MAX_BANTIME			iConf.max_bantime
 #define HOST_RETRIES			iConf.host_retries
 #define NAME_SERVER			iConf.name_server
 #define DNS_BINDIP			iConf.dns_bindip
@@ -256,6 +258,7 @@
 
 /* Used for "is present?" and duplicate checking */
 struct SetCheck {
+	unsigned has_max_bantime:1;
 	unsigned has_show_opermotd:1;
 	unsigned has_hide_ulines:1;
 	unsigned has_flat_map:1;
Index: src/s_conf.c
===================================================================
RCS file: /home/cmunk/ircsystems/cvsroot/unreal/src/s_conf.c,v
retrieving revision 1.1.1.1.6.1.2.377
diff -u -r1.1.1.1.6.1.2.377 s_conf.c
--- src/s_conf.c	24 Apr 2007 11:36:33 -0000	1.1.1.1.6.1.2.377
+++ src/s_conf.c	2 May 2007 01:37:46 -0000
@@ -6471,7 +6465,10 @@
 
 	for (cep = ce->ce_entries; cep; cep = cep->ce_next)
 	{
-		if (!strcmp(cep->ce_varname, "kline-address")) {
+		if (!strcmp(cep->ce_varname, "max-bantime")) {
+			tempiConf.max_bantime = config_checkval(cep->ce_vardata,CFG_TIME);
+		}
+		else if (!strcmp(cep->ce_varname, "kline-address")) {
 			ircstrdup(tempiConf.kline_address, cep->ce_vardata);
 		}
 		if (!strcmp(cep->ce_varname, "gline-address")) {
@@ -6913,7 +6910,11 @@
 			errors++;
 			continue;
 		}
-		if (!strcmp(cep->ce_varname, "kline-address")) {
+		if (!strcmp(cep->ce_varname, "max-bantime")) {
+			CheckNull(cep);
+			CheckDuplicate(cep, max_bantime, "max-bantime");
+		}
+		else if (!strcmp(cep->ce_varname, "kline-address")) {
 			CheckNull(cep);
 			CheckDuplicate(cep, kline_address, "kline-address");
 			if (!strchr(cep->ce_vardata, '@') && !strchr(cep->ce_vardata, ':'))
Index: src/modules/m_tkl.c
===================================================================
RCS file: /home/cmunk/ircsystems/cvsroot/unreal/src/modules/Attic/m_tkl.c,v
retrieving revision 1.1.2.46
diff -u -r1.1.2.46 m_tkl.c
--- src/modules/m_tkl.c	26 Apr 2007 12:55:18 -0000	1.1.2.46
+++ src/modules/m_tkl.c	2 May 2007 01:37:48 -0000
@@ -662,15 +662,13 @@
 	    make_nick_user_host(sptr->name, sptr->user->username, GetHost(sptr));
 	if (whattodo == 0)
 	{
-		if (secs == 0)
-		{
-			if (DEFAULT_BANTIME && (parc <= 3))
-				ircsprintf(mo, "%li", DEFAULT_BANTIME + TStime());
-			else
-				ircsprintf(mo, "%li", secs); /* "0" */
-		}
-		else
-			ircsprintf(mo, "%li", secs + TStime());
+		if ((secs == 0) && (DEFAULT_BANTIME) && (parc <= 3))
+			secs = DEFAULT_BANTIME;
+		
+		if (MAX_BANTIME && (secs > MAX_BANTIME || secs == 0))
+			secs = MAX_BANTIME;
+
+		ircsprintf(mo, "%li", (secs) ? secs + TStime() : 0);
 		ircsprintf(mo2, "%li", TStime());
 		tkllayer[6] = mo;
 		tkllayer[7] = mo2;
