+2000-06-22 Perry Lorier <Isomer@coders.net>
+ * 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 <Isomer@coders.net>
* ircd/ircd.c: Fix command line parameter bugs.
#
# 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.
#
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
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
/*----------------------------------------------------------------------------
* 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 */
-
#include "send.h"
#include <assert.h>
+#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
+#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;
#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
*--------------------------------------------------------------------------*/
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)
* 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;
- }
}
/*----------------------------------------------------------------------------
- * IPcheck_local_connect
*
* Event:
* A new connection was accept()-ed with IP number `cptr->ip.s_addr'.
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
*
*--------------------------------------------------------------------------*/
void ip_registry_connect_succeeded(struct Client *cptr)
{
- const char *tr = "";
unsigned int free_targets = STARTTARGETS;
struct IPRegistryEntry *entry;
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);
}
* 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;
}
}
struct IPRegistryEntry *entry = ip_registry_find(addr);
return (entry) ? entry->connected : 0;
}
-
-
-
-
-
../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 \
../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
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 \
../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 \
../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 \
../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 \
../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 \
../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 \
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 \
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 \
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 \
../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
../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 \
../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 \
../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 \
../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
../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 \
../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 \
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 \
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 \
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
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);
}
*/
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)
*/
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);
}
*/
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);
}
* 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
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
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);
}
struct Message* mptr;
MessageHandler handler = 0;
- Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+ Debug((DEBUG_DEBUG, "Client Parsing: %s", buffer));
if (IsDead(cptr))
return 0;
int paramcount;
struct Message* mptr;
- Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+ Debug((DEBUG_DEBUG, "Server Parsing: %s", buffer));
#ifdef GODMODE
len = strlen(buffer);
if (IsDNSPending(auth))
delete_resolver_queries(auth);
- ip_registry_disconnect(auth->client);
Count_unknowndisconnects(UserStats);
free_client(auth->client);
free_auth_request(auth);
if (-1 < cptr->fd) {
flush_connections(cptr);
+ ip_registry_local_disconnect(cptr);
LocalClientArray[cptr->fd] = 0;
close(cptr->fd);
cptr->fd = -1;
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
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...
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)
if (cptr->fd > HighestFd)
HighestFd = cptr->fd;
+
+
LocalClientArray[cptr->fd] = cptr;
Count_newunknown(UserStats);
/*
* 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 <digit>
- * 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);
}
--UserStats.opers;
if (MyConnect(bcptr))
Count_clientdisconnects(bcptr, UserStats);
- else
+ else {
Count_remoteclientquits(UserStats, bcptr);
+ ip_registry_remote_disconnect(bcptr);
+ }
}
else if (IsServer(bcptr))
{
else if (IsUnknown(bcptr) || IsConnecting(bcptr) || IsHandshake(bcptr))
Count_unknowndisconnects(UserStats);
- /* Update IPregistry */
- ip_registry_disconnect(bcptr);
-
/*
* Remove from serv->client_list
time_t on_for;
#endif
char comment1[HOSTLEN + HOSTLEN + 2];
-
+ assert(killer);
if (MyConnect(victim)) {
victim->flags |= FLAGS_CLOSING;
update_load();
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);
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");
/* 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);
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");
}
*/
if (find_kill(sptr)) {
ServerStats->is_ref++;
- ip_registry_connect_fail(sptr->ip.s_addr);
return exit_client(cptr, sptr, &me, "K-lined");
}
/*
(agline = gline_lookup(sptr, GLINE_GLOBAL | GLINE_LASTMOD)) &&
!IsBurstOrBurstAck(cptr))
gline_resend(cptr, agline);
-
+
if (IsInvisible(sptr))
++UserStats.inv_clients;
if (IsOper(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,
*tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6),
NumNick(sptr), sptr->info);
-
+
/* Send umode to client */
if (MyUser(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]) {