From ab894d74fe51c76835d5be2e3549c140aeab9da1 Mon Sep 17 00:00:00 2001 From: Keith Buck Date: Mon, 16 May 2011 15:29:09 -0700 Subject: [PATCH] Add target change spam notice. --- include/client.h | 4 ++++ src/tgchange.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/client.h b/include/client.h index 2c3597f7..620c6e6e 100644 --- a/include/client.h +++ b/include/client.h @@ -401,6 +401,7 @@ struct ListClient #define FLAGS_SERVICE 0x200000 /* network service */ #define FLAGS_TGCHANGE 0x400000 /* we're allowed to clear something */ #define FLAGS_DYNSPOOF 0x800000 /* dynamic spoof, only opers see ip */ +#define FLAGS_TGEXCESSIVE 0x1000000 /* whether the client has attemped to change targets excessively fast */ /* flags for local clients, this needs stuff moved from above to here at some point */ #define LFLAGS_SSL 0x00000001 @@ -477,6 +478,9 @@ struct ListClient #define IsDynSpoof(x) ((x)->flags & FLAGS_DYNSPOOF) #define SetDynSpoof(x) ((x)->flags |= FLAGS_DYNSPOOF) #define ClearDynSpoof(x) ((x)->flags &= ~FLAGS_DYNSPOOF) +#define IsTGExcessive(x) ((x)->flags & FLAGS_TGEXCESSIVE) +#define SetTGExcessive(x) ((x)->flags |= FLAGS_TGEXCESSIVE) +#define ClearTGExcessive(x) ((x)->flags &= ~FLAGS_TGEXCESSIVE) /* local flags */ diff --git a/src/tgchange.c b/src/tgchange.c index d06ad41f..7059a287 100644 --- a/src/tgchange.c +++ b/src/tgchange.c @@ -122,6 +122,16 @@ add_hashed_target(struct Client *source_p, uint32_t hashv) { ServerStats.is_tgch++; add_tgchange(source_p->sockhost); + + if (!IsTGExcessive(source_p)) + { + SetTGExcessive(source_p); + sendto_realops_snomask(SNO_BOTS, L_NETWIDE, + "Excessive target change from %s (%s@%s)", + source_p->name, source_p->username, + source_p->orighost); + } + return 0; } }