diff -r -U4 bahamut/include/confparse.h bahamut+byte/include/confparse.h --- bahamut/include/confparse.h Tue Mar 30 00:12:47 2004 +++ bahamut+byte/include/confparse.h Wed Jan 25 09:53:16 2006 @@ -64,8 +64,10 @@ #define CONFT_PORT "PORT" #define CONFF_PORT 0x000400 #define CONFT_MODULES "MODULES" #define CONFF_MODULES 0x000800 +#define CONFT_IMMUNE "IMMUNE" +#define CONFF_IMMUNE 0x001000 /* subtokens */ #define SCONFT_NAME "NAME" @@ -291,8 +293,9 @@ extern int confadd_kill(cVar **, int); extern int confadd_admin(cVar **, int); extern int confadd_port(cVar **, int); extern int confadd_modules(cVar **, int); +extern int confadd_immune(cVar **, int); struct TopConf tconftab[] = { {CONFT_GLOBAL, CONFF_GLOBAL, CONFF_ADMIN, confglobtab, confadd_global}, @@ -306,8 +309,9 @@ {CONFT_ADMIN, CONFF_ADMIN, 0, confopentab, confadd_admin}, {CONFT_SUPER, CONFF_SUPER, 0, confopentab, confadd_super}, {CONFT_PORT, CONFF_PORT, 0, confporttab, confadd_port}, {CONFT_MODULES, CONFF_MODULES, 0, confmoduletab, confadd_modules}, + {CONFT_IMMUNE, CONFF_IMMUNE, 0, confopentab, confadd_immune}, {(char *) 0, 0, 0, 0} }; diff -r -U4 bahamut/include/h.h bahamut+byte/include/h.h --- bahamut/include/h.h Mon Apr 19 17:19:02 2004 +++ bahamut+byte/include/h.h Wed Jan 25 09:59:40 2006 @@ -179,8 +179,9 @@ extern aConnect *find_aConnect(char *); extern aOper *find_oper(char *, char *, char *, char *); extern aConnect *find_aConnect_match(char *, char *, char *); extern int find_aUserver(char *); +extern int find_aImmune(char *); extern void clear_conflinks(aClient *); extern void start_auth(aClient *); extern void read_authports(aClient *); diff -r -U4 bahamut/src/s_conf.c bahamut+byte/src/s_conf.c --- bahamut/src/s_conf.c Wed May 19 00:28:19 2004 +++ bahamut+byte/src/s_conf.c Wed Jan 25 09:59:18 2006 @@ -56,16 +56,18 @@ /* these are our global lists of ACTIVE conf entries */ #define MAXUSERVS 24 +#define MAXIMMUNE 80 aConnect *connects = NULL; /* connects, C/N pairs */ aAllow *allows = NULL; /* allows - I lines */ Conf_Me *MeLine = NULL; /* meline - only one */ aOper *opers = NULL; /* opers - Olines */ aPort *ports = NULL; /* ports - P/M lines */ aClass *classes = NULL;; /* classes - Ylines */ char *uservers[MAXUSERVS]; /* uservers = Ulines */ +char *immune[MAXIMMUNE]; /* immune to throttles */ Conf_Modules *modules = NULL; /* this set of lists is used for loading and rehashing the config file */ @@ -75,8 +77,9 @@ aOper *new_opers = NULL; aPort *new_ports = NULL; aClass *new_classes = NULL; char *new_uservers[MAXUSERVS+1]; /* null terminated array */ +char *new_immune[MAXIMMUNE+1]; /* null terminated array */ Conf_Modules *new_modules = NULL; #ifdef LOCKFILE extern void do_pending_klines(void); @@ -335,8 +338,20 @@ } return 0; } +int +find_aImmune(char *name) +{ + int i; + for(i = 0; immune[i]; i++) + { + if(!mycmp(name, immune[i])) + return 1; + } + return 0; +} + aOper * find_oper(char *name, char *username, char *sockhost, char *hostip) { aOper *aoper; @@ -1395,8 +1410,33 @@ return lnum; } int +confadd_immune(cVar *vars[], int lnum) +{ + cVar *tmp; + int c = 0; + int i; + + /* If multiple immune blocks are specified, set up to append */ + for (i = 0; new_immune[i]; i++) + ; + + for(tmp = vars[c]; tmp; tmp = vars[++c]) + { + if (i == MAXIMMUNE) + { + confparse_error("Excessive immune definitions", lnum); + return -1; + } + DupString(new_immune[i], tmp->value); + i++; + } + new_immune[i] = NULL; + return lnum; +} + +int confadd_restrict(cVar *vars[], int lnum) { cVar *tmp; int c = 0, type = 0; @@ -1989,8 +2029,16 @@ DupString(uservers[i], new_uservers[i]); MyFree(new_uservers[i]); } new_uservers[0] = NULL; + for(i = 0; immune[i]; i++) + MyFree(immune[i]); + for(i = 0; new_immune[i]; i++) + { + DupString(immune[i], new_immune[i]); + MyFree(new_immune[i]); + } + new_immune[0] = NULL; /* dont worry about accually merging module data - its fairly * inactive and static data. Just replace it. */ if(modules) @@ -2069,8 +2117,15 @@ MyFree(new_uservers[i]); i++; } new_uservers[0] = NULL; + while(new_immune[i]) + { + DupString(immune[i], new_immune[i]); + MyFree(new_immune[i]); + i++; + } + new_immune[0] = NULL; if(new_modules) { for(i = 0; new_modules->autoload[i]; i++) MyFree(new_modules->autoload[i]); diff -r -U4 bahamut/src/throttle.c bahamut+byte/src/throttle.c --- bahamut/src/throttle.c Mon Apr 19 17:50:25 2004 +++ bahamut+byte/src/throttle.c Wed Jan 25 10:15:42 2006 @@ -371,8 +371,10 @@ throttle_force(char *host) { throttle *tp = hash_find(throttle_hash, host); + if (find_aImmune(host)) return; + if (tp == NULL) { /* we haven't seen this one before, create a new throttle and add it to * the hash. XXX: blockheap code should be used, but the blockheap @@ -484,8 +486,10 @@ { /* This is a forced throttle, drop 'em! */ return 0; } + + if (find_aImmune(host)) return 1; if (tp->conns >= throttle_tcount) { /* mark them as z:lined (we do not actually add a Z:line as this would