From: Perry Lorier Date: Sat, 1 Jul 2000 05:24:56 +0000 (+0000) Subject: Author: Isomer X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=f17f0487c981da8c0c2b450fff45f13fd481a176 Author: Isomer Log message: Well, heres my IPcheck changes. First note that this INTENTIONALLY doesn't compile - to people that like to regularly have the bleeding edge version to bug test - thanks, but this version is just far too unstable, I don't like committing knowingly buggy code, but this is it. (On the other hand, changing a #if 1 to #if 0 makes it compile again if your really feeling insane). I'm interested in various coders to have a look at this, currently this doesn't deal with nick collisions at all, is this my bug? or something left over from what kev did? Theres assert()'s all over the place, if it miscounts then you should have a nice core for you to examine. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@261 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 386e9bb..670e415 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-06-22 Perry Lorier + * ircd/IPcheck.c: Large chunks redone. + * ircd/s_conf.c: Changes due to IPcheck - ONE nolonger supported, + single AND double digit limits are allowed now. + * misc other: Changes to IPcheck. + 2000-06-30 Perry Lorier * ircd/ircd.c: Fix command line parameter bugs. @@ -1245,7 +1251,7 @@ # # ChangeLog for ircu2.10.11 # -# $Id: ChangeLog,v 1.150 2000-06-29 23:44:45 isomer Exp $ +# $Id: ChangeLog,v 1.151 2000-07-01 05:24:55 isomer Exp $ # # Insert new changes at beginning of the change list. # diff --git a/config/config-sh.in b/config/config-sh.in index efbb9ba..9fc336e 100644 --- a/config/config-sh.in +++ b/config/config-sh.in @@ -329,7 +329,6 @@ comment 'Configuration' define_bool R_LINES_REHASH $R_LINES_REHASH define_bool R_LINES_OFTEN $R_LINES_OFTEN fi - bool 'Do you want support for the old I:*:ONE:*:: construct (read help text!)' USEONE n bool 'Send a short message instead of the MOTD to connecting clients' NODEFAULTMOTD y bool 'Kill connecting clients when forward and reverse DNS mismatch' KILL_IPMISMATCH n endmenu diff --git a/doc/Configure.help b/doc/Configure.help index ae51a32..965c7f9 100644 --- a/doc/Configure.help +++ b/doc/Configure.help @@ -332,23 +332,6 @@ HUB too bad to route traffic). Note that on Undernet all newly linked servers are linked as leafs during their test phase, and should specify 'n' here. -Do you want support for the old I:*:ONE:*:: construct -USEONE - Server versions prior to ircu2.10.05 used to use the string "ONE" - as password in an I: line to indicate that only one connection was - allowed for any given IP number that matched that I: line. - This method only counted the *local* connections though. - As of ircu2.10.05 you can specifiy a single(!) digit as password - which then will allow that many connections from the same IP number. - However, now the IP numbers of ALL clients are counted, also those - that are connected to other servers. - If you do not use the depricated "ONE" password in your ircd.conf, - specify 'n' here. Note that if you you DO use the "ONE" password - and you specify 'n' here, then you should change all occurances of - "ONE" to "1" (this is the recommended procedure). - If you are lazy and you don't want to change the "ONE" passwords - into a "1", then specify 'y' here. - Send a short message instead of the MOTD to connecting clients NODEFAULTMOTD Every time a client connects to your server, the full Message Of diff --git a/include/IPcheck.h b/include/IPcheck.h index c177694..088129a 100644 --- a/include/IPcheck.h +++ b/include/IPcheck.h @@ -16,14 +16,12 @@ struct Client; /*---------------------------------------------------------------------------- * Prototypes *--------------------------------------------------------------------------*/ -extern int ip_registry_check_local(unsigned int addr, time_t* next_target_out); -extern void ip_registry_local_connect(struct Client *cptr); -extern void ip_registry_connect_fail(unsigned int addr); extern void ip_registry_expire(void); -extern void ip_registry_disconnect(struct Client *cptr); -extern int ip_registry_count(unsigned int addr); -extern int ip_registry_check_remote(struct Client *cptr, int is_burst); +extern int ip_registry_check_local(unsigned int addr, time_t* next_target_out); +extern int ip_registry_remote_connect(struct Client *cptr); +extern void ip_registry_connect_succeeded(struct Client *cptr); +extern void ip_registry_local_disconnect(struct Client *cptr); +extern void ip_registry_remote_disconnect(struct Client *cptr); extern void ip_registry_connect_succeeded(struct Client *cptr); #endif /* INCLUDED_ipcheck_h */ - diff --git a/ircd/IPcheck.c b/ircd/IPcheck.c index aae5498..2e9dce2 100644 --- a/ircd/IPcheck.c +++ b/ircd/IPcheck.c @@ -31,9 +31,23 @@ #include "send.h" #include +#include #include #include +#if 1 +#warning Nick collisions are horribly broken in +#warning this version, and its known to core on +#warning a whim. If your even concidering +#warning running this on something resembling a +#warning production network, dont bother, its +#warning not worth your time. To those of you +#warning who grabbed the latest CVS version to +#warning bug test it, thanks, but I recommend +#warning you stick to previous versions for the +#warning time being. +#error --- Broken code --- +#endif struct IPTargetEntry { int count; @@ -62,8 +76,9 @@ struct IPRegistryEntry { #define IP_REGISTRY_TABLE_SIZE 0x10000 #define MASK_16 0xffff -#define IPCHECK_CLONE_LIMIT 2 -#define IPCHECK_CLONE_PERIOD 20 +/* We allow 6 connections in 60 seconds */ +#define IPCHECK_CLONE_LIMIT 6 +#define IPCHECK_CLONE_PERIOD 60 #define IPCHECK_CLONE_DELAY 600 @@ -98,7 +113,7 @@ static unsigned int ip_registry_hash(unsigned int ip) *--------------------------------------------------------------------------*/ static struct IPRegistryEntry *ip_registry_find(unsigned int ip) { - struct IPRegistryEntry *entry; + struct IPRegistryEntry *entry = NULL; for (entry = hashTable[ip_registry_hash(ip)]; entry; entry = entry->next) { if (entry->addr == ip) @@ -218,15 +233,16 @@ static void ip_registry_expire_entry(struct IPRegistryEntry *entry) * Don't touch this number, it has statistical significance * XXX - blah blah blah * ZS - Just -what- statistical significance does it -have-? + * Iso - Noone knows, we've just been told not to touch it. */ + if (CONNECTED_SINCE(entry) > 120 && 0 != entry->target) { + MyFree(entry->target); + entry->target = 0; + } if (CONNECTED_SINCE(entry) > 600) { ip_registry_remove(entry); ip_registry_delete_entry(entry); } - else if (CONNECTED_SINCE(entry) > 120 && 0 != entry->target) { - MyFree(entry->target); - entry->target = 0; - } } @@ -257,7 +273,6 @@ void ip_registry_expire(void) /*---------------------------------------------------------------------------- - * IPcheck_local_connect * * Event: * A new connection was accept()-ed with IP number `cptr->ip.s_addr'. @@ -290,116 +305,105 @@ int ip_registry_check_local(unsigned int addr, time_t *next_target_out) assert(0 != next_target_out); + /* If they've never connected before, let them on */ if (0 == entry) { + Debug((DEBUG_DEBUG,"IPcheck: Local user allowed - unseen")); entry = ip_registry_new_entry(addr, 1); return 1; } + + /* Keep track of how many people have connected */ + entry->connected++; - /* Do not allow more than 255 connects from a single IP, EVER. */ - if (0 == ++entry->connected) + /* Do not allow more than 250 connects from a single IP, EVER. */ + if (250 <= entry->connected) { + Debug((DEBUG_DEBUG,"IPcheck: Local user disallowed - Too many connections")); + entry->connected--; return 0; + } - /* If our threshhold has elapsed, reset the counter so we don't throttle */ - if (CONNECTED_SINCE(entry) > IPCHECK_CLONE_PERIOD) + /* If our threshhold has elapsed, reset the counter so we don't throttle, + * IPCHECK_CLONE_LIMIT connections every IPCHECK_CLONE_PERIOD + */ + if (CONNECTED_SINCE(entry) > IPCHECK_CLONE_PERIOD) { entry->attempts = 0; - else if (0 == ++entry->attempts) + entry->last_connect = NOW; + } + + /* Count the number of recent attempts */ + entry->attempts++; + + if (250 <= entry->attempts) --entry->attempts; /* Disallow overflow */ - entry->last_connect = NOW; + free_targets = ip_registry_update_free_targets(entry); - if (entry->attempts < IPCHECK_CLONE_LIMIT && next_target_out) + /* Have they connected less than IPCHECK_CLONE_LIMIT times && next_target_out */ + if (entry->attempts < IPCHECK_CLONE_LIMIT && next_target_out) { *next_target_out = CurrentTime - (TARGET_DELAY * free_targets - 1); - else if ((CurrentTime - me.since) > IPCHECK_CLONE_DELAY) { -#ifdef NOTHROTTLE + entry->last_connect = NOW; + Debug((DEBUG_DEBUG,"IPcheck: Local user allowed")); + return 1; + } + + /* If the server is younger than IPCHECK_CLONE_DELAY then the person + * is allowed on. + */ + if ((CurrentTime - me.since) < IPCHECK_CLONE_DELAY) { + Debug((DEBUG_DEBUG,"IPcheck: Local user allowed during server startup")); return 1; -#else - --entry->connected; - return 0; -#endif } - - return 1; + + /* Otherwise they're throttled */ + entry->connected--; + Debug((DEBUG_DEBUG,"IPcheck: Throttling local user")); + return 0; } /*---------------------------------------------------------------------------- - * ip_registry_local_connect + * ip_registry_remote_connect * * Does anything that needs to be done once we actually have a client - * structure to play with on a local connection that passed the IPcheck test. + * structure to play with on a remote connection. + * returns: + * 1 - allowed to connect + * 0 - disallowed. *--------------------------------------------------------------------------*/ -void ip_registry_local_connect(struct Client *cptr) +int ip_registry_remote_connect(struct Client *cptr) { + struct IPRegistryEntry *entry = ip_registry_find(cptr->ip.s_addr); assert(0 != cptr); - SetIPChecked(cptr); -} - - -/*---------------------------------------------------------------------------- - * IPcheck_remote_connect - * - * Event: - * A remote client connected to Undernet, with IP number `cptr->ip.s_addr' - * and hostname `hostname'. - * - * Action: - * Update the IPcheck registry. - * Return 0 on failure, 1 on success. - *--------------------------------------------------------------------------*/ -int ip_registry_check_remote(struct Client* cptr, int is_burst) -{ - struct IPRegistryEntry *entry; - - assert(cptr); - - entry = ip_registry_find(cptr->ip.s_addr); + /* If they've never connected before, let them on */ + if (0 == entry) { + entry = ip_registry_new_entry(cptr->ip.s_addr, 1); + SetIPChecked(cptr); + Debug((DEBUG_DEBUG,"IPcheck: First remote connection. connected=%i",entry->connected)); + return 1; + } + + /* Keep track of how many people have connected */ + entry->connected++; SetIPChecked(cptr); - if (0 == entry) - entry = ip_registry_new_entry(cptr->ip.s_addr, (is_burst ? 0 : 1)); - else { - /* NEVER more than 255 connections. */ - if (0 == ++entry->connected) - return 0; - - /* Make sure we don't bounce if our threshhold has expired */ - if (CONNECTED_SINCE(entry) > IPCHECK_CLONE_PERIOD) - entry->attempts = 0; - - /* If we're not part of a burst, go ahead and process the rest */ - if (!is_burst) { - if (0 == ++entry->attempts) - --entry->attempts; /* Overflows are bad, mmmkay? */ - ip_registry_update_free_targets(entry); - entry->last_connect = NOW; - } + /* Do not allow more than 250 connections from one IP. + * This can happen by having 128 clients on one server, and 128 on another + * and then the servers joining after a netsplit + */ + if (250 <= entry->connected) { + sendto_ops("IPcheck Ghost! [%s]",inet_ntoa(cptr->ip)); + Debug((DEBUG_DEBUG,"IPcheck: Too many connected from IP: %i",entry->connected)); + return 0; } - + + Debug((DEBUG_DEBUG,"IPcheck: %i people connected",entry->connected)); + + /* They are allowed to connect */ return 1; } -/*---------------------------------------------------------------------------- - * IPcheck_connect_fail - * - * Event: - * This local client failed to connect due to legal reasons. - * - * Action: - * Neutralize the effect of calling IPcheck_local_connect, in such - * a way that the client won't be penalized when trying to reconnect - * again. - *--------------------------------------------------------------------------*/ -void ip_registry_connect_fail(unsigned int addr) -{ - struct IPRegistryEntry *entry = ip_registry_find(addr); - - if (entry) - --entry->attempts; -} - - /*---------------------------------------------------------------------------- * IPcheck_connect_succeeded * @@ -410,7 +414,6 @@ void ip_registry_connect_fail(unsigned int addr) *--------------------------------------------------------------------------*/ void ip_registry_connect_succeeded(struct Client *cptr) { - const char *tr = ""; unsigned int free_targets = STARTTARGETS; struct IPRegistryEntry *entry; @@ -418,20 +421,22 @@ void ip_registry_connect_succeeded(struct Client *cptr) entry = ip_registry_find(cptr->ip.s_addr); - if (!entry) { - Debug((DEBUG_ERROR, "Missing registry entry for: %s", cptr->sock_ip)); - return; - } + + assert(entry); if (entry->target) { memcpy(cptr->targets, entry->target->targets, MAXTARGETS); free_targets = entry->target->count; - tr = " tr"; } - sendcmdto_one(&me, CMD_NOTICE, cptr, "%C :on %u ca %u(%u) ft %u(%u)%s", + sendcmdto_one(&me, CMD_NOTICE, cptr, "%C :connected %u attempts %u/%u free targets %u/%u%s" + " IPcheck: %s", cptr, entry->connected, entry->attempts, IPCHECK_CLONE_LIMIT, - free_targets, STARTTARGETS, tr); + free_targets, STARTTARGETS, + ((entry->target) ? " [Inherited Targets]" : ""), + ((CurrentTime - me.since) < IPCHECK_CLONE_DELAY) ? "Disabled" : "Enabled"); + + SetIPChecked(cptr); } @@ -439,79 +444,131 @@ void ip_registry_connect_succeeded(struct Client *cptr) * IPcheck_disconnect * * Event: - * A local client disconnected or a remote client left Undernet. + * A local client disconnected. * * Action: * Update the IPcheck registry. * Remove all expired IPregistry structures from the hash bucket * that belongs to this clients IP number. *--------------------------------------------------------------------------*/ -void ip_registry_disconnect(struct Client *cptr) +void ip_registry_local_disconnect(struct Client *cptr) { struct IPRegistryEntry *entry; + unsigned int free_targets; assert(0 != cptr); - if (!IsIPChecked(cptr)) - return; - entry = ip_registry_find(cptr->ip.s_addr); - /* Entry is probably a server if this happens. */ - if (0 == entry) - return; + /* Servers might not be in IPcheck because we connected to them, not visa + * versa. + * We can't use IsServer() here, because it might be in the 'unregistered' + * state. + */ + if (0 != cptr->serv && !entry) { + Debug((DEBUG_DEBUG,"IPcheck: Server ignored")); + return; + } + Debug((DEBUG_DEBUG,"IPcheck: Local Disconnect")); + + assert(IsIPChecked(cptr)); + + assert(entry); + assert(entry->connected > 0); + + if (entry->connected > 0) { + entry->connected--; + } /* * If this was the last one, set `last_connect' to disconnect time * (used for expiration) Note that we reset attempts here as well if our * threshhold hasn't been crossed. */ - if (0 == --entry->connected) { - if (CONNECTED_SINCE(entry) > IPCHECK_CLONE_LIMIT * IPCHECK_CLONE_PERIOD) - entry->attempts = 0; + if (0 == entry->connected) { ip_registry_update_free_targets(entry); entry->last_connect = NOW; } + + assert(MyConnect(cptr)); + if (0 == entry->target) { + entry->target = (struct IPTargetEntry *)MyMalloc(sizeof(struct IPTargetEntry)); + assert(0 != entry->target); + entry->target->count = STARTTARGETS; + } + memcpy(entry->target->targets, cptr->targets, MAXTARGETS); - if (MyConnect(cptr)) { - unsigned int free_targets; + /* + * This calculation can be pretty unfair towards large multi-user hosts, + * but there is "nothing" we can do without also allowing spam bots to + * send more messages or by drastically increasing the ammount of memory + * used in the IPregistry. + * + * The problem is that when a client disconnects, leaving no free targets, + * then the next client from that IP number has to pay for it (getting no + * free targets). But ALSO the next client, and the next client, and the + * next client etc - until another client disconnects that DOES leave free + * targets. The reason for this is that if there are 10 SPAM bots, and + * they all disconnect at once, then they ALL should get no free targets + * when reconnecting. We'd need to store an entry per client (instead of + * per IP number) to avoid this. + */ + if (cptr->nexttarget < CurrentTime) + free_targets = (CurrentTime - cptr->nexttarget) / TARGET_DELAY + 1; + else + free_targets = 0; - if (0 == entry->target) { - entry->target = (struct IPTargetEntry *)MyMalloc(sizeof(struct IPTargetEntry)); - assert(0 != entry->target); - entry->target->count = STARTTARGETS; - } - memcpy(entry->target->targets, cptr->targets, MAXTARGETS); - - /* - * This calculation can be pretty unfair towards large multi-user hosts, - * but there is "nothing" we can do without also allowing spam bots to - * send more messages or by drastically increasing the ammount of memory - * used in the IPregistry. - * - * The problem is that when a client disconnects, leaving no free targets, - * then the next client from that IP number has to pay for it (getting no - * free targets). But ALSO the next client, and the next client, and the - * next client etc - until another client disconnects that DOES leave free - * targets. The reason for this is that if there are 10 SPAM bots, and - * they all disconnect at once, then they ALL should get no free targets - * when reconnecting. We'd need to store an entry per client (instead of - * per IP number) to avoid this. - */ - if (cptr->nexttarget < CurrentTime) - free_targets = (CurrentTime - cptr->nexttarget) / TARGET_DELAY + 1; - else - free_targets = 0; - - /* Add bonus, this is pretty fuzzy, but it will help in some cases. */ - if ((CurrentTime - cptr->firsttime) > 600) - free_targets += (CurrentTime - cptr->firsttime - 600) / TARGET_DELAY; - - /* Finally, store smallest value for Judgement Day */ - if (free_targets < entry->target->count) - entry->target->count = free_targets; + /* Add bonus, if you've been connected for more than 10 minutes you + * get a free target every TARGET_DELAY seconds. + * this is pretty fuzzy, but it will help in some cases. + */ + if ((CurrentTime - cptr->firsttime) > 600) + free_targets += (CurrentTime - cptr->firsttime - 600) / TARGET_DELAY; + + /* Finally, store smallest value for Judgement Day */ + if (free_targets < entry->target->count) + entry->target->count = free_targets; + +} + +/*---------------------------------------------------------------------------- + * ip_registry_remote_disconnect + * + * Event: + * A remote client disconnected. + * + * Action: + * Update the IPcheck registry. + * Remove all expired IPregistry structures from the hash bucket + * that belongs to this clients IP number. + *--------------------------------------------------------------------------*/ +void ip_registry_remote_disconnect(struct Client *cptr) +{ + struct IPRegistryEntry *entry; + + assert(0 != cptr); + + entry = ip_registry_find(cptr->ip.s_addr); + + assert(entry); + + assert(entry->connected > 0); + Debug((DEBUG_DEBUG,"IPcheck: Remote Disconnect")); + + if (entry->connected > 0) { + entry->connected--; + } + + /* + * If this was the last one, set `last_connect' to disconnect time + * (used for expiration) Note that we reset attempts here as well if our + * threshhold hasn't been crossed. + */ + if (0 == entry->connected) { + ip_registry_update_free_targets(entry); + entry->last_connect=NOW; } } @@ -525,8 +582,3 @@ int ip_registry_count(unsigned int addr) struct IPRegistryEntry *entry = ip_registry_find(addr); return (entry) ? entry->connected : 0; } - - - - - diff --git a/ircd/Makefile.in b/ircd/Makefile.in index 9944fc0..76992b4 100644 --- a/ircd/Makefile.in +++ b/ircd/Makefile.in @@ -289,24 +289,25 @@ IPcheck.o: IPcheck.c ../include/IPcheck.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/struct.h ../include/numnicks.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/s_bsd.h ../include/s_debug.h \ - ../include/s_user.h ../include/send.h + ../include/fda.h ../include/msg.h ../include/s_bsd.h \ + ../include/s_debug.h ../include/s_user.h ../include/send.h channel.o: channel.c ../include/channel.h ../config/config.h \ ../config/setup.h ../include/ircd_defs.h ../include/client.h \ ../include/dbuf.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../include/struct.h ../include/ircd_alloc.h \ ../include/fda.h ../include/ircd_chattr.h ../include/ircd_reply.h \ - ../include/ircd_string.h ../include/list.h ../include/match.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/querycmds.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ - ../include/send.h ../include/sprintf_irc.h ../include/support.h \ - ../include/sys.h ../include/whowas.h + ../include/ircd_snprintf.h ../include/ircd_string.h ../include/list.h \ + ../include/match.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/querycmds.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \ + ../include/support.h ../include/sys.h ../include/whowas.h class.o: class.c ../include/class.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ - ../include/struct.h ../include/list.h ../include/numeric.h \ - ../include/s_conf.h ../include/s_debug.h ../include/send.h + ../include/struct.h ../include/ircd_reply.h ../include/list.h \ + ../include/numeric.h ../include/s_conf.h ../include/s_debug.h \ + ../include/send.h crule.o: crule.c ../include/crule.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ @@ -332,20 +333,21 @@ hash.o: hash.c ../include/hash.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/ircd_chattr.h \ ../include/ircd_string.h ../include/ircd.h ../include/struct.h \ - ../include/send.h ../include/support.h ../include/sys.h + ../include/msg.h ../include/send.h ../include/support.h \ + ../include/sys.h ircd.o: ircd.c ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/struct.h ../include/ircd_defs.h ../include/IPcheck.h \ ../include/class.h ../include/client.h ../include/dbuf.h \ ../include/ircd_handler.h ../include/crule.h ../include/hash.h \ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_log.h \ - ../include/ircd_signal.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/jupe.h ../include/list.h \ - ../include/listener.h ../include/match.h ../include/numeric.h \ - ../include/numnicks.h ../include/parse.h ../include/res.h \ - ../include/s_auth.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_misc.h ../include/send.h \ - ../include/sys.h ../include/uping.h ../include/userload.h \ - ../include/version.h ../include/whowas.h ../include/msg.h + ../include/ircd_reply.h ../include/ircd_signal.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/jupe.h \ + ../include/list.h ../include/match.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/parse.h \ + ../include/res.h ../include/s_auth.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/send.h ../include/sys.h ../include/uping.h \ + ../include/userload.h ../include/version.h ../include/whowas.h ircd_alloc.o: ircd_alloc.c ../include/ircd_alloc.h ../include/fda.h \ ../include/ircd_string.h ../config/config.h ../config/setup.h \ ../include/ircd_chattr.h ../include/s_debug.h ../include/ircd_defs.h @@ -365,14 +367,14 @@ ircd_relay.o: ircd_relay.c ../include/ircd_relay.h \ ircd_reply.o: ircd_reply.c ../include/ircd_reply.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ - ../include/struct.h ../include/numeric.h ../include/s_conf.h \ - ../include/s_debug.h ../include/send.h + ../include/struct.h ../include/ircd_snprintf.h ../include/numeric.h \ + ../include/s_conf.h ../include/s_debug.h ../include/send.h ircd_signal.o: ircd_signal.c ../include/ircd_signal.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/struct.h ../include/ircd_defs.h ircd_snprintf.o: ircd_snprintf.c ../include/client.h ../include/dbuf.h \ - ../include/ircd_defs.h ../include/ircd_handler.h \ - ../include/ircd_snprintf.h ../config/config.h ../config/setup.h \ + ../include/ircd_defs.h ../include/ircd_handler.h ../include/channel.h \ + ../config/config.h ../config/setup.h ../include/ircd_snprintf.h \ ../include/struct.h ircd_string.o: ircd_string.c ../include/ircd_string.h \ ../config/config.h ../config/setup.h ../include/ircd_chattr.h \ @@ -391,19 +393,21 @@ list.o: list.c ../include/list.h ../include/class.h \ ../include/client.h ../include/dbuf.h ../include/ircd_defs.h \ ../include/ircd_handler.h ../include/ircd.h ../config/config.h \ ../config/setup.h ../include/struct.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/ircd_string.h ../include/ircd_chattr.h \ - ../include/listener.h ../include/match.h ../include/numeric.h \ - ../include/res.h ../include/s_bsd.h ../include/s_conf.h \ - ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ - ../include/send.h ../include/support.h ../include/whowas.h + ../include/fda.h ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/listener.h ../include/match.h \ + ../include/numeric.h ../include/res.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/s_user.h ../include/send.h ../include/support.h \ + ../include/whowas.h listener.o: listener.c ../include/listener.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_osdep.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/numeric.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/s_misc.h ../include/send.h \ - ../include/sprintf_irc.h ../include/sys.h + ../include/ircd_osdep.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h \ + ../include/numeric.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_misc.h ../include/send.h ../include/sprintf_irc.h \ + ../include/sys.h m_admin.o: m_admin.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd_reply.h ../include/msg.h ../include/numeric.h \ @@ -419,9 +423,10 @@ m_burst.o: m_burst.c ../include/channel.h ../config/config.h \ ../include/dbuf.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../include/struct.h ../include/ircd_alloc.h \ ../include/fda.h ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/list.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/s_conf.h \ - ../include/s_misc.h ../include/send.h + ../include/ircd_chattr.h ../include/list.h ../include/match.h \ + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/s_conf.h ../include/s_misc.h ../include/send.h \ + ../include/support.h m_clearmode.o: m_clearmode.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/hash.h \ @@ -453,7 +458,8 @@ m_create.o: m_create.c ../include/channel.h ../config/config.h \ ../include/dbuf.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../include/struct.h ../include/ircd_reply.h \ ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \ - ../include/numeric.h ../include/numnicks.h ../include/send.h + ../include/numeric.h ../include/numnicks.h ../include/s_debug.h \ + ../include/send.h m_defaults.o: m_defaults.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \ ../config/config.h ../config/setup.h ../include/struct.h \ @@ -470,20 +476,20 @@ m_desynch.o: m_desynch.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/numeric.h ../include/numnicks.h \ - ../include/s_bsd.h ../include/send.h + ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/s_bsd.h ../include/send.h m_die.o: m_die.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \ ../config/config.h ../config/setup.h ../include/struct.h \ ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/numeric.h ../include/numnicks.h \ - ../include/s_bsd.h ../include/send.h -m_endburst.o: m_endburst.c ../include/client.h ../include/dbuf.h \ - ../include/ircd_defs.h ../include/ircd_handler.h ../include/hash.h \ - ../include/ircd.h ../config/config.h ../config/setup.h \ - ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/numeric.h ../include/numnicks.h \ - ../include/send.h + ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/s_bsd.h ../include/send.h +m_endburst.o: m_endburst.c ../include/channel.h ../config/config.h \ + ../config/setup.h ../include/ircd_defs.h ../include/client.h \ + ../include/dbuf.h ../include/ircd_handler.h ../include/hash.h \ + ../include/ircd.h ../include/struct.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/send.h m_error.o: m_error.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ @@ -530,8 +536,8 @@ m_join.o: m_join.c ../include/channel.h ../config/config.h \ ../include/hash.h ../include/ircd.h ../include/struct.h \ ../include/ircd_chattr.h ../include/ircd_reply.h \ ../include/ircd_string.h ../include/msg.h ../include/numeric.h \ - ../include/numnicks.h ../include/s_user.h ../include/send.h \ - ../include/handlers.h + ../include/numnicks.h ../include/s_debug.h ../include/s_user.h \ + ../include/send.h ../include/handlers.h m_jupe.o: m_jupe.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/jupe.h \ ../config/config.h ../config/setup.h ../include/hash.h \ @@ -648,9 +654,9 @@ m_ping.o: m_ping.c ../include/client.h ../include/dbuf.h \ m_pong.o: m_pong.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/hash.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ - ../include/struct.h ../include/ircd_string.h ../include/ircd_chattr.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/s_user.h ../include/send.h + ../include/struct.h ../include/ircd_reply.h ../include/ircd_string.h \ + ../include/ircd_chattr.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/s_user.h ../include/send.h m_privmsg.o: m_privmsg.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \ ../config/config.h ../config/setup.h ../include/struct.h \ @@ -800,8 +806,8 @@ m_wallchops.o: m_wallchops.c ../include/channel.h ../config/config.h \ m_wallops.o: m_wallops.c ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd_reply.h ../include/ircd_string.h ../config/config.h \ - ../config/setup.h ../include/ircd_chattr.h ../include/numeric.h \ - ../include/send.h + ../config/setup.h ../include/ircd_chattr.h ../include/msg.h \ + ../include/numeric.h ../include/send.h m_who.o: m_who.c ../include/channel.h ../config/config.h \ ../config/setup.h ../include/ircd_defs.h ../include/client.h \ ../include/dbuf.h ../include/ircd_handler.h ../include/hash.h \ @@ -827,8 +833,9 @@ m_whowas.o: m_whowas.c ../include/client.h ../include/dbuf.h \ map.o: map.c ../include/map.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \ ../config/config.h ../config/setup.h ../include/struct.h \ - ../include/list.h ../include/match.h ../include/numeric.h \ - ../include/numnicks.h ../include/querycmds.h ../include/send.h + ../include/ircd_reply.h ../include/list.h ../include/match.h \ + ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \ + ../include/send.h match.o: match.c ../include/match.h ../include/ircd_chattr.h numnicks.o: numnicks.c ../include/numnicks.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ @@ -854,13 +861,13 @@ parse.o: parse.c ../include/parse.h ../include/client.h \ ../include/channel.h ../config/config.h ../config/setup.h \ ../include/handlers.h ../include/hash.h ../include/ircd.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_chattr.h ../include/ircd_string.h ../include/map.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/opercmds.h ../include/querycmds.h ../include/res.h \ - ../include/s_bsd.h ../include/s_conf.h ../include/s_debug.h \ - ../include/s_misc.h ../include/s_numeric.h ../include/s_user.h \ - ../include/send.h ../include/sys.h ../include/whocmds.h \ - ../include/whowas.h + ../include/ircd_chattr.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/map.h ../include/msg.h \ + ../include/numeric.h ../include/numnicks.h ../include/opercmds.h \ + ../include/querycmds.h ../include/res.h ../include/s_bsd.h \ + ../include/s_conf.h ../include/s_debug.h ../include/s_misc.h \ + ../include/s_numeric.h ../include/s_user.h ../include/send.h \ + ../include/sys.h ../include/whocmds.h ../include/whowas.h querycmds.o: querycmds.c ../include/querycmds.h random.o: random.c ../include/random.h ../config/config.h \ ../config/setup.h @@ -868,10 +875,11 @@ res.o: res.c ../include/res.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/ircd.h \ ../config/config.h ../config/setup.h ../include/struct.h \ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_log.h \ - ../include/ircd_osdep.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/numeric.h ../include/s_bsd.h \ - ../include/s_debug.h ../include/s_misc.h ../include/send.h \ - ../include/sprintf_irc.h ../include/support.h ../include/sys.h + ../include/ircd_osdep.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/msg.h \ + ../include/numeric.h ../include/s_bsd.h ../include/s_debug.h \ + ../include/s_misc.h ../include/send.h ../include/sprintf_irc.h \ + ../include/support.h ../include/sys.h s_auth.o: s_auth.c ../include/s_auth.h ../config/config.h \ ../config/setup.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/IPcheck.h \ @@ -885,15 +893,15 @@ s_bsd.o: s_bsd.c ../include/s_bsd.h ../config/config.h \ ../config/setup.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/IPcheck.h \ ../include/channel.h ../include/class.h ../include/hash.h \ - ../include/ircd_log.h ../include/ircd_osdep.h \ + ../include/ircd_log.h ../include/ircd_osdep.h ../include/ircd_reply.h \ ../include/ircd_string.h ../include/ircd_chattr.h ../include/ircd.h \ ../include/struct.h ../include/list.h ../include/listener.h \ - ../include/numeric.h ../include/numnicks.h ../include/packet.h \ - ../include/parse.h ../include/querycmds.h ../include/res.h \ - ../include/s_auth.h ../include/s_conf.h ../include/s_debug.h \ - ../include/s_misc.h ../include/s_user.h ../include/send.h \ - ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ - ../include/uping.h ../include/version.h + ../include/msg.h ../include/numeric.h ../include/numnicks.h \ + ../include/packet.h ../include/parse.h ../include/querycmds.h \ + ../include/res.h ../include/s_auth.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/support.h \ + ../include/sys.h ../include/uping.h ../include/version.h s_conf.o: s_conf.c ../include/s_conf.h ../include/IPcheck.h \ ../include/class.h ../include/client.h ../include/dbuf.h \ ../include/ircd_defs.h ../include/ircd_handler.h ../include/crule.h \ @@ -901,6 +909,7 @@ s_conf.o: s_conf.c ../include/s_conf.h ../include/IPcheck.h \ ../config/setup.h ../include/hash.h ../include/ircd.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ ../include/ircd_chattr.h ../include/ircd_log.h \ + ../include/ircd_reply.h ../include/ircd_snprintf.h \ ../include/ircd_string.h ../include/list.h ../include/listener.h \ ../include/match.h ../include/numeric.h ../include/numnicks.h \ ../include/opercmds.h ../include/parse.h ../include/res.h \ @@ -911,11 +920,11 @@ s_debug.o: s_debug.c ../include/s_debug.h ../config/config.h \ ../config/setup.h ../include/ircd_defs.h ../include/channel.h \ ../include/class.h ../include/client.h ../include/dbuf.h \ ../include/ircd_handler.h ../include/hash.h ../include/ircd_alloc.h \ - ../include/fda.h ../include/ircd_osdep.h ../include/ircd.h \ - ../include/struct.h ../include/list.h ../include/numeric.h \ - ../include/numnicks.h ../include/res.h ../include/s_bsd.h \ - ../include/s_conf.h ../include/send.h ../include/sys.h \ - ../include/whowas.h + ../include/fda.h ../include/ircd_osdep.h ../include/ircd_reply.h \ + ../include/ircd.h ../include/struct.h ../include/list.h \ + ../include/numeric.h ../include/numnicks.h ../include/res.h \ + ../include/s_bsd.h ../include/s_conf.h ../include/send.h \ + ../include/sys.h ../include/whowas.h s_err.o: s_err.c ../include/numeric.h ../include/s_debug.h \ ../config/config.h ../config/setup.h ../include/ircd_defs.h \ ../include/sprintf_irc.h @@ -924,19 +933,19 @@ s_misc.o: s_misc.c ../include/s_misc.h ../include/IPcheck.h \ ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \ ../include/ircd_handler.h ../include/hash.h ../include/ircd.h \ ../include/struct.h ../include/ircd_alloc.h ../include/fda.h \ - ../include/ircd_log.h ../include/ircd_string.h \ - ../include/ircd_chattr.h ../include/list.h ../include/match.h \ - ../include/msg.h ../include/numeric.h ../include/numnicks.h \ - ../include/parse.h ../include/querycmds.h ../include/res.h \ - ../include/s_bsd.h ../include/s_conf.h ../include/s_debug.h \ - ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \ - ../include/support.h ../include/sys.h ../include/uping.h \ - ../include/userload.h + ../include/ircd_log.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/ircd_chattr.h ../include/list.h \ + ../include/match.h ../include/msg.h ../include/numeric.h \ + ../include/numnicks.h ../include/parse.h ../include/querycmds.h \ + ../include/res.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_user.h ../include/send.h \ + ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ + ../include/uping.h ../include/userload.h s_numeric.o: s_numeric.c ../include/s_numeric.h ../include/channel.h \ ../config/config.h ../config/setup.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/ircd_handler.h \ ../include/hash.h ../include/ircd.h ../include/struct.h \ - ../include/numnicks.h ../include/send.h + ../include/ircd_snprintf.h ../include/numnicks.h ../include/send.h s_serv.o: s_serv.c ../include/s_serv.h ../include/IPcheck.h \ ../include/channel.h ../config/config.h ../config/setup.h \ ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \ @@ -944,12 +953,13 @@ s_serv.o: s_serv.c ../include/s_serv.h ../include/IPcheck.h \ ../include/hash.h ../include/ircd.h ../include/struct.h \ ../include/ircd_alloc.h ../include/fda.h ../include/ircd_reply.h \ ../include/ircd_string.h ../include/ircd_chattr.h \ - ../include/ircd_xopen.h ../include/jupe.h ../include/list.h \ - ../include/msg.h ../include/match.h ../include/numeric.h \ - ../include/numnicks.h ../include/parse.h ../include/querycmds.h \ - ../include/s_bsd.h ../include/s_conf.h ../include/s_debug.h \ - ../include/s_misc.h ../include/s_user.h ../include/send.h \ - ../include/sprintf_irc.h ../include/sys.h ../include/userload.h + ../include/ircd_snprintf.h ../include/ircd_xopen.h ../include/jupe.h \ + ../include/list.h ../include/msg.h ../include/match.h \ + ../include/numeric.h ../include/numnicks.h ../include/parse.h \ + ../include/querycmds.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_debug.h ../include/s_misc.h ../include/s_user.h \ + ../include/send.h ../include/sprintf_irc.h ../include/sys.h \ + ../include/userload.h s_stats.o: s_stats.c ../include/s_stats.h ../include/class.h \ ../include/client.h ../include/dbuf.h ../include/ircd_defs.h \ ../include/ircd_handler.h ../include/crule.h ../include/ircd.h \ @@ -987,8 +997,8 @@ sprintf_irc.o: sprintf_irc.c ../include/sprintf_irc.h ../include/sys.h \ support.o: support.c ../include/support.h ../config/config.h \ ../config/setup.h ../include/fileio.h ../include/ircd.h \ ../include/struct.h ../include/ircd_defs.h ../include/ircd_chattr.h \ - ../include/s_bsd.h ../include/s_debug.h ../include/send.h \ - ../include/sprintf_irc.h ../include/sys.h + ../include/ircd_snprintf.h ../include/s_bsd.h ../include/s_debug.h \ + ../include/send.h ../include/sprintf_irc.h ../include/sys.h uping.o: uping.c ../include/uping.h ../include/ircd_defs.h \ ../include/client.h ../include/dbuf.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ @@ -1002,19 +1012,21 @@ uping.o: uping.c ../include/uping.h ../include/ircd_defs.h \ userload.o: userload.c ../include/userload.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ - ../include/struct.h ../include/numnicks.h ../include/querycmds.h \ - ../include/s_misc.h ../include/send.h ../include/sys.h + ../include/struct.h ../include/msg.h ../include/numnicks.h \ + ../include/querycmds.h ../include/s_misc.h ../include/send.h \ + ../include/sys.h whocmds.o: whocmds.c ../include/whocmds.h ../config/config.h \ - ../config/setup.h ../include/IPcheck.h ../include/channel.h \ - ../include/ircd_defs.h ../include/client.h ../include/dbuf.h \ - ../include/ircd_handler.h ../include/hash.h ../include/ircd.h \ - ../include/struct.h ../include/ircd_chattr.h ../include/ircd_string.h \ - ../include/list.h ../include/match.h ../include/numeric.h \ - ../include/numnicks.h ../include/querycmds.h ../include/random.h \ - ../include/s_bsd.h ../include/s_conf.h ../include/s_misc.h \ - ../include/s_user.h ../include/send.h ../include/sprintf_irc.h \ - ../include/support.h ../include/sys.h ../include/userload.h \ - ../include/version.h ../include/whowas.h ../include/msg.h + ../config/setup.h ../include/channel.h ../include/ircd_defs.h \ + ../include/client.h ../include/dbuf.h ../include/ircd_handler.h \ + ../include/hash.h ../include/ircd.h ../include/struct.h \ + ../include/ircd_chattr.h ../include/ircd_reply.h \ + ../include/ircd_string.h ../include/list.h ../include/match.h \ + ../include/numeric.h ../include/numnicks.h ../include/querycmds.h \ + ../include/random.h ../include/s_bsd.h ../include/s_conf.h \ + ../include/s_misc.h ../include/s_user.h ../include/send.h \ + ../include/sprintf_irc.h ../include/support.h ../include/sys.h \ + ../include/userload.h ../include/version.h ../include/whowas.h \ + ../include/msg.h whowas.o: whowas.c ../include/whowas.h ../include/client.h \ ../include/dbuf.h ../include/ircd_defs.h ../include/ircd_handler.h \ ../include/ircd.h ../config/config.h ../config/setup.h \ diff --git a/ircd/ircd.c b/ircd/ircd.c index 31ecd8a..8de1142 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -473,8 +473,6 @@ static void event_loop(void) { else read_message(IRCD_MIN(delay, TIMESEC)); - Debug((DEBUG_DEBUG, "Got message(s)")); - /* ...perhaps should not do these loops every time, but only if there is * some chance of something happening (but, note that conf->hold times may * be changed elsewhere--so precomputed next event time might be too far @@ -620,7 +618,7 @@ int main(int argc, char **argv) { parse_command_line(argc, argv); if (chdir(dpath)) { - fprintf(stderr, "Fail: Cannot chdir(%s): %s\n", dpath, strerror(errno)); + fprintf(stderr, "Fail: Cannot chdir(%s): %s, check DPATH\n", dpath, strerror(errno)); exit(2); } diff --git a/ircd/list.c b/ircd/list.c index 275062e..fb86192 100644 --- a/ircd/list.c +++ b/ircd/list.c @@ -126,8 +126,10 @@ void free_client(struct Client *cptr) */ if (cptr->dns_reply) --cptr->dns_reply->ref_count; - if (-1 < cptr->fd) + if (-1 < cptr->fd) { + ip_registry_local_disconnect(cptr); close(cptr->fd); + } DBufClear(&cptr->sendQ); DBufClear(&cptr->recvQ); if (cptr->listener) diff --git a/ircd/m_nick.c b/ircd/m_nick.c index 5978562..b8cf167 100644 --- a/ircd/m_nick.c +++ b/ircd/m_nick.c @@ -217,7 +217,6 @@ int m_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - ip_registry_connect_fail(acptr->ip.s_addr); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -385,7 +384,6 @@ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) */ if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - ip_registry_connect_fail(acptr->ip.s_addr); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -605,13 +603,20 @@ int m_nick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) * is present in the nicklist (due to the way the below for loop is * constructed). -avalon */ - if ((acptr = FindServer(nick))) { + + acptr = FindServer(nick); + + if (acptr) { /* There is a nick collision with a server */ if (MyConnect(sptr)) { + /* Local user trying to use a nick thats a server + * Return an error message and ignore the command + */ sendto_one(sptr, err_str(ERR_NICKNAMEINUSE), me.name, /* XXX DEAD */ EmptyString(parv[0]) ? "*" : parv[0], nick); return 0; /* NICK message ignored */ } + /* * We have a nickname trying to use the same name as * a server. Send out a nick collision KILL to remove @@ -628,9 +633,12 @@ int m_nick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) sptr->flags |= FLAGS_KILLED; return exit_client(cptr, sptr, &me, "Nick/Server collision"); } + + acptr = FindClient(nick); - if (!(acptr = FindClient(nick))) - return set_nick_name(cptr, sptr, nick, parc, parv); /* No collisions, all clear... */ + /* No collisions? Set the nick name and we're done */ + if (!acptr) + return set_nick_name(cptr, sptr, nick, parc, parv); /* * If acptr == sptr, then we have a client doing a nick * change between *equivalent* nicknames as far as server @@ -668,7 +676,6 @@ int m_nick(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - ip_registry_connect_fail(acptr->ip.s_addr); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } diff --git a/ircd/parse.c b/ircd/parse.c index 9d76052..2a4287b 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -769,7 +769,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend) struct Message* mptr; MessageHandler handler = 0; - Debug((DEBUG_DEBUG, "Parsing: %s", buffer)); + Debug((DEBUG_DEBUG, "Client Parsing: %s", buffer)); if (IsDead(cptr)) return 0; @@ -914,7 +914,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend) int paramcount; struct Message* mptr; - Debug((DEBUG_DEBUG, "Parsing: %s", buffer)); + Debug((DEBUG_DEBUG, "Server Parsing: %s", buffer)); #ifdef GODMODE len = strlen(buffer); diff --git a/ircd/s_auth.c b/ircd/s_auth.c index ebb1dd6..46ed91f 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -177,7 +177,6 @@ static void auth_kill_client(struct AuthRequest* auth) if (IsDNSPending(auth)) delete_resolver_queries(auth); - ip_registry_disconnect(auth->client); Count_unknowndisconnects(UserStats); free_client(auth->client); free_auth_request(auth); diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index 5e85a75..15d53b8 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -506,6 +506,7 @@ void close_connection(struct Client *cptr) if (-1 < cptr->fd) { flush_connections(cptr); + ip_registry_local_disconnect(cptr); LocalClientArray[cptr->fd] = 0; close(cptr->fd); cptr->fd = -1; @@ -566,6 +567,7 @@ void add_connection(struct Listener* listener, int fd) { assert(0 != listener); + /* * Removed preliminary access check. Full check is performed in m_server and * m_user instead. Also connection time out help to get rid of unwanted @@ -577,27 +579,21 @@ void add_connection(struct Listener* listener, int fd) { return; } - /* * Add this local client to the IPcheck registry. * - * If it is a connection to a user port and if the site has been throttled, - * reject the user. + * If they're throttled, murder them, but tell them why first. */ - if (!ip_registry_check_local(addr.sin_addr.s_addr, &next_target) && - !listener->server) { - send(fd, throttle_message, 66, 0); - close(fd); - ++ServerStats->is_ref; - return; + if ( !ip_registry_check_local(addr.sin_addr.s_addr,&next_target) ) { + ++ServerStats->is_ref; + write(fd,throttle_message,strlen(throttle_message)); + close(fd); + return; } new_client = make_client(0, ((listener->server) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER)); - if (!listener->server) - ip_registry_local_connect(new_client); - /* * Copy ascii address to 'sockhost' just in case. Then we have something * valid to put into error messages... @@ -1247,12 +1243,6 @@ int read_message(time_t delay) if (CPTR_KILLED == (length = read_packet(cptr, read_ready))) continue; } -#if 0 - /* Bullshit, why would we want to flush sockets while using non-blocking? - * This uses > 4% cpu! --Run */ - if (length > 0) - flush_connections(LocalClientArray[i]); -#endif if (IsDead(cptr)) { const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info; if (!msg) @@ -1422,6 +1412,8 @@ int connect_server(struct ConfItem* aconf, struct Client* by, if (cptr->fd > HighestFd) HighestFd = cptr->fd; + + LocalClientArray[cptr->fd] = cptr; Count_newunknown(UserStats); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 53be6e9..284f01e 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -486,32 +486,26 @@ static int validate_hostent(struct hostent* hp) /* * check_limit_and_attach - check client limits and attach I:line + * + * Made it accept 1 charactor, and 2 charactor limits (0->99 now), + * and dislallow more than 255 people here as well as in ipcheck. + * removed the old "ONE" scheme too. + * -- Isomer 2000-06-22 */ static enum AuthorizationCheckResult check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf) { + int number = 255; + if (aconf->passwd) { - /* Special case: exactly one digit */ - if (IsDigit(*aconf->passwd) && !aconf->passwd[1]) { - /* - * Refuse connections when there are already - * clients connected with the same IP number - */ - unsigned short nr = *aconf->passwd - '0'; - if (ip_registry_count(cptr->ip.s_addr) > nr) - return ACR_TOO_MANY_FROM_IP; /* Already got nr with that ip# */ - } -#ifdef USEONE - else if (0 == strcmp(aconf->passwd, "ONE")) { - int i; - for (i = HighestFd; i > -1; --i) { - if (LocalClientArray[i] && MyUser(LocalClientArray[i]) && - LocalClientArray[i]->ip.s_addr == cptr->ip.s_addr) - return ACR_TOO_MANY_FROM_IP; /* Already got one with that ip# */ - } - } -#endif + if (IsDigit(*aconf->passwd) && !aconf->passwd[1]) + number = *aconf->passwd-'0'; + else if (IsDigit(*aconf->passwd) && IsDigit(aconf->passwd[1]) && + !aconf->passwd[2]) + number = (*aconf->passwd-'0')*10+(aconf->passwd[1]-'0'); } + if (ip_registry_count(cptr->ip.s_addr) > number) + return ACR_TOO_MANY_FROM_IP; return attach_conf(cptr, aconf); } diff --git a/ircd/s_misc.c b/ircd/s_misc.c index 82fb064..20e8a18 100644 --- a/ircd/s_misc.c +++ b/ircd/s_misc.c @@ -254,8 +254,10 @@ static void exit_one_client(struct Client* bcptr, const char* comment) --UserStats.opers; if (MyConnect(bcptr)) Count_clientdisconnects(bcptr, UserStats); - else + else { Count_remoteclientquits(UserStats, bcptr); + ip_registry_remote_disconnect(bcptr); + } } else if (IsServer(bcptr)) { @@ -277,9 +279,6 @@ static void exit_one_client(struct Client* bcptr, const char* comment) else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr)) Count_unknowndisconnects(UserStats); - /* Update IPregistry */ - ip_registry_disconnect(bcptr); - /* * Remove from serv->client_list @@ -384,7 +383,7 @@ int exit_client(struct Client *cptr, /* Connection being handled by time_t on_for; #endif char comment1[HOSTLEN + HOSTLEN + 2]; - + assert(killer); if (MyConnect(victim)) { victim->flags |= FLAGS_CLOSING; update_load(); diff --git a/ircd/s_serv.c b/ircd/s_serv.c index c4cf898..4084c54 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -134,12 +134,6 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf, sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s", me.name, me.serv->timestamp, cptr->serv->timestamp, MAJOR_PROTOCOL, NumServCap(&me), *me.info ? me.info : "IRCers United"); - /* - * Don't charge this IP# for connecting - * XXX - if this comes from a server port, it will not have been added - * to the IP check registry, see add_connection in s_bsd.c - */ - ip_registry_connect_fail(cptr->ip.s_addr); } det_confs_butmask(cptr, CONF_LEAF | CONF_HUB | CONF_SERVER | CONF_UWORLD); diff --git a/ircd/s_user.c b/ircd/s_user.c index 4696248..1b42061 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -456,7 +456,6 @@ int register_user(struct Client *cptr, struct Client *sptr, get_client_name(sptr, HIDE_IP)); } ++ServerStats->is_ref; - ip_registry_connect_fail(sptr->ip.s_addr); return exit_client(cptr, sptr, &me, "Sorry, your connection class is full - try " "again later or try another server"); @@ -475,7 +474,6 @@ int register_user(struct Client *cptr, struct Client *sptr, /* Can this ever happen? */ case ACR_BAD_SOCKET: ++ServerStats->is_ref; - ip_registry_connect_fail(sptr->ip.s_addr); return exit_client(cptr, sptr, &me, "Unknown error -- Try again"); } ircd_strncpy(user->host, sptr->sockhost, HOSTLEN); @@ -491,13 +489,9 @@ int register_user(struct Client *cptr, struct Client *sptr, if (!EmptyString(aconf->passwd) && !(IsDigit(*aconf->passwd) && !aconf->passwd[1]) -#ifdef USEONE - && strcmp("ONE", aconf->passwd) -#endif && strcmp(sptr->passwd, aconf->passwd)) { ServerStats->is_ref++; - ip_registry_connect_fail(sptr->ip.s_addr); send_reply(sptr, ERR_PASSWDMISMATCH); return exit_client(cptr, sptr, &me, "Bad Password"); } @@ -507,7 +501,6 @@ int register_user(struct Client *cptr, struct Client *sptr, */ if (find_kill(sptr)) { ServerStats->is_ref++; - ip_registry_connect_fail(sptr->ip.s_addr); return exit_client(cptr, sptr, &me, "K-lined"); } /* @@ -603,7 +596,7 @@ int register_user(struct Client *cptr, struct Client *sptr, (agline = gline_lookup(sptr, GLINE_GLOBAL | GLINE_LASTMOD)) && !IsBurstOrBurstAck(cptr)) gline_resend(cptr, agline); - + if (IsInvisible(sptr)) ++UserStats.inv_clients; if (IsOper(sptr)) @@ -661,13 +654,7 @@ int register_user(struct Client *cptr, struct Client *sptr, if (IsBurst(acptr) || Protocol(acptr) < 10) break; } - if (!ip_registry_check_remote(sptr, (acptr != &me))) - /* - * We ran out of bits to count this - */ - return exit_client(&me, sptr, &me, "More than 255 connections from this address"); } - tmpstr = umode_str(sptr); if (agline) sendcmdto_serv_butone(user->server, CMD_NICK, cptr, @@ -687,7 +674,7 @@ int register_user(struct Client *cptr, struct Client *sptr, *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "", inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6), NumNick(sptr), sptr->info); - + /* Send umode to client */ if (MyUser(sptr)) { @@ -794,7 +781,12 @@ int set_nick_name(struct Client* cptr, struct Client* sptr, && GlineLastMod(agline) > lastmod && !IsBurstOrBurstAck(cptr)) gline_resend(cptr, agline); } - + if (!ip_registry_remote_connect(sptr)) { + sendcmdto_one(&me, CMD_KILL, new_client, "%C :%s (Too many connections from your host -- Ghost)", + new_client,me.name); + return exit_client(cptr,new_client,&me,"Too many connections from your host -- throttled"); + } + sendto_ops("Registering new remote client"); return register_user(cptr, new_client, new_client->name, parv[4], agline); } else if (sptr->name[0]) {