diff -c -r -N irc2.8.21+CSr17/README.CS irc2.8.21+CSr18/README.CS *** irc2.8.21+CSr17/README.CS Fri Dec 22 21:20:56 1995 --- irc2.8.21+CSr18/README.CS Thu Jan 4 23:00:54 1996 *************** *** 1,3 **** --- 1,40 ---- + NOTE: Please change values in comstud.h and dog3.h to your liking... + The default values are probably less than ideal for you! + + New in CSr18: + + 1) Fix from Philippe for dich_conf K: line matching and so forth... + 2) Added B: lines to desigate hosts/ip#'s to ignore for bot/clone checking + if defined...Thanks to Philippe for this as well + + Note: BOT_IP_IGNORE is no longer a #define, you must use B: lines + (the same way as K: and I: lines to specify a host/ip or so forth + to make pass thru the bot/clone check...) + + 3) Fixed DEBUGMODE and DOUGH_HASH not being able to be defined together (?) + 4) Remove IDLE checking for disconnecting IDLE users...this patch was + basically a waste, since most clients auto-reconnect...maybe I'll do + something that won't let the clients reconnect...we'll see... + 5) Removed the #define's for removing flood control for opers...if you want + this, you will have to hack it in yourself...I don't want to catch any + crap for it =) + 6) Minimal performance improvement, lowering the # of calls to time() + 7) Performance improvements, removing K: lines from the main linear + "conf" list, when using DICH_CONF...before, it still added them to + the "conf" list, and also kept them in separate DICH lists...This + improves the speed in looking up I:/Y: lines and so forth...so when + clients connect, less CPU is used. + 8) Added #define for E-lines. These lines are for hosts that should + be allowed to connect, even if it matches a K-line...for instance, + K-line all of *netcom.com, E-line *cbehrens@*netcom.com to allow it + to connect (This is only valuable to open I: servers mostly) + 9) When using QUOTE KLINE with DICH_CONF, the K-line is added to ircd.conf + and added in memory internally without rereading the whole ircd.conf + 10) Fixed various other things with QUOTE KLINE... + 11) Fixed timezone bug + 12) Added #define RESTRICT, so that you can #define whether or not + you want to disable /list, and /lusers when in dog3's HTM + New in CSr17: 1) Updates for +TSora diff -c -r -N irc2.8.21+CSr17/include/common.h irc2.8.21+CSr18/include/common.h *** irc2.8.21+CSr17/include/common.h Fri Dec 22 20:59:00 1995 --- irc2.8.21+CSr18/include/common.h Thu Jan 4 18:54:55 1996 *************** *** 20,25 **** --- 20,34 ---- #ifndef __common_include__ #define __common_include__ + #if defined(HPUX )|| defined(AIX) + #include + #ifdef AIX + #include + #endif + #else + #include + #endif + #ifdef PARAMH #include #endif diff -c -r -N irc2.8.21+CSr17/include/comstud.h irc2.8.21+CSr18/include/comstud.h *** irc2.8.21+CSr17/include/comstud.h Fri Dec 22 21:27:21 1995 --- irc2.8.21+CSr18/include/comstud.h Thu Jan 4 22:57:15 1996 *************** *** 1,6 **** --- 1,13 ---- #ifndef COMSTUD_H #define COMSTUD_H + /* RESTRICT - define this if using dog3 stuff, and wish to + disallow /LUSERS, /LIST and other CPU + intensive commands when in HIGH TRAFFIC MODE + */ + + #undef RESTRICT + /* USE_DICH_CONF - define this to try a new code for K: line matching - Note: This is a lot cleaner than Roy's kline patches...as far as CPU usage...someone want to *************** *** 9,15 **** */ #define USE_DICH_CONF ! /* MAXBUFFERS - make receive socket buffers the maximum size they can be...up to 64K NOTE: send buffers will remain at 8K as bad things will happen if --- 16,40 ---- */ #define USE_DICH_CONF ! ! /* B_LINES - Define this if you wish to ignore ip#'s or hosts ! from being tested for bots or clonebots... ! B:*eskimo.com::* will not check for bots or ! clones from eskimo.com domain. ! */ ! ! #define B_LINES ! ! /* E_LINES - Define this if you wish to have lines that bypass ! K: line checking...ie for example: ! You want to K-line all of netcom.com except for ! *cbehrens@*netcom.com, use: ! K:*netcom.com::* ! E:*netcom.com::*cbehrens ! */ ! ! #define E_LINES ! /* MAXBUFFERS - make receive socket buffers the maximum size they can be...up to 64K NOTE: send buffers will remain at 8K as bad things will happen if *************** *** 158,185 **** #define REJECT_IPHONE ! /* REJECT_BOTS - define if you want to reject users from ! connecting to the server with nicks ! with 'bot', 'serv', or 'help' in them. ! Note: you can specify an ip address to ! ignore this ! Note: this doesn't prevent anyone from ! /nick HackBot once on IRC ! */ #define REJECT_BOTS ! /* OPER_CAN_FLOOD1 - define this if you don't need flood protection ! for all /opers including local (o:) ones ! */ ! ! #undef OPER_CAN_FLOOD1 ! ! /* OPER_CAN_FLOOD2 - define this if you want only O: opers to be ! able to flood */ ! #undef OPER_CAN_FLOOD2 /* STATS_NOTICE - send a notice to /opers on the server when someone does /stats requests --- 183,203 ---- #define REJECT_IPHONE ! /* REJECT_BOTS - Performs minimal checking to see if a client ! which is trying to connect is a bot... ! If it is, it will be rejected from connecting. ! See BOTS_NOTICE #define REJECT_BOTS ! /* BOTS_NOTICE - Performs minimal checking to see if a client ! which is trying to connect is a bot... ! If it is, it will send a notice to opers who ! are usermode +r about a possible bot connecting ! (or being rejected if REJECT_BOTS is defined). */ ! #define BOTS_NOTICE /* STATS_NOTICE - send a notice to /opers on the server when someone does /stats requests *************** *** 203,209 **** want them logged */ ! #define FNAME_FAILED_OPER "/home/irc/irc2.8.21+CSr17/lib/logs/failed.log" /* CLIENT_NOTICES - define this if you wish to see client connecting and exiting notices via /umode +c --- 221,227 ---- want them logged */ ! #define FNAME_FAILED_OPER "/home/irc/irc2.8.21+CSr18/lib/logs/failed.log" /* CLIENT_NOTICES - define this if you wish to see client connecting and exiting notices via /umode +c *************** *** 237,243 **** be /reset on notice as well as /msg */ ! #define RESETIDLEONNOTICE /* USERNAMES_IN_TRACE - define this if you want to see usernames --- 255,261 ---- be /reset on notice as well as /msg */ ! #undef RESETIDLEONNOTICE /* USERNAMES_IN_TRACE - define this if you want to see usernames *************** *** 252,266 **** #define USERNAMES_IN_TRACE - /* IDLE_CHECK - define this if you wish to have an idle checker - built into the server - Note: Idletime is not reset on msgs to invalid nicks - or channels - Note: Idletime is not reset on msgs to self - */ - - #define IDLE_CHECK - /* KLINE_CHECK - this is how often (in seconds) that K: lines should be checked. Every fifteen minutes is a good number (900 seconds). This reduces --- 270,275 ---- *************** *** 287,322 **** and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr17/lib/logs/clones.log" ! ! /* DEFAULT_IDLELIMIT - if you have CHECK_IDLE defined above, ! this value is the default # a client ! can be idle before being kicked off of ! IRC ! Note: This value can be changed on IRC with ! /quote idle ! */ ! ! #define DEFAULT_IDLELIMIT 0 ! ! /* IDLE_IGNORE - if you have IDLE_CHECK defined, you ! can use this to specify an ip# that ! will be allowed to idle ! Wildcards are allowed ! Note: If you want everyone to be checked use: ! #define IDLE_IGNORE "" ! */ ! ! #define IDLE_IGNORE "204.122.*" ! ! /* BOT_IP_IGNORE - if you have CLONE_CHECK or REJECT_BOTS ! defined, this can contain an ip# to ignore ! Wildcards are allowed ! Note: If you don't want to ignore an IP use: ! #define BOT_IP_IGNORE "" ! */ ! ! #define BOT_IP_IGNORE "204.122.*" /* THE REST OF THIS STUFF IS TO CONFIGURE CLONE CHECKING */ --- 296,302 ---- and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr18/lib/logs/clones.log" /* THE REST OF THIS STUFF IS TO CONFIGURE CLONE CHECKING */ *************** *** 358,364 **** #define CLONE_TIME 30 ! /* END OF FILE */ #endif /* COMSTUD_H */ --- 338,352 ---- #define CLONE_TIME 30 ! /***********************************************************************/ ! /* DO NOT CHANGE ANYTHING AFTER THIS POINT */ ! /***********************************************************************/ ! ! #if !defined(CLONE_CHECK) && !defined(REJECT_BOTS) && !defined(BOTS_NOTICE) ! #ifdef B_LINES ! #undef B_LINES ! #endif ! #endif #endif /* COMSTUD_H */ diff -c -r -N irc2.8.21+CSr17/include/config.h irc2.8.21+CSr18/include/config.h *** irc2.8.21+CSr17/include/config.h Fri Dec 22 21:27:28 1995 --- irc2.8.21+CSr18/include/config.h Thu Jan 4 23:07:31 1996 *************** *** 107,114 **** * these are only the recommened names and paths. Change as needed. * You must define these to something, even if you don't really want them. */ ! #define DPATH "/home/irc/irc2.8.21+CSr17/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr17/lib/ircd" #define CPATH "ircd.conf" /* server configuration file */ #define MPATH "ircd.motd" /* server MOTD file */ #define LPATH "ircd.log" /* Where the debug file lives, if DEBUGMODE */ --- 107,114 ---- * these are only the recommened names and paths. Change as needed. * You must define these to something, even if you don't really want them. */ ! #define DPATH "/home/irc/irc2.8.21+CSr18/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr18/lib/ircd" #define CPATH "ircd.conf" /* server configuration file */ #define MPATH "ircd.motd" /* server MOTD file */ #define LPATH "ircd.log" /* Where the debug file lives, if DEBUGMODE */ *************** *** 122,129 **** * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr17/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr17/logs/opers.log" /* */ /* CHROOTDIR * --- 122,129 ---- * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr18/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr18/logs/opers.log" /* */ /* CHROOTDIR * diff -c -r -N irc2.8.21+CSr17/include/dich_conf.h irc2.8.21+CSr18/include/dich_conf.h *** irc2.8.21+CSr17/include/dich_conf.h Wed Dec 31 18:00:00 1969 --- irc2.8.21+CSr18/include/dich_conf.h Thu Jan 4 18:19:54 1996 *************** *** 0 **** --- 1,76 ---- + /************************************************************************ + * IRC - Internet Relay Chat, include/dich_conf.h + * Copyright (C) 1995 Philippe Levan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + /* + * The dich_conf.h and dich_conf.c were written to provide a generic interface + * for configuration lines matching. + * I decided to write it after I read Roy's K: line tree patch. + * the underlying ideas are the following : + * . get rid of the left/right branches by using a dichotomy on an ordered + * list + * . arrange patterns matching one another in a tree so that if we find a + * possible match, all other possible matches are "below" + * These routines are meant for fast matching. There is no notion of "best" + * of "first" (meaning the order in which the lines are read) match. + * Therefore, the following functions are fit for K: lines matching but not + * I: lines matching (as sad as it may be). + * Other kinds of configuration lines aren't as time consuming or just aren't + * use for matching so it's irrelevant to try and use these functions for + * anything else. However, I still made them as generic as possible, just + * in case. + * + * -Soleil (Philippe Levan) + * + */ + + #ifndef __dich_conf_h__ + #define __dich_conf_h__ + + #include "struct.h" + + typedef struct ConfList aConfList; + typedef struct ConfEntry aConfEntry; + + struct ConfList + { + unsigned int length; + aConfEntry *conf_list; + }; + + struct ConfEntry + { + char *pattern; + aConfItem *conf; + aConfEntry *next; + aConfList *sub; + }; + + extern void addto_conf_list(); + extern void clear_conf_list(); + extern aConfItem *find_matching_conf(); + extern void l_addto_conf_list(); + extern aConfItem *l_find_matching_conf(); + extern char *host_field(); + extern char *name_field(); + extern char *rev_host_field(); + extern char *rev_name_field(); + extern int sortable(); + extern void report_conf_links(); + + #endif diff -c -r -N irc2.8.21+CSr17/include/h.h irc2.8.21+CSr18/include/h.h *** irc2.8.21+CSr17/include/h.h Fri Dec 22 20:59:01 1995 --- irc2.8.21+CSr18/include/h.h Thu Jan 4 20:13:57 1996 *************** *** 26,31 **** --- 26,53 ---- #include "comstud.h" + #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) + #include "dich_conf.h" + #endif + + #ifdef USE_DICH_CONF + extern aConfList KList1; /* ordered */ + extern aConfList KList2; /* ordered, reversed */ + extern aConfList KList3; /* what we can't sort */ + #endif /* USE_DICH_CONF */ + + #ifdef B_LINES + extern aConfList BList1; /* ordered */ + extern aConfList BList2; /* ordered, reversed */ + extern aConfList BList3; /* what we can't sort */ + #endif /* B_LINES */ + + #ifdef E_LINES + extern aConfList EList1; /* ordered */ + extern aConfList EList2; /* ordered, reversed */ + extern aConfList EList3; /* what we can't sort */ + #endif /* E_LINES */ + #ifdef DOG3 #include "fdlist.h" extern fdlist serv_fdlist; *************** *** 43,52 **** extern aClone *find_clone PROTO(()); #endif ! #ifdef IDLE_CHECK ! extern int idlelimit; ! #endif ! extern int rehashed; extern time_t nextconnect, nextdnscheck, nextping; extern aClient *client, me, *local[]; --- 65,71 ---- extern aClone *find_clone PROTO(()); #endif ! extern time_t NOW; extern int rehashed; extern time_t nextconnect, nextdnscheck, nextping; extern aClient *client, me, *local[]; diff -c -r -N irc2.8.21+CSr17/include/hash.h irc2.8.21+CSr18/include/hash.h *** irc2.8.21+CSr17/include/hash.h Fri Dec 22 20:59:01 1995 --- irc2.8.21+CSr18/include/hash.h Thu Jan 4 20:28:56 1996 *************** *** 26,35 **** void *list; } aHashEntry; - #ifndef DEBUGMODE #define DEFAULT_HASHSIZE 16333 /* prime number */ #define DEFAULT_CHANNELHASHSIZE 7019 /* prime number */ - #endif extern int HASHSIZE; extern int CHANNELHASHSIZE; --- 26,33 ---- diff -c -r -N irc2.8.21+CSr17/include/msg.h irc2.8.21+CSr18/include/msg.h *** irc2.8.21+CSr17/include/msg.h Fri Dec 22 20:59:00 1995 --- irc2.8.21+CSr18/include/msg.h Fri Dec 29 01:19:49 1995 *************** *** 65,73 **** #define MSG_SERVICE "SERVICE" /* SERV -> SRVI */ #define MSG_USERHOST "USERHOST" /* USER -> USRH */ #define MSG_ISON "ISON" /* ISON */ - #ifdef IDLE_CHECK - #define MSG_IDLE "IDLE" /* IDLE */ - #endif #ifdef DOG3 #define MSG_DOG3LOAD "DOG3LOAD" /* DOG3LOAD */ #define MSG_DOG3FREQ "DOG3FREQ" /* DOG3FREQ */ --- 65,70 ---- *************** *** 92,100 **** #endif #define MAXPARA 15 - #ifdef IDLE_CHECK - extern int m_idle(); - #endif #ifdef DOG3 extern int m_dog3load(); extern int m_dog3freq(); --- 89,94 ---- *************** *** 182,190 **** #ifdef TSDEBUG { MSG_TS, m_ts, 0, MAXPARA, 1, 0L }, #endif - #ifdef IDLE_CHECK - { MSG_IDLE, m_idle, 0, MAXPARA, 1 ,0L }, - #endif #ifdef DOG3 { MSG_DOG3LOAD, m_dog3load, 0, MAXPARA, 1 ,0L }, { MSG_DOG3FREQ, m_dog3freq, 0, MAXPARA, 1 ,0L }, --- 176,181 ---- diff -c -r -N irc2.8.21+CSr17/include/numeric.h irc2.8.21+CSr18/include/numeric.h *** irc2.8.21+CSr17/include/numeric.h Fri Dec 22 20:59:00 1995 --- irc2.8.21+CSr18/include/numeric.h Thu Jan 4 18:29:42 1996 *************** *** 298,304 **** #define RPL_ENDOFSTATS 219 #define RPL_UMODEIS 221 ! #define RPL_SERVICEINFO 231 #define RPL_ENDOFSERVICES 232 #define RPL_SERVICE 233 --- 298,306 ---- #define RPL_ENDOFSTATS 219 #define RPL_UMODEIS 221 ! #define RPL_STATSBLINE 222 ! #define RPL_STATSELINE 223 ! #define RPL_SERVICEINFO 231 #define RPL_ENDOFSERVICES 232 #define RPL_SERVICE 233 diff -c -r -N irc2.8.21+CSr17/include/patchlevel.h irc2.8.21+CSr18/include/patchlevel.h *** irc2.8.21+CSr17/include/patchlevel.h Fri Dec 22 21:21:38 1995 --- irc2.8.21+CSr18/include/patchlevel.h Fri Dec 29 01:13:30 1995 *************** *** 17,21 **** */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr17" #endif --- 17,21 ---- */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr18" #endif diff -c -r -N irc2.8.21+CSr17/include/struct.h irc2.8.21+CSr18/include/struct.h *** irc2.8.21+CSr17/include/struct.h Fri Dec 22 21:17:47 1995 --- irc2.8.21+CSr18/include/struct.h Thu Jan 4 19:25:36 1996 *************** *** 55,61 **** typedef struct CloneItem aClone; - #ifndef VMSP #include "class.h" #include "dbuf.h" /* THIS REALLY SHOULDN'T BE HERE!!! --msa */ --- 55,60 ---- *************** *** 266,288 **** #define CONF_ILLEGAL 0x80000000 #define CONF_MATCH 0x40000000 ! #define CONF_QUARANTINED_SERVER 0x0001 ! #define CONF_CLIENT 0x0002 ! #define CONF_CONNECT_SERVER 0x0004 ! #define CONF_NOCONNECT_SERVER 0x0008 ! #define CONF_LOCOP 0x0010 ! #define CONF_OPERATOR 0x0020 ! #define CONF_ME 0x0040 ! #define CONF_KILL 0x0080 ! #define CONF_ADMIN 0x0100 #ifdef R_LINES ! #define CONF_RESTRICT 0x0200 #endif ! #define CONF_CLASS 0x0400 ! #define CONF_SERVICE 0x0800 ! #define CONF_LEAF 0x1000 ! #define CONF_LISTEN_PORT 0x2000 ! #define CONF_HUB 0x4000 #define CONF_OPS (CONF_OPERATOR | CONF_LOCOP) #define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER) --- 265,289 ---- #define CONF_ILLEGAL 0x80000000 #define CONF_MATCH 0x40000000 ! #define CONF_QUARANTINED_SERVER 0x00001 ! #define CONF_CLIENT 0x00002 ! #define CONF_CONNECT_SERVER 0x00004 ! #define CONF_NOCONNECT_SERVER 0x00008 ! #define CONF_LOCOP 0x00010 ! #define CONF_OPERATOR 0x00020 ! #define CONF_ME 0x00040 ! #define CONF_KILL 0x00080 ! #define CONF_ADMIN 0x00100 #ifdef R_LINES ! #define CONF_RESTRICT 0x00200 #endif ! #define CONF_CLASS 0x00400 ! #define CONF_SERVICE 0x00800 ! #define CONF_LEAF 0x01000 ! #define CONF_LISTEN_PORT 0x02000 ! #define CONF_HUB 0x04000 ! #define CONF_BOT_IGNORE 0x08000 ! #define CONF_ELINE 0x10000 #define CONF_OPS (CONF_OPERATOR | CONF_LOCOP) #define CONF_SERVER_MASK (CONF_CONNECT_SERVER | CONF_NOCONNECT_SERVER) diff -c -r -N irc2.8.21+CSr17/ircd/Makefile irc2.8.21+CSr18/ircd/Makefile *** irc2.8.21+CSr17/ircd/Makefile Fri Dec 22 20:59:02 1995 --- irc2.8.21+CSr18/ircd/Makefile Thu Dec 28 23:56:43 1995 *************** *** 186,192 **** s_conf.o: s_conf.c ../include/struct.h ../include/config.h ../include/sys.h \ ../include/common.h ../include/numeric.h ../include/dbuf.h \ ! ../include/comstud.h $(CC) $(CFLAGS) -c s_conf.c s_debug.o: ../include/config.h ../include/struct.h ../include/common.h \ --- 186,192 ---- s_conf.o: s_conf.c ../include/struct.h ../include/config.h ../include/sys.h \ ../include/common.h ../include/numeric.h ../include/dbuf.h \ ! ../include/comstud.h ../include/dich_conf.h $(CC) $(CFLAGS) -c s_conf.c s_debug.o: ../include/config.h ../include/struct.h ../include/common.h \ *************** *** 230,236 **** @/bin/mv -f hash.c.old hash.c @touch hash.o ! dich_conf.o: dich_conf.h ../include/struct.h ../include/common.h \ dich_conf.c $(CC) $(CFLAGS) -c dich_conf.c --- 230,236 ---- @/bin/mv -f hash.c.old hash.c @touch hash.o ! dich_conf.o: ../include/dich_conf.h ../include/struct.h ../include/common.h \ dich_conf.c $(CC) $(CFLAGS) -c dich_conf.c diff -c -r -N irc2.8.21+CSr17/ircd/channel.c irc2.8.21+CSr18/ircd/channel.c *** irc2.8.21+CSr17/ircd/channel.c Fri Dec 22 21:09:10 1995 --- irc2.8.21+CSr18/ircd/channel.c Thu Jan 4 22:57:56 1996 *************** *** 233,239 **** #ifdef USE_UH } #endif ! ban->value.ban.when = time(NULL); #else ban->value.cp = (char *)MyMalloc(strlen(banid)+1); (void)strcpy(ban->value.cp, banid); --- 233,239 ---- #ifdef USE_UH } #endif ! ban->value.ban.when = NOW; #else ban->value.cp = (char *)MyMalloc(strlen(banid)+1); (void)strcpy(ban->value.cp, banid); *************** *** 1608,1614 **** */ if (MyClient(sptr) && flags) { ! chptr->channelts = time(NULL) + timedelta; sendto_match_TS_servs(0, chptr, cptr, ":%s JOIN :%s", parv[0], name); sendto_match_TS_servs(1, chptr, cptr, --- 1608,1614 ---- */ if (MyClient(sptr) && flags) { ! chptr->channelts = NOW + timedelta; sendto_match_TS_servs(0, chptr, cptr, ":%s JOIN :%s", parv[0], name); sendto_match_TS_servs(1, chptr, cptr, *************** *** 1927,1933 **** strncpyzt(chptr->topic, topic, sizeof(chptr->topic)); #ifdef TOPIC_INFO strcpy(chptr->topic_nick, sptr->name); ! chptr->topic_time = time(NULL); #endif sendto_match_servs(chptr, cptr,":%s TOPIC %s :%s", parv[0], chptr->chname, --- 1927,1933 ---- strncpyzt(chptr->topic, topic, sizeof(chptr->topic)); #ifdef TOPIC_INFO strcpy(chptr->topic_nick, sptr->name); ! chptr->topic_time = NOW; #endif sendto_match_servs(chptr, cptr,":%s TOPIC %s :%s", parv[0], chptr->chname, *************** *** 2045,2051 **** aChannel *chptr; char *name, *p = NULL; ! #ifdef DOG3 if (lifesux && !IsAnOper(sptr)) { sendto_one(sptr, rpl_str(RPL_LOAD2HI), me.name, --- 2045,2051 ---- aChannel *chptr; char *name, *p = NULL; ! #if defined(DOG3) && defined(RESTRICT) if (lifesux && !IsAnOper(sptr)) { sendto_one(sptr, rpl_str(RPL_LOAD2HI), me.name, diff -c -r -N irc2.8.21+CSr17/ircd/clone.c irc2.8.21+CSr18/ircd/clone.c *** irc2.8.21+CSr17/ircd/clone.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/clone.c Wed Jan 3 21:45:36 1996 *************** *** 21,29 **** if (!(acl = (aClone *)MyMalloc(size))) outofmemory(); bzero((char *)acl, (int)size); ! strcpy(acl->hostname, ""); acl->num = 0; ! acl->last = time(NULL); acl->prev = NULL; if (Clones) Clones->prev = acl; --- 21,29 ---- if (!(acl = (aClone *)MyMalloc(size))) outofmemory(); bzero((char *)acl, (int)size); ! *acl->hostname = (char) 0; acl->num = 0; ! acl->last = NOW; acl->prev = NULL; if (Clones) Clones->prev = acl; *************** *** 65,71 **** Reg2 aClone *temp; time_t old; ! old = time(NULL); while (acl != NULL) { temp = acl->next; --- 65,71 ---- Reg2 aClone *temp; time_t old; ! old = NOW; while (acl != NULL) { temp = acl->next; diff -c -r -N irc2.8.21+CSr17/ircd/dich_conf.c irc2.8.21+CSr18/ircd/dich_conf.c *** irc2.8.21+CSr17/ircd/dich_conf.c Fri Dec 22 20:59:04 1995 --- irc2.8.21+CSr18/ircd/dich_conf.c Thu Jan 4 21:54:29 1996 *************** *** 1,11 **** /* * The dich_conf.h and dich_conf.c were written to provide a generic interface * for configuration lines matching. ! * I decided to write it after I read Roy's K: line tree patch and was guided ! * by the following question : why use a tree ? ! * The idea of the tree is to have a left branch and a right branch, with ! * "higher" or "lower" entries on one side or the other : that's the same as ! * dichotomizing, which only requires an ordered list. * These routines are meant for fast matching. There is no notion of "best" * of "first" (meaning the order in which the lines are read) match. * Therefore, the following functions are fit for K: lines matching but not --- 1,31 ---- + /************************************************************************ + * IRC - Internet Relay Chat, ircd/dich_conf.c + * Copyright (C) 1995 Philippe Levan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + /* * The dich_conf.h and dich_conf.c were written to provide a generic interface * for configuration lines matching. ! * I decided to write it after I read Roy's K: line tree patch. ! * the underlying ideas are the following : ! * . get rid of the left/right branches by using a dichotomy on an ordered ! * list ! * . arrange patterns matching one another in a tree so that if we find a ! * possible match, all other possible matches are "below" * These routines are meant for fast matching. There is no notion of "best" * of "first" (meaning the order in which the lines are read) match. * Therefore, the following functions are fit for K: lines matching but not *************** *** 20,51 **** */ #include - #include "struct.h" #include "common.h" #include "sys.h" ! #include "numeric.h" #include "dich_conf.h" #ifndef SYSV #define memmove(x,y,N) bcopy(y,x,N) #endif ! /* ! * The following 2 functions are, in part, borrowed from Roy's K: line tree ! * patch -Sol ! */ ! void ! reverse(s) ! char s[]; ! { ! /* Reverse a string, from K&R C 2nd ed. -roy */ ! int c, i, j; ! for (i = 0, j = strlen(s)-1; i < j; i++, j--) { ! c = s[i]; ! s[i] = s[j]; ! s[j] = c; ! } } /* --- 40,113 ---- */ #include #include "common.h" + #include "struct.h" + + #undef STDLIBH #include "sys.h" ! ! #include "h.h" #include "dich_conf.h" #ifndef SYSV #define memmove(x,y,N) bcopy(y,x,N) #endif ! void report_conf_links(sptr, List, numeric, c) ! aClient *sptr; ! aConfList *List; ! int numeric; ! char c; ! { ! register aConfItem *tmp; ! register int current; ! char *host, *pass, *name; ! static char null[] = ""; ! int port; ! ! if (!List || !List->conf_list) ! return; ! ! for (current = 0; current < List->length; current++) ! { ! aConfEntry *ptr = &List->conf_list[current]; ! ! for(;ptr;ptr=ptr->next) ! { ! if (ptr->sub) ! report_conf_links(sptr, ptr->sub, numeric, c); ! if (!(tmp=ptr->conf)) ! continue; ! host = BadPtr(tmp->host) ? null : tmp->host; ! pass = BadPtr(tmp->passwd) ? null : tmp->passwd; ! name = BadPtr(tmp->name) ? null : tmp->name; ! port = (int)tmp->port; ! if (tmp->status == CONF_KILL) ! sendto_one(sptr, rpl_str(numeric), me.name, ! sptr->name, c, host, pass, ! name, port, get_conf_class(tmp)); ! else ! sendto_one(sptr, rpl_str(numeric), me.name, ! sptr->name, c, host, name, port, ! get_conf_class(tmp)); ! } ! } ! } ! void reverse(s1, s2) ! char *s1; ! char *s2; ! { ! char *start_point; ! ! start_point = s2; ! ! while(*s2) ! s2++; ! s2--; ! while(s2 >= start_point) ! *s1++ = *s2--; ! *s1 = '\0'; } /* *************** *** 67,86 **** lists (will have to use linear functions) -Sol */ ! for (p=my_string;*p && (*p == '*' || *p == '?');p++); if (!*p) return 0; /* only wildcards, not good -Sol */ ! for (;*p && *p != '*' && *p != '?';p++); ! if (*p == 0) return -1; /* string of the form *word : needs reversal -Sol */ rev = (char *) MyMalloc(strlen(my_string)+1); ! strcpy(rev, my_string); ! for (p=rev;*p && (*p == '*' || *p == '?');p++); ! for (;*p && *p != '*' && *p != '?';p++); ! if (*p == 0) { MyFree(rev); return 1; /* string of the form word* -Sol */ --- 129,152 ---- lists (will have to use linear functions) -Sol */ ! if (strchr(my_string, '?')) ! return 0; /* reject strings with '?' as non-sortable ! whoever uses '?' patterns anyway ? -Sol */ ! ! for (p=my_string;*p && (*p == '*');p++); if (!*p) return 0; /* only wildcards, not good -Sol */ ! for (;*p && *p != '*';p++); ! if (!*p) return -1; /* string of the form *word : needs reversal -Sol */ rev = (char *) MyMalloc(strlen(my_string)+1); ! reverse(rev, my_string); ! for (p=rev;*p && (*p == '*');p++); ! for (;*p && *p != '*';p++); ! if (!*p) { MyFree(rev); return 1; /* string of the form word* -Sol */ *************** *** 150,157 **** else ptr = my_conf->host; tmp = (char *) MyMalloc(strlen(ptr)+1); ! strcpy(tmp, ptr); ! reverse(tmp); return tmp; } --- 216,222 ---- else ptr = my_conf->host; tmp = (char *) MyMalloc(strlen(ptr)+1); ! reverse(tmp, ptr); return tmp; } *************** *** 188,196 **** unsigned int length = my_list->length; aConfEntry *base = my_list->conf_list; ! if ((length % 100) == 0) { ! /* List is going to grow : allocate 100 more entries -Sol */ aConfEntry *new; new = (aConfEntry *) MyMalloc((length+100)*sizeof(aConfEntry)); --- 253,262 ---- unsigned int length = my_list->length; aConfEntry *base = my_list->conf_list; ! if ((length % 5) == 0) /* Re-alloc only after 5 entries -Sol */ { ! /* List is going to grow : allocate 5 more entries ! Choose 5 to keep the list as small as possible -Sol */ aConfEntry *new; new = (aConfEntry *) MyMalloc((length+100)*sizeof(aConfEntry)); *************** *** 211,216 **** --- 277,284 ---- /* * This function inserts an entry at the correct location (lexicographicaly * speakin) in the configuration list. + * If the new entry matches entries already in the list, we replace them + * with the new entry and chain them as a list in its "sub" field. * If the field chosen as a criteria is already in the list, we chain the * new entry. -Sol */ *************** *** 239,252 **** base->pattern = field; base->conf = my_conf; base->next = NULL; my_list->length++; return; } while (lower != upper) { ! pos = strcmp(field, base[compare].pattern); ! if (pos == 0) { lower = upper = compare; break; --- 307,322 ---- base->pattern = field; base->conf = my_conf; base->next = NULL; + base->sub = NULL; my_list->length++; return; } while (lower != upper) { ! pos = strcasecmp(field, base[compare].pattern); ! if ((pos == 0) || !matches(field, base[compare].pattern) || ! !matches(base[compare].pattern, field)) { lower = upper = compare; break; *************** *** 262,268 **** compare = (lower+upper)/2; } ! pos = strcmp(field, base[compare].pattern); if (!pos) { --- 332,338 ---- compare = (lower+upper)/2; } ! pos = strcasecmp(field, base[compare].pattern); if (!pos) { *************** *** 273,282 **** --- 343,400 ---- new->pattern = NULL; new->conf = my_conf; new->next = base[compare].next; + new->sub = NULL; base[compare].next = new; } else { + if (!matches(base[compare].pattern, field)) + { + if (!base[compare].sub) + { + base[compare].sub = (aConfList *) + MyMalloc(sizeof(aConfList)); + memset(base[compare].sub, 0, sizeof(aConfList)); + } + addto_conf_list(base[compare].sub, my_conf, cmp_field); + return; + } + if (!matches(field, base[compare].pattern)) + { + unsigned int bottom, top; + aConfList *new; + + /* Look for entries to be moved to sublist. -Sol */ + bottom = compare; + while ((bottom > 0) && + !matches(field, base[bottom-1].pattern)) + bottom--; + top = compare; + while ((top < length-1) && + !matches(field, base[top+1].pattern)) + top++; + + /* Create sublist -Sol */ + new = (aConfList *) MyMalloc(sizeof(aConfList)); + new->length = top-bottom+1; + new->conf_list = (aConfEntry *) + MyMalloc((new->length/5+1)*5* + sizeof(aConfEntry)); + memcpy(new->conf_list, &base[bottom], + new->length*sizeof(aConfEntry)); + /* Pack entries -Sol */ + memmove(&base[bottom+1], &base[top+1], + (length-top-1)*sizeof(aConfEntry)); + /* Don't worry if we are using more memory than + necessary : it will be adjusted next time we + realloc. -Sol */ + base[bottom].pattern = field; + base[bottom].conf = my_conf; + base[bottom].next = NULL; + base[bottom].sub = new; + my_list->length -= (top-bottom); + return; + } if (grow_list(my_list)) base = my_list->conf_list; if (pos > 0) *************** *** 287,292 **** --- 405,411 ---- base[compare+1].pattern = field; base[compare+1].conf = my_conf; base[compare+1].next = NULL; + base[compare+1].sub = NULL; } else { *************** *** 296,301 **** --- 415,421 ---- base[compare].pattern = field; base[compare].conf = my_conf; base[compare].next = NULL; + base[compare].sub = NULL; } my_list->length++; } *************** *** 317,339 **** /* Loop through all patterns to free conf-entries with the same pattern -Sol */ ! for (current = 0; current < my_list->length; current++) ! { ! aConfEntry *ptr = &my_list->conf_list[current]; ! ! while (ptr->next) ! { ! aConfEntry *tmp = ptr->next->next; ! ! if (ptr->next->pattern) ! MyFree(ptr->next->pattern); ! MyFree(ptr->next); ! ptr->next = tmp; ! } ! if (ptr->pattern) ! MyFree(ptr->pattern); ! } ! MyFree(my_list->conf_list); } my_list->length = 0; --- 437,473 ---- /* Loop through all patterns to free conf-entries with the same pattern -Sol */ ! for (current = 0; current < my_list->length; current++) ! { ! aConfEntry *ptr = &my_list->conf_list[current]; ! ! if (ptr->sub) ! { ! clear_conf_list(ptr->sub); ! MyFree(ptr->sub); ! } ! if (ptr->conf) ! free_conf(ptr->conf); ! while (ptr->next) ! { ! aConfEntry *tmp = ptr->next->next; ! ! if (ptr->next->pattern) ! MyFree(ptr->next->pattern); ! if (ptr->next->sub) ! { ! clear_conf_list(ptr->next->sub); ! MyFree(ptr->next->sub); ! } ! if (ptr->next->conf) ! free_conf(ptr->next->conf); ! MyFree(ptr->next); ! ptr->next = tmp; ! } ! if (ptr->pattern) ! MyFree(ptr->pattern); ! } ! MyFree(my_list->conf_list); } my_list->length = 0; *************** *** 350,429 **** aConfList *my_list; char *tomatch; { ! static aConfEntry *base; static aConfEntry *offset; ! static unsigned int lower, upper, compare; static char *name; - int dont_match = 0; if (my_list && tomatch) - if (!my_list->length) - { - lower = upper = compare = -1; - return NULL; - } - - if (!my_list || !tomatch) { ! if (lower == -1) ! return NULL; ! if (offset && offset->next) ! { ! offset = offset->next; ! return offset->conf; ! } - dont_match = 1; - } - else - { base = my_list->conf_list; lower = 0; upper = my_list->length-1; compare = (lower+upper)/2; name = tomatch; - offset = NULL; - } ! while (lower != upper) ! { ! int pos; ! ! if (!dont_match) { if (!matches(base[compare].pattern, name)) { ! offset = &base[compare]; return base[compare].conf; } - } - else - dont_match = 0; ! pos = strcmp(name, base[compare].pattern); ! if (pos < 0) ! upper = compare; ! else ! if (lower == compare) ! lower = compare+1; else ! lower = compare; ! compare = (lower+upper)/2; ! } - if (!dont_match) - { if (!matches(base[compare].pattern, name)) { ! offset = &base[compare]; return base[compare].conf; } - } ! lower = upper = compare = -1; ! return NULL; } /* --- 484,555 ---- aConfList *my_list; char *tomatch; { ! static aConfEntry *matching; static aConfEntry *offset; ! aConfEntry *base; ! unsigned int lower, upper, compare; static char *name; if (my_list && tomatch) { ! matching = NULL; ! if (!my_list->length) ! return NULL; base = my_list->conf_list; lower = 0; upper = my_list->length-1; compare = (lower+upper)/2; name = tomatch; ! while (lower != upper) { + int pos; + if (!matches(base[compare].pattern, name)) { ! matching = offset = &base[compare]; return base[compare].conf; } ! pos = strcasecmp(name, base[compare].pattern); ! if (pos < 0) ! upper = compare; else ! if (lower == compare) ! lower = compare+1; ! else ! lower = compare; ! compare = (lower+upper)/2; ! } if (!matches(base[compare].pattern, name)) { ! matching = offset = &base[compare]; return base[compare].conf; } ! return NULL; ! } ! else ! if (!matching) ! return NULL; ! else ! { ! if (offset->next) ! { ! offset = offset->next; ! return offset->conf; ! } ! if (!matching->sub) ! { ! matching = NULL; ! return NULL; ! } ! return find_matching_conf(matching->sub, name); ! } } /* *************** *** 447,452 **** --- 573,579 ---- base[length].pattern = field; base[length].conf = my_conf; base[length].next = NULL; + base[length].sub = NULL; my_list->length++; } diff -c -r -N irc2.8.21+CSr17/ircd/dich_conf.h irc2.8.21+CSr18/ircd/dich_conf.h *** irc2.8.21+CSr17/ircd/dich_conf.h Fri Dec 22 20:59:04 1995 --- irc2.8.21+CSr18/ircd/dich_conf.h Wed Dec 31 18:00:00 1969 *************** *** 1,54 **** - /* - * The dich_conf.h and dich_conf.c were written to provide a generic interface - * for configuration lines matching. - * I decided to write it after I read Roy's K: line tree patch and was guided - * by the following question : why use a tree ? - * The idea of the tree is to have a left branch and a right branch, with - * "higher" or "lower" entries on one side or the other : that's the same as - * dichotomizing, which only requires an ordered list. - * These routines are meant for fast matching. There is no notion of "best" - * of "first" (meaning the order in which the lines are read) match. - * Therefore, the following functions are fit for K: lines matching but not - * I: lines matching (as sad as it may be). - * Other kinds of configuration lines aren't as time consuming or just aren't - * use for matching so it's irrelevant to try and use these functions for - * anything else. However, I still made them as generic as possible, just - * in case. - * - * -Soleil (Philippe Levan) - * - */ - - #ifndef __dich_conf_h__ - #define __dich_conf_h__ - - #include "struct.h" - - typedef struct ConfList aConfList; - typedef struct ConfEntry aConfEntry; - - struct ConfList - { - unsigned int length; - aConfEntry *conf_list; - }; - - struct ConfEntry - { - char *pattern; - aConfItem *conf; - aConfEntry *next; - }; - - extern void addto_conf_list(); - extern void clear_conf_list(); - extern aConfItem *find_matching_conf(); - extern void l_addto_conf_list(); - extern aConfItem *l_find_matching_conf(); - extern char *host_field(); - extern char *name_field(); - extern char *rev_host_field(); - extern char *rev_name_field(); - extern int sortable(); - - #endif --- 0 ---- diff -c -r -N irc2.8.21+CSr17/ircd/hash.c irc2.8.21+CSr18/ircd/hash.c *** irc2.8.21+CSr17/ircd/hash.c Fri Dec 22 21:18:24 1995 --- irc2.8.21+CSr18/ircd/hash.c Thu Jan 4 22:40:05 1996 *************** *** 36,59 **** #define MAX_NEW (MAX_INITIAL*MAX_SUB) #endif #ifdef DEBUGMODE static aHashEntry *clientTable = NULL; static aHashEntry *channelTable = NULL; static int clhits, clmiss; static int chhits, chmiss; ! int HASHSIZE = 2003; ! int CHANNELHASHSIZE = 607; #else #ifdef DOUGH_HASH - int HASHSIZE = MAX_NEW; - int CHANNELHASHSIZE = DEFAULT_CHANNELHASHSIZE; static aHashEntry clientTable[MAX_NEW]; #else - int HASHSIZE = DEFAULT_HASHSIZE; - int CHANNELHASHSIZE = DEFAULT_CHANNELHASHSIZE; static aHashEntry clientTable[DEFAULT_HASHSIZE]; #endif static aHashEntry channelTable[DEFAULT_CHANNELHASHSIZE]; #endif static int hash_mult[] = { 173, 179, 181, 191, 193, 197, --- 36,66 ---- #define MAX_NEW (MAX_INITIAL*MAX_SUB) #endif + + int CHANNELHASHSIZE = DEFAULT_CHANNELHASHSIZE; + + #ifdef DOUGH_HASH + int HASHSIZE = MAX_NEW; + #else + int HASHSIZE = DEFAULT_HASHSIZE + #endif + #ifdef DEBUGMODE + static aHashEntry *clientTable = NULL; static aHashEntry *channelTable = NULL; static int clhits, clmiss; static int chhits, chmiss; ! #else + #ifdef DOUGH_HASH static aHashEntry clientTable[MAX_NEW]; #else static aHashEntry clientTable[DEFAULT_HASHSIZE]; #endif static aHashEntry channelTable[DEFAULT_CHANNELHASHSIZE]; + #endif static int hash_mult[] = { 173, 179, 181, 191, 193, 197, diff -c -r -N irc2.8.21+CSr17/ircd/ircd.c irc2.8.21+CSr18/ircd/ircd.c *** irc2.8.21+CSr17/ircd/ircd.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/ircd.c Thu Jan 4 20:14:32 1996 *************** *** 36,41 **** --- 36,65 ---- #include #include "h.h" + #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) + #include "dich_conf.h" + #endif + + #ifdef USE_DICH_CONF + /* Lists to do K: line matching -Sol */ + aConfList KList1 = { 0, NULL }; /* ordered */ + aConfList KList2 = { 0, NULL }; /* ordered, reversed */ + aConfList KList3 = { 0, NULL }; /* what we can't sort */ + #endif /* USE_DICH_CONF */ + + #ifdef B_LINES + /* Lists to do B: line matching -Sol */ + aConfList BList1 = { 0, NULL }; /* ordered */ + aConfList BList2 = { 0, NULL }; /* ordered, reversed */ + aConfList BList3 = { 0, NULL }; /* what we can't sort */ + #endif /* B_LINES */ + + #ifdef E_LINES + aConfList EList1 = { 0, NULL }; /* ordered */ + aConfList EList2 = { 0, NULL }; /* ordered, reversed */ + aConfList EList3 = { 0, NULL }; /* what we can't sort */ + #endif /* E_LINES */ + #ifdef DOG3 #include "dog3.h" *************** *** 59,69 **** char clonekillhost[100]; #endif aClient me; /* That's me */ aClient *client = &me; /* Pointer to beginning of Client list */ - #ifdef IDLE_CHECK - int idlelimit; - #endif int rehashed = 1; void server_reboot(); --- 83,91 ---- char clonekillhost[100]; #endif + time_t NOW; aClient me; /* That's me */ aClient *client = &me; /* Pointer to beginning of Client list */ int rehashed = 1; void server_reboot(); *************** *** 288,296 **** int ping = 0, i, rflag = 0, checkit = 0; time_t oldest = 0, timeout; static time_t lastcheck = 0; - #ifdef IDLE_CHECK - register int idleflag; - #endif if (rehashed || (currenttime-lastcheck > KLINE_CHECK)) { --- 310,315 ---- *************** *** 312,323 **** (void)exit_client(cptr, cptr, &me, "Dead socket"); continue; } - #ifdef IDLE_CHECK - idleflag = (idlelimit && MyConnect(cptr) && cptr->user && - !IsAnOper(cptr)&& - (currenttime-cptr->user->last>idlelimit) && - matches(IDLE_IGNORE, inetntoa((char *)&cptr->ip))); - #endif killflag = (checkit && IsPerson(cptr)) ? find_kill(cptr) : 0; #ifdef R_LINES_OFTEN --- 331,336 ---- *************** *** 333,341 **** * is already indented enough so I think its justified. -avalon */ if (!killflag && !rflag && - #ifdef IDLE_CHECK - !idleflag && - #endif IsRegistered(cptr) && (ping >= currenttime - cptr->lasttime)) goto ping_timeout; --- 346,351 ---- *************** *** 346,354 **** * to be active, close this connection too. */ if (killflag || rflag || - #ifdef IDLE_CHECK - idleflag || - #endif ((currenttime - cptr->lasttime) >= (2 * ping) && (cptr->flags & FLAGS_PINGSENT)) || (!IsRegistered(cptr) && --- 356,361 ---- *************** *** 387,397 **** if (killflag && IsPerson(cptr)) sendto_ops("Kill line active for %s", get_client_name(cptr, FALSE)); - #ifdef IDLE_CHECK - if (idleflag && IsPerson(cptr) && IsRegistered(cptr)) - sendto_ops("Idle time limit exceeded for %s", - get_client_name(cptr, FALSE)); - #endif #if defined(R_LINES) && defined(R_LINES_OFTEN) if (IsPerson(cptr) && rflag) sendto_ops("Restricting %s, closing link.", --- 394,399 ---- *************** *** 400,410 **** if (killflag) (void)exit_client(cptr, cptr, &me, "K-Lined"); - #ifdef IDLE_CHECK - else if (idleflag) - (void)exit_client(cptr, cptr, &me, - "Idle time limit exceeded"); - #endif else (void)exit_client(cptr, cptr, &me, "Ping timeout"); i = 0; --- 402,407 ---- *************** *** 488,494 **** { int portarg = 0; uid_t uid, euid; ! time_t delay = 0, now; #ifndef AIX struct rlimit r; #endif --- 485,491 ---- { int portarg = 0; uid_t uid, euid; ! time_t delay = 0; #ifndef AIX struct rlimit r; #endif *************** *** 497,502 **** --- 494,501 ---- the main loop */ time_t nextfdlistcheck=0; /*end of priority code */ #endif + + NOW = time(NULL); #ifdef DBUF_INIT dbuf_init(); /* set up some dbuf stuff to control paging */ #endif *************** *** 505,513 **** r.rlim_max = MAXCONNECTIONS; setrlimit(RLIMIT_NOFILE, &r); #endif - #ifdef IDLE_CHECK - idlelimit = DEFAULT_IDLELIMIT*60; - #endif sbrk0 = (char *)sbrk((size_t)0); uid = getuid(); euid = geteuid(); --- 504,509 ---- *************** *** 744,750 **** make_server(&me); (void)strcpy(me.serv->up, me.name); ! me.lasttime = me.since = me.firsttime = time(NULL); (void)add_to_client_hash_table(me.name, &me); check_class(); --- 740,746 ---- make_server(&me); (void)strcpy(me.serv->up, me.name); ! me.lasttime = me.since = me.firsttime = NOW; (void)add_to_client_hash_table(me.name, &me); check_class(); *************** *** 763,774 **** #ifdef USE_SYSLOG syslog(LOG_NOTICE, "Server Ready"); #endif #ifdef DOG3 ! check_fdlists(time(NULL)); #endif for (;;) { ! now = time(NULL); #ifdef DOG3 { static time_t lasttime=0; --- 759,771 ---- #ifdef USE_SYSLOG syslog(LOG_NOTICE, "Server Ready"); #endif + NOW = time(NULL); #ifdef DOG3 ! check_fdlists(); #endif for (;;) { ! NOW = time(NULL); #ifdef DOG3 { static time_t lasttime=0; *************** *** 776,790 **** static int init=0; static time_t loadcfreq=DEFAULT_LOADCFREQ; ! if (now-lasttime < loadcfreq) goto done_check; if (me.receiveK - dog3loadrecv > lastrecvK) { if (!lifesux) { sendto_ops("Entering high-traffic mode - %uk/%us > %uk/%us", ! me.receiveK-lastrecvK, now-lasttime, ! dog3loadrecv, now-lasttime); loadcfreq *= 2; /* add hysteresis */ lifesux = TRUE; } --- 773,787 ---- static int init=0; static time_t loadcfreq=DEFAULT_LOADCFREQ; ! if (NOW-lasttime < loadcfreq) goto done_check; if (me.receiveK - dog3loadrecv > lastrecvK) { if (!lifesux) { sendto_ops("Entering high-traffic mode - %uk/%us > %uk/%us", ! me.receiveK-lastrecvK, NOW-lasttime, ! dog3loadrecv, NOW-lasttime); loadcfreq *= 2; /* add hysteresis */ lifesux = TRUE; } *************** *** 796,806 **** { lifesux = 0; sendto_ops("Resuming standard operation - %uk/%us <= %uk/%us", ! me.receiveK-lastrecvK, now-lasttime, ! dog3loadrecv, now-lasttime); } } ! lasttime = now; lastrecvK = me.receiveK; done_check: ; --- 793,803 ---- { lifesux = 0; sendto_ops("Resuming standard operation - %uk/%us <= %uk/%us", ! me.receiveK-lastrecvK, NOW-lasttime, ! dog3loadrecv, NOW-lasttime); } } ! lasttime = NOW; lastrecvK = me.receiveK; done_check: ; *************** *** 814,828 **** ** active C lines, this call to Tryconnections is ** made once only; it will return 0. - avalon */ ! if (nextconnect && now >= nextconnect) ! nextconnect = try_connections(now); /* ** DNS checks. One to timeout queries, one for cache expiries. */ ! if (now >= nextdnscheck) ! nextdnscheck = timeout_query_list(now); ! if (now >= nextexpire) ! nextexpire = expire_cache(now); /* ** take the smaller of the two 'timed' event times as ** the time of next event (stops us being late :) - avalon --- 811,825 ---- ** active C lines, this call to Tryconnections is ** made once only; it will return 0. - avalon */ ! if (nextconnect && NOW >= nextconnect) ! nextconnect = try_connections(NOW); /* ** DNS checks. One to timeout queries, one for cache expiries. */ ! if (NOW >= nextdnscheck) ! nextdnscheck = timeout_query_list(NOW); ! if (NOW >= nextexpire) ! nextexpire = expire_cache(NOW); /* ** take the smaller of the two 'timed' event times as ** the time of next event (stops us being late :) - avalon *************** *** 834,840 **** delay = nextping; delay = MIN(nextdnscheck, delay); delay = MIN(nextexpire, delay); ! delay -= now; /* ** Adjust delay to something reasonable [ad hoc values] ** (one might think something more clever here... --msa) --- 831,837 ---- delay = nextping; delay = MIN(nextdnscheck, delay); delay = MIN(nextexpire, delay); ! delay -= NOW; /* ** Adjust delay to something reasonable [ad hoc values] ** (one might think something more clever here... --msa) *************** *** 863,878 **** #endif { static time_t lasttime=0; ! if ((lasttime + (lifesux +1) * 2)< (now = time(NULL))) { read_message(delay,NULL); /* check everything! */ ! lasttime = now; } } #endif Debug((DEBUG_DEBUG ,"Got message(s)")); - now = time(NULL); /* ** ...perhaps should not do these loops every time, ** but only if there is some chance of something --- 860,874 ---- #endif { static time_t lasttime=0; ! if ((lasttime + (lifesux +1) * 2)< NOW) { read_message(delay,NULL); /* check everything! */ ! lasttime = NOW; } } #endif Debug((DEBUG_DEBUG ,"Got message(s)")); /* ** ...perhaps should not do these loops every time, ** but only if there is some chance of something *************** *** 882,892 **** ** ping times) --msa */ #ifdef DOG3 ! if ((now >= nextping && !lifesux) || rehashed) #else ! if ((now >= nextping) || rehashed) #endif ! nextping = check_pings(now); if (dorehash) { --- 878,888 ---- ** ping times) --msa */ #ifdef DOG3 ! if ((NOW >= nextping && !lifesux) || rehashed) #else ! if ((NOW >= nextping) || rehashed) #endif ! nextping = check_pings(NOW); if (dorehash) { *************** *** 901,908 **** flush_connections(me.fd); #ifdef DOG3 /* check which clients are active */ ! if (now > nextfdlistcheck) ! nextfdlistcheck = check_fdlists(now); #endif } } --- 897,904 ---- flush_connections(me.fd); #ifdef DOG3 /* check which clients are active */ ! if (NOW > nextfdlistcheck) ! nextfdlistcheck = check_fdlists(); #endif } } *************** *** 954,960 **** else (void)strcpy(cptr->name, "FD2-Pipe"); Debug((DEBUG_FATAL, "Debug: File <%s> Level: %d at %s", ! cptr->name, cptr->port, myctime(time(NULL)))); } else local[2] = NULL; --- 950,956 ---- else (void)strcpy(cptr->name, "FD2-Pipe"); Debug((DEBUG_FATAL, "Debug: File <%s> Level: %d at %s", ! cptr->name, cptr->port, myctime(NOW))); } else local[2] = NULL; *************** *** 1037,1044 **** } ! time_t check_fdlists(now) ! time_t now; { register aClient *cptr; int pri; /* temp. for priority */ --- 1033,1039 ---- } ! time_t check_fdlists() { register aClient *cptr; int pri; /* temp. for priority */ *************** *** 1070,1075 **** } busycli_fdlist.last_entry=j; /* rest of the fdlist is garbage */ ! return (now + FDLISTCHKFREQ + lifesux * FDLISTCHKFREQ); } #endif /* DOG3 */ --- 1065,1070 ---- } busycli_fdlist.last_entry=j; /* rest of the fdlist is garbage */ ! return (NOW + FDLISTCHKFREQ + lifesux * FDLISTCHKFREQ); } #endif /* DOG3 */ diff -c -r -N irc2.8.21+CSr17/ircd/list.c irc2.8.21+CSr18/ircd/list.c *** irc2.8.21+CSr17/ircd/list.c Fri Dec 22 20:59:02 1995 --- irc2.8.21+CSr18/ircd/list.c Wed Jan 3 22:00:52 1996 *************** *** 129,135 **** (void)strcpy(cptr->username, "unknown"); if (size == CLIENT_LOCAL_SIZE) { ! cptr->since = cptr->lasttime = cptr->firsttime = time(NULL); cptr->confs = NULL; cptr->sockhost[0] = '\0'; cptr->buffer[0] = '\0'; --- 129,135 ---- (void)strcpy(cptr->username, "unknown"); if (size == CLIENT_LOCAL_SIZE) { ! cptr->since = cptr->lasttime = cptr->firsttime = NOW; cptr->confs = NULL; cptr->sockhost[0] = '\0'; cptr->buffer[0] = '\0'; *************** *** 165,171 **** user->joined = 0; user->channel = NULL; user->invited = NULL; ! user->last = time(NULL); cptr->user = user; } return user; --- 165,171 ---- user->joined = 0; user->channel = NULL; user->invited = NULL; ! user->last = NOW; cptr->user = user; } return user; diff -c -r -N irc2.8.21+CSr17/ircd/res.c irc2.8.21+CSr18/ircd/res.c *** irc2.8.21+CSr17/ircd/res.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/res.c Wed Jan 3 22:19:12 1996 *************** *** 87,93 **** int ret = 0; #ifdef LRAND48 ! srand48(time(NULL)); #endif if (op & RES_INITLIST) { --- 87,93 ---- int ret = 0; #ifdef LRAND48 ! srand48(NOW); #endif if (op & RES_INITLIST) { *************** *** 193,199 **** nreq = (ResRQ *)MyMalloc(sizeof(ResRQ)); bzero((char *)nreq, sizeof(ResRQ)); nreq->next = NULL; /* where NULL is non-zero ;) */ ! nreq->sentat = time(NULL); nreq->retries = 3; nreq->resend = 1; nreq->srch = -1; --- 193,199 ---- nreq = (ResRQ *)MyMalloc(sizeof(ResRQ)); bzero((char *)nreq, sizeof(ResRQ)); nreq->next = NULL; /* where NULL is non-zero ;) */ ! nreq->sentat = NOW; nreq->retries = 3; nreq->resend = 1; nreq->srch = -1; *************** *** 1171,1177 **** } else cp->ttl = rptr->ttl; ! cp->expireat = time(NULL) + cp->ttl; rptr->he.h_name = NULL; #ifdef DEBUG Debug((DEBUG_INFO,"make_cache:made cache %#x", cp)); --- 1171,1177 ---- } else cp->ttl = rptr->ttl; ! cp->expireat = NOW + cp->ttl; rptr->he.h_name = NULL; #ifdef DEBUG Debug((DEBUG_INFO,"make_cache:made cache %#x", cp)); *************** *** 1322,1328 **** for(cp = cachetop; cp; cp = cp->list_next) { sendto_one(sptr, "NOTICE %s :Ex %d ttl %d host %s(%s)", ! parv[0], cp->expireat - time(NULL), cp->ttl, cp->he.h_name, inetntoa(cp->he.h_addr)); for (i = 0; cp->he.h_aliases[i]; i++) sendto_one(sptr,"NOTICE %s : %s = %s (CN)", --- 1322,1328 ---- for(cp = cachetop; cp; cp = cp->list_next) { sendto_one(sptr, "NOTICE %s :Ex %d ttl %d host %s(%s)", ! parv[0], cp->expireat - NOW, cp->ttl, cp->he.h_name, inetntoa(cp->he.h_addr)); for (i = 0; cp->he.h_aliases[i]; i++) sendto_one(sptr,"NOTICE %s : %s = %s (CN)", diff -c -r -N irc2.8.21+CSr17/ircd/s_auth.c irc2.8.21+CSr18/ircd/s_auth.c *** irc2.8.21+CSr17/ircd/s_auth.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/s_auth.c Wed Jan 3 22:03:47 1996 *************** *** 190,196 **** cptr->buffer[cptr->count] = '\0'; } ! cptr->lasttime = time(NULL); if ((len > 0) && (cptr->count != (sizeof(cptr->buffer) - 1)) && (sscanf(cptr->buffer, "%hd , %hd : USERID : %*[^:]: %10s", &remp, &locp, ruser) == 3)) --- 190,196 ---- cptr->buffer[cptr->count] = '\0'; } ! cptr->lasttime = NOW; if ((len > 0) && (cptr->count != (sizeof(cptr->buffer) - 1)) && (sscanf(cptr->buffer, "%hd , %hd : USERID : %*[^:]: %10s", &remp, &locp, ruser) == 3)) diff -c -r -N irc2.8.21+CSr17/ircd/s_bsd.c irc2.8.21+CSr18/ircd/s_bsd.c *** irc2.8.21+CSr17/ircd/s_bsd.c Fri Dec 22 21:12:08 1995 --- irc2.8.21+CSr18/ircd/s_bsd.c Wed Jan 3 22:11:23 1996 *************** *** 967,973 **** ircstp->is_sbr += cptr->receiveB; ircstp->is_sks += cptr->sendK; ircstp->is_skr += cptr->receiveK; ! ircstp->is_sti += time(NULL) - cptr->firsttime; if (ircstp->is_sbs > 1023) { ircstp->is_sks += (ircstp->is_sbs >> 10); --- 967,973 ---- ircstp->is_sbr += cptr->receiveB; ircstp->is_sks += cptr->sendK; ircstp->is_skr += cptr->receiveK; ! ircstp->is_sti += NOW - cptr->firsttime; if (ircstp->is_sbs > 1023) { ircstp->is_sks += (ircstp->is_sbs >> 10); *************** *** 986,992 **** ircstp->is_cbr += cptr->receiveB; ircstp->is_cks += cptr->sendK; ircstp->is_ckr += cptr->receiveK; ! ircstp->is_cti += time(NULL) - cptr->firsttime; if (ircstp->is_cbs > 1023) { ircstp->is_cks += (ircstp->is_cbs >> 10); --- 986,992 ---- ircstp->is_cbr += cptr->receiveB; ircstp->is_cks += cptr->sendK; ircstp->is_ckr += cptr->receiveK; ! ircstp->is_cti += NOW - cptr->firsttime; if (ircstp->is_cbs > 1023) { ircstp->is_cks += (ircstp->is_cbs >> 10); *************** *** 1018,1024 **** * a rehash in between, the status has been changed to * CONF_ILLEGAL). But only do this if it was a "good" link. */ ! aconf->hold = time(NULL); aconf->hold += (aconf->hold - cptr->since > HANGONGOODLINK) ? HANGONRETRYDELAY : ConfConFreq(aconf); if (nextconnect > aconf->hold) --- 1018,1024 ---- * a rehash in between, the status has been changed to * CONF_ILLEGAL). But only do this if it was a "good" link. */ ! aconf->hold = NOW; aconf->hold += (aconf->hold - cptr->since > HANGONGOODLINK) ? HANGONRETRYDELAY : ConfConFreq(aconf); if (nextconnect > aconf->hold) *************** *** 1379,1385 **** fd_set *rfd; { Reg1 int dolen = 0, length = 0, done; - time_t now = time(NULL); if (FD_ISSET(cptr->fd, rfd) && !(IsPerson(cptr) && DBufLength(&cptr->recvQ) > 6090)) --- 1379,1384 ---- *************** *** 1391,1413 **** length = recv(cptr->fd, readbuf, rcvbufmax*sizeof(char), 0); #endif ! #ifdef OPER_CAN_FLOOD1 ! if (!IsAnOper(cptr)) ! { ! #else ! # ifdef OPER_CAN_FLOOD2 ! if (!IsOper(cptr)) ! { ! # endif ! #endif ! cptr->lasttime = now; if (cptr->lasttime > cptr->since) cptr->since = cptr->lasttime; - #if defined(OPER_CAN_FLOOD1) || defined(OPER_CAN_FLOOD2) - } - else - cptr->since=cptr->lasttime = now; - #endif cptr->flags &= ~(FLAGS_PINGSENT|FLAGS_NONL); /* * If not ready, fake it so it isnt closed --- 1390,1398 ---- length = recv(cptr->fd, readbuf, rcvbufmax*sizeof(char), 0); #endif ! cptr->lasttime = NOW; if (cptr->lasttime > cptr->since) cptr->since = cptr->lasttime; cptr->flags &= ~(FLAGS_PINGSENT|FLAGS_NONL); /* * If not ready, fake it so it isnt closed *************** *** 1441,1459 **** return exit_client(cptr, cptr, cptr, "dbuf_put fail"); if (IsPerson(cptr) && - #ifdef OPER_CAN_FLOOD1 - !IsAnOper(cptr) && - #else - # ifdef OPER_CAN_FLOOD2 - !IsOper(cptr) && - # endif - #endif DBufLength(&cptr->recvQ) > CLIENT_FLOOD) return exit_client(cptr, cptr, cptr, "Excess Flood"); while (DBufLength(&cptr->recvQ) && !NoNewLine(cptr) && ((cptr->status < STAT_UNKNOWN) || ! (cptr->since - now < 10))) { /* ** If it has become registered as a Service or Server --- 1426,1437 ---- return exit_client(cptr, cptr, cptr, "dbuf_put fail"); if (IsPerson(cptr) && DBufLength(&cptr->recvQ) > CLIENT_FLOOD) return exit_client(cptr, cptr, cptr, "Excess Flood"); while (DBufLength(&cptr->recvQ) && !NoNewLine(cptr) && ((cptr->status < STAT_UNKNOWN) || ! (cptr->since - NOW < 10))) { /* ** If it has become registered as a Service or Server *************** *** 1533,1541 **** #ifdef pyr struct timeval nowt; u_long us; #endif fd_set read_set, write_set; ! time_t delay2 = delay, now; u_long usec = 0; int res, length, fd; int auth = 0; --- 1511,1520 ---- #ifdef pyr struct timeval nowt; u_long us; + time_t now; #endif fd_set read_set, write_set; ! time_t delay2 = delay; u_long usec = 0; int res, length, fd; int auth = 0; *************** *** 1555,1567 **** #ifdef NPATH check_command(&delay, NULL); #endif ! #ifdef pyr ! (void) gettimeofday(&nowt, NULL); ! now = nowt.tv_sec; ! #else ! now = time(NULL); #endif ! for (res = 0;;) { FD_ZERO(&read_set); --- 1534,1544 ---- #ifdef NPATH check_command(&delay, NULL); #endif ! #ifdef pyr ! (void) gettimeofday(&nowt, NULL); ! now = nowt.tv_sec; #endif ! for (res = 0;;) { FD_ZERO(&read_set); *************** *** 1597,1605 **** of clones to the server though, as mbuf's can't be allocated quickly enough... - Comstud */ if ((highest_fd < MAXCONNECTIONS /2 ) || ! (now > cptr->lasttime + 1)) #else ! if (now > (cptr->lasttime + 2)) #endif FD_SET(i, &read_set); else if (delay2 > 2) --- 1574,1582 ---- of clones to the server though, as mbuf's can't be allocated quickly enough... - Comstud */ if ((highest_fd < MAXCONNECTIONS /2 ) || ! (NOW > cptr->lasttime + 1)) #else ! if (NOW > (cptr->lasttime + 2)) #endif FD_SET(i, &read_set); else if (delay2 > 2) *************** *** 1706,1712 **** { FD_CLR(i, &read_set); nfds--; ! cptr->lasttime = time(NULL); /* ** There may be many reasons for error return, but ** in otherwise correctly working environment the --- 1683,1689 ---- { FD_CLR(i, &read_set); nfds--; ! cptr->lasttime = NOW; /* ** There may be many reasons for error return, but ** in otherwise correctly working environment the *************** *** 1745,1751 **** else #endif (void)add_connection(cptr, fd); ! nextping = time(NULL); if (!cptr->acpt) cptr->acpt = &me; } --- 1722,1728 ---- else #endif (void)add_connection(cptr, fd); ! nextping = NOW; if (!cptr->acpt) cptr->acpt = &me; } *************** *** 1979,1985 **** get_sockhost(cptr, aconf->host); add_client_to_list(cptr); ! nextping = time(NULL); return 0; } --- 1956,1962 ---- get_sockhost(cptr, aconf->host); add_client_to_list(cptr); ! nextping = NOW; return 0; } *************** *** 2142,2148 **** time_t now; struct tm *tp; ! now = time(NULL); tp = localtime(&now); if (strlen(linebuf) > (size_t) 9) { --- 2119,2125 ---- time_t now; struct tm *tp; ! now = NOW; tp = localtime(&now); if (strlen(linebuf) > (size_t) 9) { *************** *** 2358,2364 **** Reg1 char *s; struct sockaddr_in from; int n, fromlen = sizeof(from); ! static time_t last = 0, now; static int cnt = 0, mlen = 0; /* --- 2335,2341 ---- Reg1 char *s; struct sockaddr_in from; int n, fromlen = sizeof(from); ! static time_t last = 0; static int cnt = 0, mlen = 0; /* *************** *** 2378,2389 **** Debug((DEBUG_DEBUG,"udp poll")); n = recvfrom(udpfd, readbuf, mlen, 0, &from, &fromlen); ! now = time(NULL); ! if (now == last) if (++cnt > 14) return; cnt = 0; ! last = now; if (n == -1) { --- 2355,2365 ---- Debug((DEBUG_DEBUG,"udp poll")); n = recvfrom(udpfd, readbuf, mlen, 0, &from, &fromlen); ! if (NOW == last) if (++cnt > 14) return; cnt = 0; ! last = NOW; if (n == -1) { diff -c -r -N irc2.8.21+CSr17/ircd/s_conf.c irc2.8.21+CSr18/ircd/s_conf.c *** irc2.8.21+CSr17/ircd/s_conf.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/s_conf.c Thu Jan 4 21:11:18 1996 *************** *** 73,86 **** #include "comstud.h" ! #ifdef USE_DICH_CONF #include "dich_conf.h" ! ! /* Lists to do K: line matching -Sol */ ! aConfList KList1 = { 0, NULL }; /* ordered */ ! aConfList KList2 = { 0, NULL }; /* ordered, reversed */ ! aConfList KList3 = { 0, NULL }; /* what we can't sort */ ! #endif static int check_time_interval PROTO((char *, char *)); static int lookup_confhost PROTO((aConfItem *)); --- 73,81 ---- #include "comstud.h" ! #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) #include "dich_conf.h" ! #endif /* USE_DICH_CONF || B_LINES || E_LINES */ static int check_time_interval PROTO((char *, char *)); static int lookup_confhost PROTO((aConfItem *)); *************** *** 153,159 **** if (index(aconf->host, '@') && *username) { ! strncpyzt(uhost, username, sizeof(uhost)); (void)strcat(uhost, "@"); } else --- 148,156 ---- if (index(aconf->host, '@') && *username) { ! /* strncpyzt(uhost, username, sizeof(uhost)); ! username is limited in length -Sol */ ! strncpyzt(uhost, username, USERLEN+1); (void)strcat(uhost, "@"); } else *************** *** 635,641 **** clear_conf_list(&KList1); clear_conf_list(&KList2); clear_conf_list(&KList3); ! #endif (void) initconf(0); close_listeners(); --- 632,648 ---- clear_conf_list(&KList1); clear_conf_list(&KList2); clear_conf_list(&KList3); ! #endif /* USE_DICH_CONF */ ! #ifdef B_LINES ! clear_conf_list(&BList1); ! clear_conf_list(&BList2); ! clear_conf_list(&BList3); ! #endif /* B_LINES */ ! #ifdef E_LINES ! clear_conf_list(&EList1); ! clear_conf_list(&EList2); ! clear_conf_list(&EList3); ! #endif /* E_LINES */ (void) initconf(0); close_listeners(); *************** *** 720,726 **** {'r', '\r'}, {'t', '\t'}, {'v', '\v'}, {'\\', '\\'}, { 0, 0}}; Reg1 char *tmp, *s; ! int fd, i; char line[512], c[80]; int ccount = 0, ncount = 0; aConfItem *aconf = NULL; --- 727,733 ---- {'r', '\r'}, {'t', '\t'}, {'v', '\v'}, {'\\', '\\'}, { 0, 0}}; Reg1 char *tmp, *s; ! int fd, i, dontadd; char line[512], c[80]; int ccount = 0, ncount = 0; aConfItem *aconf = NULL; *************** *** 785,801 **** --- 792,821 ---- tmp = getfield(line); if (!tmp) continue; + dontadd = 0; switch (*tmp) { case 'A': /* Name, e-mail address of administrator */ case 'a': /* of this server. */ aconf->status = CONF_ADMIN; break; + #ifdef B_LINES + case 'B': /* Addresses that we don't want to check */ + case 'b': /* for bots. */ + aconf->status = CONF_BOT_IGNORE; + break; + #endif /* B_LINES */ case 'C': /* Server where I should try to connect */ case 'c': /* in case of lp failures */ ccount++; aconf->status = CONF_CONNECT_SERVER; break; + #ifdef E_LINES + case 'E': /* Addresses that we don't want to check */ + case 'e': /* for bots. */ + aconf->status = CONF_ELINE; + break; + #endif /* E_LINES */ case 'H': /* Hub server line */ case 'h': aconf->status = CONF_HUB; *************** *** 978,983 **** --- 998,1004 ---- { char *host = host_field(aconf); + dontadd = 1; switch (sortable(host)) { case 0 : *************** *** 991,999 **** break; } ! free(host); } ! #endif (void)collapse(aconf->host); (void)collapse(aconf->name); --- 1012,1064 ---- break; } ! MyFree(host); } ! #endif /* USE_DICH_CONF */ ! #ifdef B_LINES ! if (aconf->host && (aconf->status & CONF_BOT_IGNORE)) ! { ! char *host = host_field(aconf); ! ! dontadd = 1; ! switch (sortable(host)) ! { ! case 0 : ! l_addto_conf_list(&BList3, aconf, host_field); ! break; ! case 1 : ! addto_conf_list(&BList1, aconf, host_field); ! break; ! case -1 : ! addto_conf_list(&BList2, aconf, rev_host_field); ! break; ! } ! ! MyFree(host); ! } ! #endif /* B_LINES */ ! #ifdef E_LINES ! if (aconf->host && (aconf->status & CONF_ELINE)) ! { ! char *host = host_field(aconf); ! ! dontadd = 1; ! switch (sortable(host)) ! { ! case 0 : ! l_addto_conf_list(&EList3, aconf, host_field); ! break; ! case 1 : ! addto_conf_list(&EList1, aconf, host_field); ! break; ! case -1 : ! addto_conf_list(&EList2, aconf, rev_host_field); ! break; ! } ! ! MyFree(host); ! } ! #endif /* E_LINES */ (void)collapse(aconf->host); (void)collapse(aconf->name); *************** *** 1001,1008 **** "Read Init: (%d) (%s) (%s) (%s) (%d) (%d)", aconf->status, aconf->host, aconf->passwd, aconf->name, aconf->port, Class(aconf))); ! aconf->next = conf; ! conf = aconf; aconf = NULL; } if (aconf) --- 1066,1076 ---- "Read Init: (%d) (%s) (%s) (%s) (%d) (%d)", aconf->status, aconf->host, aconf->passwd, aconf->name, aconf->port, Class(aconf))); ! if (!dontadd) ! { ! aconf->next = conf; ! conf = aconf; ! } aconf = NULL; } if (aconf) *************** *** 1013,1019 **** (void)wait(0); #endif check_class(); ! nextping = nextconnect = time(NULL); return 0; } --- 1081,1087 ---- (void)wait(0); #endif check_class(); ! nextping = nextconnect = NOW; return 0; } *************** *** 1082,1087 **** --- 1150,1160 ---- aConfList *list; #endif /* USE_DICH_CONF */ + #ifdef E_LINES + if (find_eline(cptr)) + return 0; + #endif + if (!cptr->user) return 0; *************** *** 1095,1103 **** reply[0] = '\0'; #ifdef USE_DICH_CONF ! rev = (char *) malloc(strlen(host)+1); ! strcpy(rev, host); ! reverse(rev); /* Start with hostnames of the form "*word" (most frequent) -Sol */ list = &KList2; --- 1168,1175 ---- reply[0] = '\0'; #ifdef USE_DICH_CONF ! rev = (char *) MyMalloc(strlen(host)+1); ! reverse(rev, host); /* Start with hostnames of the form "*word" (most frequent) -Sol */ list = &KList2; *************** *** 1151,1157 **** } matched: ! free(rev); # ifdef DICH_CONF_DEBUG if (reply[0] || tmp) --- 1223,1229 ---- } matched: ! MyFree(rev); # ifdef DICH_CONF_DEBUG if (reply[0] || tmp) *************** *** 1191,1196 **** --- 1263,1344 ---- return (tmp ? -1 : 0); } + int find_conf_match(cptr, List1, List2, List3) + aClient *cptr; + aConfList *List1; + aConfList *List2; + aConfList *List3; + { + char *host, *name; + aConfItem *tmp; + char *rev; + aConfList *list; + + if (!cptr->user) + return 0; + + host = cptr->sockhost; + name = cptr->user->username; + + if (strlen(host) > (size_t) HOSTLEN || + (name ? strlen(name) : 0) > (size_t) HOSTLEN) + return (0); + + rev = (char *) MyMalloc(strlen(host)+1); + reverse(rev, host); + + /* Start with hostnames of the form "*word" (most frequent) -Sol */ + list = List2; + while ((tmp = find_matching_conf(list, rev)) != NULL) + { + if (tmp->name && (!name || !match(tmp->name, name)) && + (!tmp->port || (tmp->port == cptr->acpt->port))) + goto found_match; + list = NULL; + } + + /* Try hostnames of the form "word*" -Sol */ + list = List1; + while ((tmp = find_matching_conf(list, host)) != NULL) + { + if (tmp->name && (!name || !match(tmp->name, name)) && + (!tmp->port || (tmp->port == cptr->acpt->port))) + goto found_match; + list = NULL; + } + + /* If none of the above worked, try non-sorted entries -Sol */ + list = List3; + while ((tmp = l_find_matching_conf(list, host)) != NULL) + { + if (tmp->host && tmp->name && (!name || !match(tmp->name, name)) + && (!tmp->port || (tmp->port == cptr->acpt->port))) + goto found_match; + list = NULL; + } + + found_match: + MyFree(rev); + + return (tmp ? -1 : 0); + } + + #ifdef B_LINES + int find_bline(cptr) + aClient *cptr; + { + return find_conf_match(cptr, &BList1, &BList2, &BList3); + } + #endif /* B_LINES */ + + #ifdef E_LINES + int find_eline(cptr) + aClient *cptr; + { + return find_conf_match(cptr, &EList1, &EList2, &EList3); + } + #endif /* E_LINES */ + #ifdef R_LINES /* find_restrict works against host/name and calls an outside program * to determine whether a client is allowed to connect. This allows *************** *** 1323,1329 **** perm_max_hours, perm_max_minutes; int now, perm_min, perm_max; ! tick = time(NULL); tptr = localtime(&tick); now = tptr->tm_hour * 60 + tptr->tm_min; --- 1471,1477 ---- perm_max_hours, perm_max_minutes; int now, perm_min, perm_max; ! tick = NOW; tptr = localtime(&tick); now = tptr->tm_hour * 60 + tptr->tm_min; diff -c -r -N irc2.8.21+CSr17/ircd/s_debug.c irc2.8.21+CSr18/ircd/s_debug.c *** irc2.8.21+CSr17/ircd/s_debug.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/s_debug.c Wed Jan 3 22:12:11 1996 *************** *** 141,152 **** #ifdef DBUF_TAIL 'D', #endif - #ifdef OPER_CAN_FLOOD2 - 'f', - #endif - #ifdef OPER_CAN_FLOOD1 - 'F', - #endif #ifdef HIGHEST_CONNECTON 'h', #endif --- 141,146 ---- *************** *** 156,165 **** #ifdef REJECT_IPHONE 'i', #endif ! #ifdef IDLE_CHECK ! 'I', ! #endif ! #ifdef DONT_SHOW_FAKES 'j', #endif #ifdef QUOTE_KLINE --- 150,156 ---- #ifdef REJECT_IPHONE 'i', #endif ! #ifdef DONT_SEND_FAKES 'j', #endif #ifdef QUOTE_KLINE *************** *** 175,191 **** #ifdef CLIENT_NOTICES 'n', #endif #ifdef FAILED_OPER_NOTICE 'o', #endif #ifdef CLONE_CHECK ! # ifdef CLONE_KILL 'P', # else 'p', # endif #endif ! #ifdef NO_REDUNDANT_MODES 'r', #endif #ifdef NO_SPECIAL --- 166,185 ---- #ifdef CLIENT_NOTICES 'n', #endif + #ifdef BOTS_NOTICE + 'N', + #endif #ifdef FAILED_OPER_NOTICE 'o', #endif #ifdef CLONE_CHECK ! # ifdef KILL_CLONES 'P', # else 'p', # endif #endif ! #ifdef NO_RED_MODES 'r', #endif #ifdef NO_SPECIAL *************** *** 335,341 **** return; } secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec; ! rup = time(NULL) - me.since; if (secs == 0) secs = 1; --- 329,335 ---- return; } secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec; ! rup = NOW - me.since; if (secs == 0) secs = 1; diff -c -r -N irc2.8.21+CSr17/ircd/s_err.c irc2.8.21+CSr18/ircd/s_err.c *** irc2.8.21+CSr17/ircd/s_err.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/s_err.c Thu Jan 4 20:08:35 1996 *************** *** 248,256 **** /* 219 */ RPL_ENDOFSTATS, "%c :End of /STATS report", 0, (char *)NULL, /* 221 */ RPL_UMODEIS, "%s", 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, ! 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, /* 231 */ RPL_SERVICEINFO, (char *)NULL, /* 232 */ RPL_ENDOFSERVICES, (char *)NULL, /* 233 */ RPL_SERVICE, (char *)NULL, --- 248,258 ---- /* 219 */ RPL_ENDOFSTATS, "%c :End of /STATS report", 0, (char *)NULL, /* 221 */ RPL_UMODEIS, "%s", + /* 222 */ RPL_STATSBLINE, "%c %s * %s %d %d", + /* 223 */ RPL_STATSELINE, "%c %s * %s %d %d", 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, ! 0, (char *)NULL, /* 231 */ RPL_SERVICEINFO, (char *)NULL, /* 232 */ RPL_ENDOFSERVICES, (char *)NULL, /* 233 */ RPL_SERVICE, (char *)NULL, diff -c -r -N irc2.8.21+CSr17/ircd/s_misc.c irc2.8.21+CSr18/ircd/s_misc.c *** irc2.8.21+CSr17/ircd/s_misc.c Fri Dec 22 20:59:02 1995 --- irc2.8.21+CSr18/ircd/s_misc.c Thu Jan 4 22:57:03 1996 *************** *** 88,95 **** else if (lt->tm_yday > gm->tm_yday) minswest = (gm->tm_hour - (lt->tm_hour + 24)) * 60; else ! minswest = ((gm->tm_hour + 24) - lt->tm_hour) * 60; ! plus = (minswest > 0) ? '-' : '+'; if (minswest < 0) minswest = -minswest; --- 88,94 ---- else if (lt->tm_yday > gm->tm_yday) minswest = (gm->tm_hour - (lt->tm_hour + 24)) * 60; else ! minswest = ((lt->tm_hour + 24) - gm->tm_hour) * 60; plus = (minswest > 0) ? '-' : '+'; if (minswest < 0) minswest = -minswest; *************** *** 360,366 **** sptr->user->host); #endif #ifdef FNAME_USERLOG ! on_for = time(NULL) - sptr->firsttime; # if defined(USE_SYSLOG) && defined(SYSLOG_USERS) if (IsPerson(sptr)) syslog(LOG_NOTICE, "%s (%3d:%02d:%02d): %s!%s@%s\n", --- 359,365 ---- sptr->user->host); #endif #ifdef FNAME_USERLOG ! on_for = NOW - sptr->firsttime; # if defined(USE_SYSLOG) && defined(SYSLOG_USERS) if (IsPerson(sptr)) syslog(LOG_NOTICE, "%s (%3d:%02d:%02d): %s!%s@%s\n", *************** *** 621,627 **** Reg2 int i; Reg3 struct stats *sp; struct stats tmp; - time_t now = time(NULL); sp = &tmp; bcopy((char *)ircstp, (char *)sp, sizeof(*sp)); --- 620,625 ---- *************** *** 635,641 **** sp->is_sbr += acptr->receiveB; sp->is_sks += acptr->sendK; sp->is_skr += acptr->receiveK; ! sp->is_sti += now - acptr->firsttime; sp->is_sv++; if (sp->is_sbs > 1023) { --- 633,639 ---- sp->is_sbr += acptr->receiveB; sp->is_sks += acptr->sendK; sp->is_skr += acptr->receiveK; ! sp->is_sti += NOW - acptr->firsttime; sp->is_sv++; if (sp->is_sbs > 1023) { *************** *** 654,660 **** sp->is_cbr += acptr->receiveB; sp->is_cks += acptr->sendK; sp->is_ckr += acptr->receiveK; ! sp->is_cti += now - acptr->firsttime; sp->is_cl++; if (sp->is_cbs > 1023) { --- 652,658 ---- sp->is_cbr += acptr->receiveB; sp->is_cks += acptr->sendK; sp->is_ckr += acptr->receiveK; ! sp->is_cti += NOW - acptr->firsttime; sp->is_cl++; if (sp->is_cbs > 1023) { diff -c -r -N irc2.8.21+CSr17/ircd/s_serv.c irc2.8.21+CSr18/ircd/s_serv.c *** irc2.8.21+CSr17/ircd/s_serv.c Fri Dec 22 21:16:06 1995 --- irc2.8.21+CSr18/ircd/s_serv.c Thu Jan 4 22:58:30 1996 *************** *** 41,46 **** --- 41,50 ---- #include #include "h.h" + #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) + #include "dich_conf.h" + #endif + #ifdef DOG3 extern time_t check_fdlists(); #endif *************** *** 180,223 **** #endif /* DOG3 */ - - #ifdef IDLE_CHECK - - int m_idle(cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; - { - int temp; - - if (!MyClient(sptr) || !IsAnOper(sptr)) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - if (!parv[1] || !*parv[1]) - { - sendto_one(sptr, ":%s NOTICE %s :The current idle limit is set at %i minutes", - me.name, parv[0], idlelimit/60); - return 0; - } - temp = atoi(parv[1]); - if (temp && (temp < 10)) - { - sendto_one(sptr, ":%s NOTICE %s :Hello??? Try a number > 10.", - me.name, parv[0]); - return 0; - } - idlelimit = temp*60; - sendto_ops("%s has changed the idle time limit to %i minute(s).", - parv[0], idlelimit/60); - sendto_one(sptr, ":%s NOTICE %s :The idle limit is now set to %i minute(s)", - me.name, parv[0], idlelimit/60); - return 0; - } - - #endif - /* ** m_version ** parv[0] = sender prefix --- 184,189 ---- *************** *** 397,405 **** return 0; if (atoi(parv[3])) ! v = (atol(parv[4]) - (ts_val)time(NULL) - timedelta) / 2; else ! v = atol(parv[4]) - (ts_val)time(NULL) - timedelta; if (ts_servcount() == 1) timedelta += v; --- 363,371 ---- return 0; if (atoi(parv[3])) ! v = (atol(parv[4]) - (ts_val)NOW - timedelta) / 2; else ! v = atol(parv[4]) - (ts_val)NOW - timedelta; if (ts_servcount() == 1) timedelta += v; *************** *** 751,757 **** if (IsUnknown(cptr)) { if (bconf->passwd[0]) ! sendto_one(cptr,"PASS %s :%TS",bconf->passwd); /* ** Pass my info to the new server */ --- 717,723 ---- if (IsUnknown(cptr)) { if (bconf->passwd[0]) ! sendto_one(cptr,"PASS %s :TS",bconf->passwd); /* ** Pass my info to the new server */ *************** *** 781,787 **** if (DoesTS(cptr)) sendto_one(cptr, "SVINFO %d %d %d :%ld", TS_CURRENT, TS_MIN, (ts_servcount() == 0 ? 1 : 0), ! (ts_val)time(NULL) + timedelta); det_confs_butmask(cptr, CONF_LEAF|CONF_HUB|CONF_NOCONNECT_SERVER); /* --- 747,753 ---- if (DoesTS(cptr)) sendto_one(cptr, "SVINFO %d %d %d :%ld", TS_CURRENT, TS_MIN, (ts_servcount() == 0 ? 1 : 0), ! (ts_val)NOW + timedelta); det_confs_butmask(cptr, CONF_LEAF|CONF_HUB|CONF_NOCONNECT_SERVER); /* *************** *** 801,809 **** /* adds to fdlist */ addto_fdlist(cptr->fd,&serv_fdlist); /* this causes the server to be marked as "busy" */ ! check_fdlists(time(NULL)); #endif ! nextping = time(NULL); sendto_ops("Link with %s established.", inpath); (void)add_to_client_hash_table(cptr->name, cptr); /* doesnt duplicate cptr->serv if allocted this struct already */ --- 767,775 ---- /* adds to fdlist */ addto_fdlist(cptr->fd,&serv_fdlist); /* this causes the server to be marked as "busy" */ ! check_fdlists(); #endif ! nextping = NOW; sendto_ops("Link with %s established.", inpath); (void)add_to_client_hash_table(cptr->name, cptr); /* doesnt duplicate cptr->serv if allocted this struct already */ *************** *** 1186,1192 **** ** it--not reversed as in ircd.conf! */ ! static int report_array[11][3] = { { CONF_CONNECT_SERVER, RPL_STATSCLINE, 'C'}, { CONF_NOCONNECT_SERVER, RPL_STATSNLINE, 'N'}, { CONF_CLIENT, RPL_STATSILINE, 'I'}, --- 1152,1158 ---- ** it--not reversed as in ircd.conf! */ ! static int report_array[11][3] = { { CONF_CONNECT_SERVER, RPL_STATSCLINE, 'C'}, { CONF_NOCONNECT_SERVER, RPL_STATSNLINE, 'N'}, { CONF_CLIENT, RPL_STATSILINE, 'I'}, *************** *** 1303,1315 **** (int)DBufLength(&acptr->sendQ), (int)acptr->sendM, (int)acptr->sendK, (int)acptr->receiveM, (int)acptr->receiveK, ! time(NULL) - acptr->firsttime); } break; case 'C' : case 'c' : report_configured_links(sptr, CONF_CONNECT_SERVER| CONF_NOCONNECT_SERVER); break; case 'H' : case 'h' : report_configured_links(sptr, CONF_HUB|CONF_LEAF); break; --- 1269,1295 ---- (int)DBufLength(&acptr->sendQ), (int)acptr->sendM, (int)acptr->sendK, (int)acptr->receiveM, (int)acptr->receiveK, ! NOW - acptr->firsttime); } break; + #ifdef B_LINES + case 'B' : case 'b' : + report_conf_links(sptr, &BList1, RPL_STATSBLINE, 'B'); + report_conf_links(sptr, &BList2, RPL_STATSBLINE, 'B'); + report_conf_links(sptr, &BList3, RPL_STATSBLINE, 'B'); + break; + #endif case 'C' : case 'c' : report_configured_links(sptr, CONF_CONNECT_SERVER| CONF_NOCONNECT_SERVER); break; + #ifdef E_LINES + case 'E' : case 'e' : + report_conf_links(sptr, &EList1, RPL_STATSELINE, 'E'); + report_conf_links(sptr, &EList2, RPL_STATSELINE, 'E'); + report_conf_links(sptr, &EList3, RPL_STATSELINE, 'E'); + break; + #endif case 'H' : case 'h' : report_configured_links(sptr, CONF_HUB|CONF_LEAF); break; *************** *** 1317,1323 **** --- 1297,1309 ---- report_configured_links(sptr, CONF_CLIENT); break; case 'K' : case 'k' : + #ifdef USE_DICH_CONF + report_conf_links(sptr, &KList1, RPL_STATSKLINE, 'K'); + report_conf_links(sptr, &KList2, RPL_STATSKLINE, 'K'); + report_conf_links(sptr, &KList3, RPL_STATSKLINE, 'K'); + #else report_configured_links(sptr, CONF_KILL); + #endif break; case 'M' : case 'm' : for (mptr = msgtab; mptr->cmd; mptr++) *************** *** 1347,1353 **** { register time_t now; ! now = time(NULL) - me.since; sendto_one(sptr, rpl_str(RPL_STATSUPTIME), me.name, parv[0], now/86400, (now/3600)%24, (now/60)%60, now%60); #ifdef HIGHEST_CONNECTION --- 1333,1339 ---- { register time_t now; ! now = NOW - me.since; sendto_one(sptr, rpl_str(RPL_STATSUPTIME), me.name, parv[0], now/86400, (now/3600)%24, (now/60)%60, now%60); #ifdef HIGHEST_CONNECTION *************** *** 1498,1504 **** if(hunt_server(cptr, sptr, ":%s LUSERS %s :%s", 2, parc, parv) != HUNTED_ISME) return 0; ! #ifdef DOG3 /* this is to reduce load while connecting */ if (lifesux && !IsAnOper(sptr)) { --- 1484,1490 ---- if(hunt_server(cptr, sptr, ":%s LUSERS %s :%s", 2, parc, parv) != HUNTED_ISME) return 0; ! #if defined(DOG3) && defined(RESTRICT) /* this is to reduce load while connecting */ if (lifesux && !IsAnOper(sptr)) { *************** *** 1888,1894 **** } strcpy(host, hostname); ! if (isdigit(*host)) { int i; char *tmp; --- 1874,1880 ---- } strcpy(host, hostname); ! if (isdigit(*(host+strlen(host)-1))) { int i; char *tmp; *************** *** 1937,1942 **** --- 1923,1929 ---- aClient *acptr; char tempuser[30]; char temphost[512]; + aConfItem *aconf; if (!MyClient(sptr) || #ifdef NO_LOCAL_KLINE *************** *** 1969,1986 **** } if (!*host) host = "*"; ! if (*user == '~') ! user++; ! if (*user != '*') ! strcpy(tempuser, "*"); ! else ! strcpy(tempuser, ""); ! strcat(tempuser, user); ! if (*host != '*') ! strcpy(temphost, "*"); ! else ! strcpy(temphost, ""); ! strcat(temphost, host); user = tempuser; host = temphost; } --- 1956,1963 ---- } if (!*host) host = "*"; ! strcpy(tempuser, user); ! strcpy(temphost, host); user = tempuser; host = temphost; } *************** *** 2009,2014 **** --- 1986,2023 ---- parv[0]); return 0; } + #ifdef USE_DICH_CONF + aconf = make_conf(); + aconf->status = CONF_KILL; + DupString(aconf->host, host); + if (parv[2]) + sprintf(buffer, "%s", parv[2]); + DupString(aconf->passwd, parv[2] ? buffer : NULL); + DupString(aconf->name, user); + aconf->port = 0; + Class(aconf) = find_class(0); + if ((aconf->status & CONF_KILL) && aconf->host) + { + char *host = host_field(aconf); + + switch (sortable(host)) + { + case 0 : + l_addto_conf_list(&KList3, aconf, host_field); + break; + case 1 : + addto_conf_list(&KList1, aconf, host_field); + break; + case -1 : + addto_conf_list(&KList2, aconf, rev_host_field); + break; + } + MyFree(host); + } + rehashed = 1; + sendto_ops("%s added K-Line for [%s@%s]", parv[0], user, host); + sendto_one(sptr, ":%s NOTICE %s :Added K-Line [%s@%s] to server configfile", me.name, parv[0], user, host); + #endif /* USE_DICH_CONF */ if ((out = open(configfile, O_WRONLY|O_APPEND))==-1) { sendto_one(sptr, ":%s NOTICE %s :Problem opening server configfile", me.name, parv[0]); *************** *** 2034,2042 **** --- 2043,2055 ---- return 0; } close(out); + #ifdef USE_DICH_CONF + return 0; + #else sendto_ops("%s added K-Line for [%s@%s]", parv[0], user, host); sendto_one(sptr, ":%s NOTICE %s :Added K-Line [%s@%s] to server configfile", me.name, parv[0], user, host); return rehash(cptr, sptr, 0); + #endif } #endif /* QUOTE_KLINE */ *************** *** 2121,2127 **** char *tname; int doall, link_s[MAXCONNECTIONS], link_u[MAXCONNECTIONS]; int cnt = 0, wilds, dow; - time_t now; if (check_registered(sptr)) return 0; --- 2134,2139 ---- *************** *** 2135,2141 **** tname = parv[1]; else tname = me.name; - now = time(NULL); switch (hunt_server(cptr, sptr, ":%s TRACE :%s", 1, parc, parv)) { case HUNTED_PASS: /* note: gets here only if parv[1] exists */ --- 2147,2152 ---- *************** *** 2238,2244 **** #else 0, #endif ! now-acptr->lasttime); cnt++; } break; --- 2249,2255 ---- #else 0, #endif ! NOW-acptr->lasttime); cnt++; } break; diff -c -r -N irc2.8.21+CSr17/ircd/s_user.c irc2.8.21+CSr18/ircd/s_user.c *** irc2.8.21+CSr17/ircd/s_user.c Fri Dec 22 21:17:31 1995 --- irc2.8.21+CSr18/ircd/s_user.c Thu Jan 4 22:58:57 1996 *************** *** 384,393 **** anUser *user = sptr->user; int i; int reject = 0; ! /* Moved this to make_user ! user->last = time(NULL); ! -- CS ! */ parv[0] = sptr->name; parv[1] = parv[2] = NULL; --- 384,390 ---- anUser *user = sptr->user; int i; int reject = 0; ! parv[0] = sptr->name; parv[1] = parv[2] = NULL; *************** *** 458,467 **** return exit_client(cptr, sptr, &me, "Bad Password"); } bzero(sptr->passwd, sizeof(sptr->passwd)); ! /* ! * following block for the benefit of time-dependent K:-lines ! */ ! if ((ConfSendq(aconf) <= 1) || find_kill(sptr)) { ircstp->is_ref++; return exit_client(cptr, sptr, &me, "K-lined"); --- 455,462 ---- return exit_client(cptr, sptr, &me, "Bad Password"); } bzero(sptr->passwd, sizeof(sptr->passwd)); ! ! if (find_kill(sptr)) { ircstp->is_ref++; return exit_client(cptr, sptr, &me, "K-lined"); *************** *** 476,516 **** if (oldstatus == STAT_MASTER && MyConnect(sptr)) (void)m_oper(&me, sptr, 1, parv); ! #if defined(REJECT_BOTS) || defined(CLONE_CHECK) ! if (matches(BOT_IP_IGNORE, inetntoa((char *)&cptr->ip))) ! { #endif ! #ifdef REJECT_BOTS if (reject == 1) { ircstp->is_ref++; ! sendto_flagops(5,"Rejecting vlad/joh/com bot: %s [%s@%s]", nick, user->username, user->host); return exit_client(cptr, sptr, &me, "No bots allowed"); } if ((reject == 2) || strstr(nick, "LameHelp")) { ircstp->is_ref++; ! sendto_flagops(5,"Rejecting eggdrop bot: %s [%s@%s]", nick, user->username, user->host); return exit_client(cptr, sptr, &me, "No bots allowed"); } if (reject == 3) { ircstp->is_ref++; ! sendto_flagops(5,"Rejecting ojnk/annoy bot: %s [%s@%s]", nick, user->username, user->host); return exit_client(cptr, sptr, &me, "No bots allowed"); } if (!matches("*bot*", nick)||!matches("*Serv*", nick)|| !matches("*help*", nick)) { ircstp->is_ref++; ! sendto_flagops(5,"Rejecting bot: %s [%s@%s]", nick, user->username, user->host); - return exit_client(cptr, sptr, &me, "No bots allowed"); } ! #endif /* REJECT_BOTS */ #ifdef CLONE_CHECK update_clones(); if ((clone = find_clone(user->host)) == NULL) --- 471,522 ---- if (oldstatus == STAT_MASTER && MyConnect(sptr)) (void)m_oper(&me, sptr, 1, parv); ! #ifdef B_LINES ! if (!find_bline(cptr)) ! { #endif ! #if defined(BOTS_NOTICE) || defined(REJECT_BOTS) if (reject == 1) { ircstp->is_ref++; ! #ifdef BOTS_NOTICE ! sendto_flagops(5,"Possible vlad/joh/com bot: %s [%s@%s]", nick, user->username, user->host); + #endif + #ifdef REJECT_BOTS return exit_client(cptr, sptr, &me, "No bots allowed"); + #endif } if ((reject == 2) || strstr(nick, "LameHelp")) { ircstp->is_ref++; ! #ifdef BOTS_NOTICE ! sendto_flagops(5,"Possible eggdrop bot: %s [%s@%s]", nick, user->username, user->host); + #endif + #ifdef REJECT_BOTS return exit_client(cptr, sptr, &me, "No bots allowed"); + #endif } if (reject == 3) { ircstp->is_ref++; ! #ifdef BOTS_NOTICE ! sendto_flagops(5,"Possible ojnk/annoy bot: %s [%s@%s]", nick, user->username, user->host); + #endif + #ifdef REJECT_BOTS return exit_client(cptr, sptr, &me, "No bots allowed"); + #endif } if (!matches("*bot*", nick)||!matches("*Serv*", nick)|| !matches("*help*", nick)) { ircstp->is_ref++; ! sendto_flagops(5,"Possible bot: %s [%s@%s]", nick, user->username, user->host); } ! #endif /* REJECT_BOTS || BOTS_NOTICE */ #ifdef CLONE_CHECK update_clones(); if ((clone = find_clone(user->host)) == NULL) *************** *** 522,528 **** if (clone) { clone->num++; ! clone->last = time(NULL); if (clone->num == NUM_CLONES) sendto_flagops(1, "CloneBot protection activated against %s", user->host); if (clone->num >= NUM_CLONES) --- 528,534 ---- if (clone) { clone->num++; ! clone->last = NOW; if (clone->num == NUM_CLONES) sendto_flagops(1, "CloneBot protection activated against %s", user->host); if (clone->num >= NUM_CLONES) *************** *** 534,540 **** { (void)irc_sprintf(buf, "%s: Clonebot rejected: %s!%s@%s\n", ! myctime(time(NULL)), parv[0], sptr->user->username, sptr->user->host); (void)write(logfile, buf, strlen(buf)); --- 540,546 ---- { (void)irc_sprintf(buf, "%s: Clonebot rejected: %s!%s@%s\n", ! myctime(NOW), parv[0], sptr->user->username, sptr->user->host); (void)write(logfile, buf, strlen(buf)); *************** *** 552,558 **** } } #endif /* CLONE_CHECK */ ! #if defined(REJECT_BOTS) || defined(CLONE_CHECK) } /* end of check for ip# */ #endif #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) --- 558,564 ---- } } #endif /* CLONE_CHECK */ ! #ifdef B_LINES } /* end of check for ip# */ #endif #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) *************** *** 635,641 **** me.name, version); (void)m_lusers(sptr, sptr, 1, parv); (void)m_motd(sptr, sptr, 1, parv); ! nextping = time(NULL); } else if (IsServer(cptr)) { --- 641,647 ---- me.name, version); (void)m_lusers(sptr, sptr, 1, parv); (void)m_motd(sptr, sptr, 1, parv); ! nextping = NOW; } else if (IsServer(cptr)) { *************** *** 1014,1020 **** if (newts) sptr->tsinfo = newts; else ! newts = sptr->tsinfo = (ts_val)time(NULL) + timedelta; /* copy the nick in place */ (void)strcpy(sptr->name, nick); (void)add_to_client_hash_table(nick, sptr); --- 1020,1026 ---- if (newts) sptr->tsinfo = newts; else ! newts = sptr->tsinfo = (ts_val)NOW + timedelta; /* copy the nick in place */ (void)strcpy(sptr->name, nick); (void)add_to_client_hash_table(nick, sptr); *************** *** 1050,1056 **** ** on that channel. Propagate notice to other servers. */ if (mycmp(parv[0], nick)) ! sptr->tsinfo = newts ? newts : (ts_val)time(NULL) + timedelta; sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); if (sptr->user) --- 1056,1062 ---- ** on that channel. Propagate notice to other servers. */ if (mycmp(parv[0], nick)) ! sptr->tsinfo = newts ? newts : (ts_val)NOW + timedelta; sendto_common_channels(sptr, ":%s NICK :%s", parv[0], nick); if (sptr->user) *************** *** 1070,1076 **** /* This had to be copied here to avoid problems.. */ (void)strcpy(sptr->name, nick); ! sptr->tsinfo = time(NULL) + timedelta; if (sptr->user) /* ** USER already received, now we have NICK. --- 1076,1082 ---- /* This had to be copied here to avoid problems.. */ (void)strcpy(sptr->name, nick); ! sptr->tsinfo = NOW + timedelta; if (sptr->user) /* ** USER already received, now we have NICK. *************** *** 1286,1292 **** parv[0], nick); } if (resetidle && MyConnect(sptr) && sptr->user) ! sptr->user->last = time(NULL); return 0; } --- 1292,1298 ---- parv[0], nick); } if (resetidle && MyConnect(sptr) && sptr->user) ! sptr->user->last = NOW; return 0; } *************** *** 1533,1539 **** found = 0; (void)collapse(nick); /* ! #ifdef DOG3 if (wilds = (index(nick, '?') || index(nick, '*'))) if (lifesux && !IsAnOper(sptr)) { --- 1539,1545 ---- found = 0; (void)collapse(nick); /* ! #if defined(DOG3) && defined(RESTRICT) if (wilds = (index(nick, '?') || index(nick, '*'))) if (lifesux && !IsAnOper(sptr)) { *************** *** 1657,1666 **** sendto_one(sptr, rpl_str(RPL_WHOISIDLE), me.name, parv[0], name, #ifdef SIGNON_TIME ! time(NULL) - user->last, acptr->firsttime); #else ! time(NULL) - user->last); #endif } if (!found) --- 1663,1672 ---- sendto_one(sptr, rpl_str(RPL_WHOISIDLE), me.name, parv[0], name, #ifdef SIGNON_TIME ! NOW - user->last, acptr->firsttime); #else ! NOW - user->last); #endif } if (!found) *************** *** 2267,2273 **** (logfile = open(FNAME_OPERLOG, O_WRONLY|O_APPEND)) != -1) { (void)irc_sprintf(buf, "%s OPER (%s) (%s) by (%s!%s@%s)\n", ! myctime(time(NULL)), name, encr, parv[0], sptr->user->username, sptr->sockhost); (void)write(logfile, buf, strlen(buf)); --- 2273,2279 ---- (logfile = open(FNAME_OPERLOG, O_WRONLY|O_APPEND)) != -1) { (void)irc_sprintf(buf, "%s OPER (%s) (%s) by (%s!%s@%s)\n", ! myctime(NOW), name, encr, parv[0], sptr->user->username, sptr->sockhost); (void)write(logfile, buf, strlen(buf)); *************** *** 2293,2299 **** { (void)irc_sprintf(buf, "%s: %s!%s@%s tried (%s) %s\n", ! myctime(time(NULL)), sptr->name, sptr->user->username, sptr->user->host, name, password); (void)write(logfile, buf, strlen(buf)); --- 2299,2305 ---- { (void)irc_sprintf(buf, "%s: %s!%s@%s tried (%s) %s\n", ! myctime(NOW), sptr->name, sptr->user->username, sptr->user->host, name, password); (void)write(logfile, buf, strlen(buf)); diff -c -r -N irc2.8.21+CSr17/ircd/whowas.c irc2.8.21+CSr18/ircd/whowas.c *** irc2.8.21+CSr17/ircd/whowas.c Fri Dec 22 20:59:03 1995 --- irc2.8.21+CSr18/ircd/whowas.c Wed Jan 3 22:18:06 1996 *************** *** 46,52 **** strncpyzt(np->ww_nick, cptr->name, NICKLEN+1); strncpyzt(np->ww_info, cptr->info, REALLEN+1); np->ww_user = cptr->user; ! np->ww_logout = time(NULL); np->ww_online = (cptr->from != NULL) ? cptr : NULL; np->ww_user->refcnt++; --- 46,52 ---- strncpyzt(np->ww_nick, cptr->name, NICKLEN+1); strncpyzt(np->ww_info, cptr->info, REALLEN+1); np->ww_user = cptr->user; ! np->ww_logout = NOW; np->ww_online = (cptr->from != NULL) ? cptr : NULL; np->ww_user->refcnt++; *************** *** 76,82 **** Reg2 int i = 0; wp = wp2 = &was[ww_index]; ! timelimit = time(NULL)-timelimit; do { if (!mycmp(nick, wp->ww_nick) && wp->ww_logout >= timelimit) --- 76,82 ---- Reg2 int i = 0; wp = wp2 = &was[ww_index]; ! timelimit = NOW-timelimit; do { if (!mycmp(nick, wp->ww_nick) && wp->ww_logout >= timelimit)