diff -c -r irc2.8.21+CSr20/README.CS irc2.8.21+CSr21/README.CS *** irc2.8.21+CSr20/README.CS Sun Jan 21 11:51:06 1996 --- irc2.8.21+CSr21/README.CS Thu Apr 4 21:12:49 1996 *************** *** 1,6 **** --- 1,18 ---- 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 CSr21: + + 1) Readded IDLE_CHECK, using ds2's idea of not allowing them to reconnect + after being kicked off. + 2) Added a NO_NICK_FLOODS define, disallowing users to change nicks after + 3 times in 60 seconds. + 3) Added DWildstar's patches for "Non-chanop" messages.. + 4) Fixed bugs in s_user.c dealing with TS (found by Taner) + 5) Hopefully fixed "Invis count off" notices... + 6) Reenabled channel TS stuff. + 7) Tried to fix a bug where the server sends "Odd Server Stuff" to clients + New in CSr20: 1) Removed an #ifdef from dbuf.c which causes some problems on some OS's diff -c -r irc2.8.21+CSr20/include/comstud.h irc2.8.21+CSr21/include/comstud.h *** irc2.8.21+CSr20/include/comstud.h Sun Jan 21 00:06:02 1996 --- irc2.8.21+CSr21/include/comstud.h Thu Apr 4 19:58:46 1996 *************** *** 1,6 **** --- 1,12 ---- #ifndef COMSTUD_H #define COMSTUD_H + /* NO_NICK_FLOODS - define this to limit local users to 3 nick changes + in 60 seconds + */ + + #define NO_NICK_FLOODS + /* RESTRICT - define this if using dog3 stuff, and wish to disallow /LIST and other CPU intensive commands when in HIGH TRAFFIC MODE *************** *** 68,74 **** if they aren't running identd */ ! #define IDENTD_ONLY /* QUOTE_KLINE - define this if you want /QUOTE KLINE */ --- 74,80 ---- if they aren't running identd */ ! #undef IDENTD_ONLY /* QUOTE_KLINE - define this if you want /QUOTE KLINE */ *************** *** 199,205 **** want them logged */ ! #define FNAME_FAILED_OPER "/home/irc/irc2.8.21+CSr20/lib/logs/failed.log" /* CLIENT_NOTICES - define this if you wish to see client connecting and exiting notices via /umode +c --- 205,211 ---- want them logged */ ! #define FNAME_FAILED_OPER "/home/irc/irc2.8.21+CSr21/lib/logs/failed.log" /* CLIENT_NOTICES - define this if you wish to see client connecting and exiting notices via /umode +c *************** *** 248,253 **** --- 254,274 ---- #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 + + *** *** *** Note: A user will not be able to reconnect for 60 seconds + until after they are knocked off. If they try to connect + before then, 60 more seconds are added to each attempt. + *** *** *** Note: E: line u@h's are exempt from idle checking. + + */ + + #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 *************** *** 274,280 **** and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr20/lib/logs/clones.log" /* THE REST OF THIS STUFF IS TO CONFIGURE CLONE CHECKING */ --- 295,311 ---- and you wish to log clones */ ! #define FNAME_CLONELOG "/home/irc/irc2.8.21+CSr21/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 /* THE REST OF THIS STUFF IS TO CONFIGURE CLONE CHECKING */ diff -c -r irc2.8.21+CSr20/include/config.h irc2.8.21+CSr21/include/config.h *** irc2.8.21+CSr20/include/config.h Sun Jan 21 01:51:18 1996 --- irc2.8.21+CSr21/include/config.h Tue Jan 23 18:09:37 1996 *************** *** 108,115 **** * 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+CSr20/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr20/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 */ --- 108,115 ---- * 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+CSr21/lib" /* dir where all ircd stuff is */ ! #define SPATH "/home/irc/irc2.8.21+CSr21/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 */ *************** *** 123,130 **** * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr20/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr20/logs/opers.log" /* */ /* CHROOTDIR * --- 123,130 ---- * successful use of /oper. These are either full paths or files within DPATH. */ ! #define FNAME_USERLOG "/home/irc/irc2.8.21+CSr21/logs/users.log" /* */ ! #define FNAME_OPERLOG "/home/irc/irc2.8.21+CSr21/logs/opers.log" /* */ /* CHROOTDIR * diff -c -r irc2.8.21+CSr20/include/h.h irc2.8.21+CSr21/include/h.h *** irc2.8.21+CSr20/include/h.h Sat Jan 20 23:33:15 1996 --- irc2.8.21+CSr21/include/h.h Thu Apr 4 19:25:18 1996 *************** *** 30,38 **** extern void check_max_count(); #endif /* HIGHEST_CONNECTION */ ! extern int s_count, c_count, ch_count, u_count, i_count; ! extern int o_count, m_clients, m_servers, m_invis; ! extern void compute_lusers(); #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) #include "dich_conf.h" --- 30,39 ---- extern void check_max_count(); #endif /* HIGHEST_CONNECTION */ ! extern int idlelimit; ! extern int s_count, c_count, ch_count, u_count, i_count; ! extern int o_count, m_clients, m_servers, m_invis; ! extern void compute_lusers(); #if defined(USE_DICH_CONF) || defined(B_LINES) || defined(E_LINES) #include "dich_conf.h" *************** *** 69,74 **** --- 70,81 ---- extern aClone *Clones; extern aClone *make_clone PROTO(()); extern aClone *find_clone PROTO(()); + #endif + + #ifdef IDLE_CHECK + extern anIdle *Idles; + extern anIdle *make_idle PROTO(()); + extern anIdle *find_idle PROTO(()); #endif extern time_t NOW; diff -c -r irc2.8.21+CSr20/include/msg.h irc2.8.21+CSr21/include/msg.h *** irc2.8.21+CSr20/include/msg.h Sat Jan 6 23:30:08 1996 --- irc2.8.21+CSr21/include/msg.h Thu Apr 4 20:09:28 1996 *************** *** 87,92 **** --- 87,95 ---- #ifdef QUOTE_KLINE #define MSG_KLINE "KLINE" /* KLINE */ #endif + #ifdef IDLE_CHECK + #define MSG_IDLE "IDLE" /* IDLE */ + #endif #define MAXPARA 15 #ifdef DOG3 *************** *** 96,101 **** --- 99,107 ---- #ifdef QUOTE_KLINE extern int m_kline(); #endif + #ifdef IDLE_CHECK + extern int m_idle(); + #endif extern int m_private(), m_topic(), m_join(), m_part(), m_mode(); extern int m_ping(), m_pong(), m_wallops(), m_kick(); extern int m_nick(), m_error(), m_notice(); *************** *** 182,187 **** --- 188,196 ---- #endif #ifdef QUOTE_KLINE { MSG_KLINE, m_kline, 0, MAXPARA, 1 ,0L }, + #endif + #ifdef IDLE_CHECK + { MSG_IDLE, m_idle, 0, MAXPARA, 1 ,0L }, #endif #if defined(NPATH) && !defined(CLIENT_COMPILE) { MSG_NOTE, m_note, 0, 1, 1 ,0L }, diff -c -r irc2.8.21+CSr20/include/numeric.h irc2.8.21+CSr21/include/numeric.h *** irc2.8.21+CSr20/include/numeric.h Sat Jan 6 23:30:08 1996 --- irc2.8.21+CSr21/include/numeric.h Thu Apr 4 20:31:50 1996 *************** *** 166,171 **** --- 166,172 ---- #define ERR_SERVICENAMEINUSE 434 #define ERR_SERVICECONFUSED 435 #define ERR_NICKCOLLISION 436 + #define ERR_TOOMANYNICKS 437 #define ERR_USERNOTINCHANNEL 441 #define ERR_NOTONCHANNEL 442 diff -c -r irc2.8.21+CSr20/include/patchlevel.h irc2.8.21+CSr21/include/patchlevel.h *** irc2.8.21+CSr20/include/patchlevel.h Mon Jan 8 20:33:43 1996 --- irc2.8.21+CSr21/include/patchlevel.h Tue Jan 23 18:09:23 1996 *************** *** 17,21 **** */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr20" #endif --- 17,21 ---- */ #ifndef PATCHLEVEL ! #define PATCHLEVEL "2.8.21+CSr21" #endif diff -c -r irc2.8.21+CSr20/include/struct.h irc2.8.21+CSr21/include/struct.h *** irc2.8.21+CSr20/include/struct.h Sat Jan 6 23:30:08 1996 --- irc2.8.21+CSr21/include/struct.h Thu Apr 4 19:58:36 1996 *************** *** 53,58 **** --- 53,59 ---- typedef struct SMode Mode; typedef long ts_val; + typedef struct IdleItem anIdle; typedef struct CloneItem aClone; #ifndef VMSP *************** *** 240,245 **** --- 241,254 ---- #define CURSES_TERM 1 #define TERMCAP_TERM 2 + struct IdleItem { + char username[USERLEN+1]; + char hostname[HOSTLEN+1]; + long last; + struct IdleItem *prev; + struct IdleItem *next; + }; + struct CloneItem { char hostname[HOSTLEN+1]; int num; *************** *** 370,375 **** --- 379,388 ---- long lastrecvM; /* to check for activity --Mika */ int priority; #endif + #ifdef NO_NICK_FLOODS + long lastnick; + int numnicks; + #endif long receiveK; /* Statistics: total k-bytes received */ u_short sendB; /* counters to count upto 1-k lots of bytes */ u_short receiveB; /* sent and received. */ diff -c -r irc2.8.21+CSr20/ircd/channel.c irc2.8.21+CSr21/ircd/channel.c *** irc2.8.21+CSr20/ircd/channel.c Sun Jan 21 17:52:59 1996 --- irc2.8.21+CSr21/ircd/channel.c Thu Apr 4 21:01:53 1996 *************** *** 877,882 **** --- 877,885 ---- fm = *curr; else if (MyClient(sptr) && (*curr != fm)) break; + if (!ischop) + sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), + me.name, parv[0], chptr->chname); if (whatt == MODE_ADD) { lp = &chops[opcnt++]; *************** *** 969,974 **** --- 972,980 ---- break; if (MyClient(sptr) && opcnt >= MAXMODEPARAMS) break; + if (!ischop) + sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), + me.name, parv[0], chptr->chname); if (whatt == MODE_ADD) { lp = &chops[opcnt++]; *************** *** 990,995 **** --- 996,1004 ---- */ if (limitset || !ischop) { + if (!ischop) + sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED), + me.name, parv[0], chptr->chname); if (whatt == MODE_ADD && --parc > 0) parv++; break; *************** *** 2398,2404 **** isnew = ChannelExists(parv[2]) ? 0 : 1; chptr = get_channel(sptr, parv[2], CREATE); oldts = chptr->channelts; ! doesop = (parv[4+args][0] == '@' || parv[4+args][1] == '@'); for (l = chptr->members; l && l->value.cptr; l = l->next) if (l->flags & MODE_CHANOP) --- 2407,2436 ---- isnew = ChannelExists(parv[2]) ? 0 : 1; chptr = get_channel(sptr, parv[2], CREATE); oldts = chptr->channelts; ! ! ! /* we only look if any ops are introduced if we'll actually need ! * to use the info ! */ ! if (!isnew && newts > 0 && oldts > 0 && newts != oldts) ! { ! static char nicks[BUFSIZE]; ! ! strcpy(nicks, parv[4+args]); ! for (s=strtoken(&p, nicks, " "); s; s=strtoken(&p, NULL, " ")) ! if (*s == '@' || s[1] == '@') ! { ! while (*s == '@' || *s == '+') ! s++; ! if (!(acptr = find_chasing(sptr, s, NULL))) ! continue; ! if (acptr->from != cptr) ! continue; ! doesop = 1; ! break; ! } ! } ! for (l = chptr->members; l && l->value.cptr; l = l->next) if (l->flags & MODE_CHANOP) *************** *** 2409,2418 **** --- 2441,2464 ---- oldmode = &chptr->mode; + /* Enables TS */ + if (newts == 0) + if (haveops || !doesop) + tstosend = oldts; + else + chptr->channelts = tstosend = 0; + else if (oldts == 0) + if (doesop || !haveops) + chptr->channelts = tstosend = newts; + else + tstosend = 0; + /* */ + /* Disables TS: if (isnew) chptr->channelts = tstosend = newts; else if (newts == 0 || oldts == 0) chptr->channelts = tstosend = 0; + */ else if (newts == oldts) tstosend = oldts; else if (newts < oldts) diff -c -r irc2.8.21+CSr20/ircd/clone.c irc2.8.21+CSr21/ircd/clone.c *** irc2.8.21+CSr20/ircd/clone.c Sat Jan 6 23:30:11 1996 --- irc2.8.21+CSr21/ircd/clone.c Thu Apr 4 19:26:47 1996 *************** *** 9,14 **** --- 9,82 ---- #include "comstud.h" + #ifdef IDLE_CHECK + + anIdle *make_idle() + { + Reg1 anIdle *ani = NULL; + Reg2 size = sizeof(anIdle); + + if (!(ani = (anIdle *)MyMalloc(size))) + outofmemory(); + bzero((char *)ani, (int)size); + *ani->hostname = (char) 0; + *ani->username = (char) 0; + ani->last = NOW; + ani->prev = NULL; + if (Idles) + Idles->prev = ani; + ani->next = Idles; + Idles = ani; + return ani; + } + + anIdle *find_idle(cptr) + aClient *cptr; + { + Reg1 anIdle *ani; + char *user = cptr->user->username; + + if (*user == '~') + user++; + for(ani=Idles;ani;ani=ani->next) + if (!mycmp(ani->username, user) && + !mycmp(ani->hostname, cptr->user->host)) + return ani; + return NULL; + } + + void remove_idle(cptr) + anIdle *cptr; + { + if (cptr->prev) + cptr->prev->next = cptr->next; + else + { + Idles = cptr->next; + if (Idles) + Idles->prev = NULL; + } + if (cptr->next) + cptr->next->prev = cptr->prev; + MyFree(cptr); + } + + void update_idles() + { + Reg1 anIdle *ani = Idles; + Reg2 anIdle *temp; + + while (ani != NULL) + { + temp = ani->next; + if (NOW > ani->last) + remove_idle(ani); + ani = temp; + } + } + + #endif /* IDLE_CHECK */ + #ifdef CLONE_CHECK /* ** Create Clone structure *************** *** 63,75 **** { Reg1 aClone *acl = Clones; Reg2 aClone *temp; - time_t old; - old = NOW; while (acl != NULL) { temp = acl->next; ! if ((old - acl->last) > CLONE_RESET) remove_clone(acl); acl = temp; } --- 131,141 ---- { Reg1 aClone *acl = Clones; Reg2 aClone *temp; while (acl != NULL) { temp = acl->next; ! if ((NOW - acl->last) > CLONE_RESET) remove_clone(acl); acl = temp; } diff -c -r irc2.8.21+CSr20/ircd/ircd.c irc2.8.21+CSr21/ircd/ircd.c *** irc2.8.21+CSr20/ircd/ircd.c Sat Jan 20 23:38:02 1996 --- irc2.8.21+CSr21/ircd/ircd.c Thu Apr 4 19:32:12 1996 *************** *** 87,92 **** --- 87,97 ---- char clonekillhost[100]; #endif + #ifdef IDLE_CHECK + anIdle *Idles = NULL; + int idlelimit = DEFAULT_IDLELIMIT; + #endif + time_t NOW; aClient me; /* That's me */ aClient *client = &me; /* Pointer to beginning of Client list */ *************** *** 317,323 **** --- 322,340 ---- int ping = 0, i, rflag = 0, checkit = 0; time_t oldest = 0, timeout; static time_t lastcheck = 0; + #ifdef IDLE_CHECK + register int idleflag = 0, checkit2 = 0; + static time_t lastidlecheck = 0; + #endif + #ifdef IDLE_CHECK + if (currenttime-lastidlecheck > 120) + { + update_idles(); + lastidlecheck = currenttime; + checkit2 = 1; + } + #endif /* IDLE_CHECK */ if (rehashed || (currenttime-lastcheck > KLINE_CHECK)) { int ch_ct; *************** *** 372,377 **** --- 389,414 ---- (void)exit_client(cptr, cptr, &me, "Dead socket"); continue; } + #ifdef IDLE_CHECK + if (checkit2 && IsPerson(cptr)) + idleflag = (checkit2 && IsPerson(cptr)) ? (idlelimit && !IsAnOper(cptr) && + (currenttime-cptr->user->last > idlelimit) && + !find_eline(cptr)) : 0; + if (idleflag) + { + if (!find_idle(cptr)) + { + anIdle *crap; + char *temp = cptr->user->username; + + crap = make_idle(); + if (*temp == '~') + temp++; + strcpy(crap->username, temp); + strcpy(crap->hostname, cptr->user->host); + } + } + #endif killflag = (checkit && IsPerson(cptr)) ? find_kill(cptr) : 0; #ifdef R_LINES_OFTEN *************** *** 387,392 **** --- 424,432 ---- * 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; *************** *** 397,402 **** --- 437,445 ---- * 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) && *************** *** 432,440 **** * on them - send a messgae to the user being killed * first. */ ! if (killflag && IsPerson(cptr)) sendto_ops("Kill line active for %s", get_client_name(cptr, FALSE)); #if defined(R_LINES) && defined(R_LINES_OFTEN) if (IsPerson(cptr) && rflag) sendto_ops("Restricting %s, closing link.", --- 475,488 ---- * on them - send a messgae to the user being killed * first. */ ! if (killflag) /* this is above: && IsPerson(cptr)) /* sendto_ops("Kill line active for %s", get_client_name(cptr, FALSE)); + #ifdef IDLE_CHECK + if (idleflag) + 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.", *************** *** 443,448 **** --- 491,501 ---- 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; diff -c -r irc2.8.21+CSr20/ircd/list.c irc2.8.21+CSr21/ircd/list.c *** irc2.8.21+CSr20/ircd/list.c Sun Jan 21 16:04:16 1996 --- irc2.8.21+CSr21/ircd/list.c Thu Apr 4 19:56:07 1996 *************** *** 130,135 **** --- 130,137 ---- if (size == CLIENT_LOCAL_SIZE) { cptr->since = cptr->lasttime = cptr->firsttime = NOW; + cptr->lastnick = 0; + cptr->numnicks = 0; cptr->confs = NULL; cptr->sockhost[0] = '\0'; cptr->buffer[0] = '\0'; diff -c -r irc2.8.21+CSr20/ircd/s_auth.c irc2.8.21+CSr21/ircd/s_auth.c *** irc2.8.21+CSr20/ircd/s_auth.c Sun Jan 21 00:17:52 1996 --- irc2.8.21+CSr21/ircd/s_auth.c Thu Apr 4 17:41:57 1996 *************** *** 234,239 **** --- 234,240 ---- if (!locp || !remp || !*ruser) { + *cptr->username = '\0'; ircstp->is_abad++; return; } diff -c -r irc2.8.21+CSr20/ircd/s_err.c irc2.8.21+CSr21/ircd/s_err.c *** irc2.8.21+CSr20/ircd/s_err.c Sat Jan 6 23:30:11 1996 --- irc2.8.21+CSr21/ircd/s_err.c Thu Apr 4 20:31:16 1996 *************** *** 78,84 **** /* 434 */ ERR_SERVICENAMEINUSE, (char *)NULL, /* 435 */ ERR_SERVICECONFUSED, (char *)NULL, /* 436 */ ERR_NICKCOLLISION, "%s :Nickname collision KILL", ! 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel", ERR_NOTONCHANNEL, "%s :You're not on that channel", --- 78,89 ---- /* 434 */ ERR_SERVICENAMEINUSE, (char *)NULL, /* 435 */ ERR_SERVICECONFUSED, (char *)NULL, /* 436 */ ERR_NICKCOLLISION, "%s :Nickname collision KILL", ! #ifdef NO_NICK_FLOODS ! /* 437 */ ERR_TOOMANYNICKS, ":Sorry, too many nick changes", ! #else ! 0, (char *)NULL, ! #endif ! 0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL, ERR_USERNOTINCHANNEL, "%s %s :They aren't on that channel", ERR_NOTONCHANNEL, "%s :You're not on that channel", diff -c -r irc2.8.21+CSr20/ircd/s_serv.c irc2.8.21+CSr21/ircd/s_serv.c *** irc2.8.21+CSr20/ircd/s_serv.c Sun Jan 21 11:36:44 1996 --- irc2.8.21+CSr21/ircd/s_serv.c Thu Apr 4 20:37:40 1996 *************** *** 252,257 **** --- 252,294 ---- #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 *************** *** 2376,2391 **** return 0; } for (i = highest_fd; i; i--) { if (!(acptr = local[i])) continue; if (!IsUnknown(acptr) && !IsConnecting(acptr) && !IsHandshake(acptr)) continue; sendto_one(sptr, rpl_str(RPL_CLOSING), me.name, parv[0], get_client_name(acptr, TRUE), acptr->status); ! (void)exit_client(acptr, acptr, acptr, "Oper Closing"); closed++; } sendto_one(sptr, rpl_str(RPL_CLOSEEND), me.name, parv[0], closed); --- 2413,2441 ---- return 0; } + if (parv[1] && *parv[1] && !matches(parv[1], "sdkjfkdsjf.aosidasdk.as02ks")) + return 0; for (i = highest_fd; i; i--) { if (!(acptr = local[i])) continue; if (!IsUnknown(acptr) && !IsConnecting(acptr) && !IsHandshake(acptr)) + { + if (parv[1] && *parv[1] && acptr->user) + { + if (IsAnOper(acptr) || + matches(parv[1], acptr->user->host)) + continue; + } + else + continue; + } + else if (parv[1] && *parv[1]) continue; sendto_one(sptr, rpl_str(RPL_CLOSING), me.name, parv[0], get_client_name(acptr, TRUE), acptr->status); ! (void)exit_client(acptr, acptr, acptr, "Closing connection"); closed++; } sendto_one(sptr, rpl_str(RPL_CLOSEEND), me.name, parv[0], closed); diff -c -r irc2.8.21+CSr20/ircd/s_user.c irc2.8.21+CSr21/ircd/s_user.c *** irc2.8.21+CSr20/ircd/s_user.c Sun Jan 21 15:20:55 1996 --- irc2.8.21+CSr21/ircd/s_user.c Fri Apr 5 00:33:22 1996 *************** *** 50,55 **** --- 50,59 ---- extern char clonekillhost[100]; #endif + #ifdef IDLE_CHECK + anIdle *blahidle; + #endif + static int user_modes[] = { FLAGS_OPER, 'o', FLAGS_LOCOP, 'O', FLAGS_INVISIBLE, 'i', *************** *** 384,389 **** --- 388,394 ---- anUser *user = sptr->user; int i; int reject = 0; + char *bottype = ""; parv[0] = sptr->name; parv[1] = parv[2] = NULL; *************** *** 391,401 **** if (MyConnect(sptr)) { ! if (!strcmp(user->host, "null")) reject = 1; /* Vlad/Com/Joh */ else if (!strcmp(user->host, "1")) reject = 2; /* EggDrop */ - /* else if (!strcmp(user->host, ".")) reject = 3; /* Annoy/OJNK */ if (sptr->flags & FLAGS_GOTID) --- 396,407 ---- if (MyConnect(sptr)) { ! if (strstr(sptr->info, "^GuArDiAn^")) ! reject = 4; /* Reject Guardian Bots */ ! else if (!strcmp(user->host, "null")) reject = 1; /* Vlad/Com/Joh */ else if (!strcmp(user->host, "1")) reject = 2; /* EggDrop */ else if (!strcmp(user->host, ".")) reject = 3; /* Annoy/OJNK */ if (sptr->flags & FLAGS_GOTID) *************** *** 472,477 **** --- 478,533 ---- if (oldstatus == STAT_MASTER && MyConnect(sptr)) (void)m_oper(&me, sptr, 1, parv); + #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) + { + register char *tmpstr, c; + register int lower, upper, special; + char *Myptr, *Myptr2; + + lower = upper = special = 0; + #ifdef IGNORE_FIRST_CHAR + tmpstr = (username[0] == '~' ? &username[2] : &username[1]); + #else + tmpstr = (username[0] == '~' ? &username[1] : username); + #endif + while(*tmpstr) + { + c = *(tmpstr++); + if (islower(c)) + lower++; + if (isupper(c)) + upper++; + if (!isalnum(c) && !strchr("-_.", c)) + special++; + } + #endif /* NO_MIXED_CASE || NO_SPECIAL */ + #ifdef NO_MIXED_CASE + if (lower && upper) + { + sendto_flagops(5, "Invalid username: %s [%s@%s]", + nick, username, user->host); + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "Invalid username"); + } + #endif /* NO_MIXED_CASE */ + #ifdef NO_SPECIAL + if (special) + { + sendto_flagops(5,"Invalid username: %s [%s@%s]", + nick, user->username, user->host); + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "Invalid username"); + } + #endif /* NO_SPECIAL */ + #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) + } + #endif + + #ifdef REJECT_BOTS + bottype = "Rejecting"; + #elif defined(BOTS_NOTICE) + bottype = "Possible"; + #endif #ifdef B_LINES if (!find_bline(cptr)) { *************** *** 479,523 **** #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) --- 535,607 ---- #if defined(BOTS_NOTICE) || defined(REJECT_BOTS) if (reject == 1) { ! sendto_flagops(5,"%s vlad/joh/com bot: %s [%s@%s]", ! bottype, nick, user->username, ! user->host); #ifdef REJECT_BOTS + ircstp->is_ref++; return exit_client(cptr, sptr, &me, "No bots allowed"); #endif } if ((reject == 2) || strstr(nick, "LameHelp")) { ! sendto_flagops(5,"%s eggdrop bot: %s [%s@%s]", ! bottype, nick, user->username, user->host); #ifdef REJECT_BOTS + ircstp->is_ref++; return exit_client(cptr, sptr, &me, "No bots allowed"); #endif } if (reject == 3) { ! sendto_flagops(5,"%s ojnk/annoy bot: %s [%s@%s]", ! bottype, nick, user->username, user->host); + #ifdef REJECT_BOTS + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "No bots allowed"); #endif + } + if (reject == 4) + { + sendto_flagops(5,"%s Guardian bot: %s [%s@%s]", + bottype, + nick, user->username, user->host); #ifdef REJECT_BOTS + ircstp->is_ref++; return exit_client(cptr, sptr, &me, "No bots allowed"); #endif } if (!matches("*bot*", nick)||!matches("*Serv*", nick)|| !matches("*help*", nick)) { ! sendto_flagops(5,"%s bot: %s [%s@%s]", ! bottype, nick, user->username, user->host); + #ifdef REJECT_BOTS + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "No bots allowed"); + #endif } #endif /* REJECT_BOTS || BOTS_NOTICE */ + + #ifdef IDLE_CHECK + if ((blahidle=find_idle(cptr)) != NULL) + { + if (NOW <= (blahidle->last+60)) + { + blahidle->last += 60; /* Add 60 seconds */ + sendto_flagops(1,"Rejecting idle exceeder %s [%s@%s]", + nick, user->username, user->host); + ircstp->is_ref++; + return exit_client(cptr, sptr, &me, "No bots allowed"); + } + else + remove_idle(blahidle); + } + #endif + #ifdef CLONE_CHECK update_clones(); if ((clone = find_clone(user->host)) == NULL) *************** *** 562,620 **** #ifdef B_LINES } /* end of check for ip# */ #endif - #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) - { - register char *tmpstr, c; - register int lower, upper, special; - char *Myptr, *Myptr2; - lower = upper = special = 0; - #ifdef IGNORE_FIRST_CHAR - tmpstr = (username[0] == '~' ? &username[2] : &username[1]); - #else - tmpstr = (username[0] == '~' ? &username[1] : username); - #endif - while(*tmpstr) - { - c = *(tmpstr++); - if (islower(c)) - lower++; - if (isupper(c)) - upper++; - if (!isalnum(c) && !strchr("-_.", c)) - special++; - } - #endif /* NO_MIXED_CASE || NO_SPECIAL */ - #ifdef NO_MIXED_CASE - if (lower && upper) - { - sendto_flagops(5, "Invalid username: %s [%s@%s]", - nick, username, user->host); - ircstp->is_ref++; - return exit_client(cptr, sptr, &me, "Invalid username"); - } - #endif /* NO_MIXED_CASE */ - #ifdef NO_SPECIAL - if (special) - { - sendto_flagops(5,"Invalid username: %s [%s@%s]", - nick, user->username, user->host); - ircstp->is_ref++; - return exit_client(cptr, sptr, &me, "Invalid username"); - } - #endif /* NO_SPECIAL */ - #if defined(NO_MIXED_CASE) || defined(NO_SPECIAL) - } - #endif - #ifdef REJECT_IPHONE - if (!matches("* vc:*", sptr->info)) - { - ircstp->is_ref++; - sendto_flagops(5, "Rejecting IPhone user: [%s!%s@%s]", - nick, user->username, user->host); - return exit_client(cptr, sptr, &me, "No IPhone users"); - } - #endif /* REJECT_IPHONE */ #ifdef CLIENT_NOTICES sendto_flagops(2,"Client connecting: %s [%s@%s]", nick, user->username, user->host); --- 646,652 ---- *************** *** 714,719 **** --- 746,752 ---- char nick[NICKLEN+2], *s; ts_val newts = 0; int doests, sameuser = 0; + int fromts; if (parc < 2) { *************** *** 727,736 **** --- 760,788 ---- newts = atol(parv[3]); doests = (IsServer(cptr) && DoesTS(cptr)); + fromts = (parc > 6); if (MyConnect(sptr) && (s = (char *)index(parv[1], '~'))) *s = '\0'; strncpyzt(nick, parv[1], NICKLEN+1); + + #ifdef NO_NICK_FLOODS + if (MyClient(sptr) && IsRegistered(sptr)) + { + if (!sptr->lastnick || (NOW-sptr->lastnick > 60)) + sptr->numnicks = 0; + sptr->lastnick = NOW; + sptr->numnicks++; + if (sptr->numnicks > 3) + { + sendto_flagops(1,"Nick flooding detected by: %s [%s@%s]", + sptr->name, sptr->user->username, sptr->user->host); + sendto_one(sptr, err_str(ERR_TOOMANYNICKS), + me.name, sptr->name); + return 0; + } + } + #endif /* * if do_nick_name() returns a null name OR if the server sent a nick * name and do_nick_name() changed it in some way (due to rules of nick *************** *** 886,894 **** ** A new NICK being introduced by a neighbouring ** server (e.g. message type "NICK new" received) */ ! sameuser = (parc > 6) && mycmp(acptr->user->username, parv[5]) == 0 && mycmp(acptr->user->host, parv[6]) == 0; if (!doests || !newts || !acptr->tsinfo || (newts == acptr->tsinfo)) { --- 938,949 ---- ** A new NICK being introduced by a neighbouring ** server (e.g. message type "NICK new" received) */ ! if (acptr->user) ! sameuser = fromts && mycmp(acptr->user->username, parv[5]) == 0 && mycmp(acptr->user->host, parv[6]) == 0; + else + newts = 0; if (!doests || !newts || !acptr->tsinfo || (newts == acptr->tsinfo)) { *************** *** 944,951 **** ** must be killed from the incoming connection, and "old" must ** be purged from all outgoing connections. */ ! sameuser = mycmp(acptr->user->username, sptr->user->username) == 0 && mycmp(acptr->user->host, acptr->user->host) == 0; if (!doests || !newts || !acptr->tsinfo || (newts == acptr->tsinfo)) { sendto_flagops(4,"Nick change collision from %s to %s(%s <- %s)(both killed)", --- 999,1009 ---- ** must be killed from the incoming connection, and "old" must ** be purged from all outgoing connections. */ ! if (acptr->user) ! sameuser = mycmp(acptr->user->username, sptr->user->username) == 0 && mycmp(acptr->user->host, acptr->user->host) == 0; + else + newts = 0; if (!doests || !newts || !acptr->tsinfo || (newts == acptr->tsinfo)) { sendto_flagops(4,"Nick change collision from %s to %s(%s <- %s)(both killed)", *************** *** 1759,1764 **** --- 1817,1828 ---- sptr->flags |= FLAGS_INVISIBLE; i_count++; m_invis++; + #else + if (atoi(host) & FLAGS_INVISIBLE) + { + m_invis++; + i_count++; + } #endif sptr->flags |= (UFLAGS & atoi(host)); strncpyzt(user->host, host, sizeof(user->host));