mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 17:14:46 +02:00
Add TKL IDs via message tags in S2S.
By default - assuming you don't set set::reject-message things by yourself - the *LINE id is appended at the end of the rejection that is shown to the user, like: [ID: G7K2MP9WQX3]. Also new is spamfilter to *LINE mapping, so you can see which *LINE was set by which SPAMFILTER. For this STATS gline and friends were enhanced. In fact, multiple fields were added there, including some that are 0 (zero) placeholders at the moment. These will be set in a future commit. Some things were combined here so we only have to break STATS and tkldb database format once (unless i made a mistake, then the follow up commit will correct that i guess :D). This was requested by Hero in https://bugs.unrealircd.org/view.php?id=4397 in 2015. Again by musk in https://bugs.unrealircd.org/view.php?id=4397 in 2022. And on IRC by Chris and others. As you can see it was not SUPER easy and a lot of thought went into this (and in terms of S2S traffic it is part of something bigger too)
This commit is contained in:
+1
-1
@@ -953,7 +953,7 @@ extern MODVAR int (*decode_authenticate_plain)(const char *param, char **authori
|
||||
extern MODVAR void (*exit_client)(Client *client, MessageTag *recv_mtags, const char *comment);
|
||||
extern MODVAR void (*exit_client_fmt)(Client *client, MessageTag *recv_mtags, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf, 3, 4)));
|
||||
extern MODVAR void (*exit_client_ex)(Client *client, Client *origin, MessageTag *recv_mtags, const char *comment);
|
||||
extern MODVAR void (*banned_client)(Client *client, const char *bantype, const char *reason, int global, int noexit);
|
||||
extern MODVAR void (*banned_client)(Client *client, const char *bantype, const char *reason, const char *tklid, int global, int noexit);
|
||||
extern MODVAR char *(*unreal_expand_string)(const char *str, char *buf, size_t buflen, NameValuePrioList *nvp, int buildvarstring_options, Client *client);
|
||||
extern MODVAR char *(*utf8_convert_confusables)(const char *i, char *obuf, int olen);
|
||||
extern MODVAR const char *(*utf8_get_block_name)(int i);
|
||||
|
||||
+4
-4
@@ -372,17 +372,17 @@
|
||||
#define STR_RPL_STATSCOMMANDS /* 212 */ "%s %u %lu"
|
||||
#define STR_RPL_STATSCLINE /* 213 */ "%c %s * %s %d %d %s"
|
||||
#define STR_RPL_STATSILINE /* 215 */ "I %s %s %d %d %s %s %d"
|
||||
#define STR_RPL_STATSQLINE /* 217 */ "%c %s %lld %lld %s :%s"
|
||||
#define STR_RPL_STATSQLINE /* 217 */ "%c %s %lld %lld %s %lld %lld %s :%s"
|
||||
#define STR_RPL_STATSYLINE /* 218 */ "Y %s %d %d %d %d %d"
|
||||
#define STR_RPL_ENDOFSTATS /* 219 */ "%c :End of /STATS report"
|
||||
#define STR_RPL_UMODEIS /* 221 */ "%s"
|
||||
#define STR_RPL_STATSGLINE /* 223 */ "%c %s %lld %lld %s :%s"
|
||||
#define STR_RPL_STATSGLINE /* 223 */ "%c %s %lld %lld %s %lld %lld %s %s :%s"
|
||||
#define STR_RPL_STATSTLINE /* 224 */ "T %s %s %s"
|
||||
#define STR_RPL_STATSNLINE /* 226 */ "n %s %s"
|
||||
#define STR_RPL_STATSVLINE /* 227 */ "v %s %s %s"
|
||||
#define STR_RPL_STATSBANVER /* 228 */ "%s %s"
|
||||
#define STR_RPL_STATSSPAMF /* 229 */ "%c %s %s %s %lld %lld %lld %s %s %lld %lld :%s"
|
||||
#define STR_RPL_STATSEXCEPTTKL /* 230 */ "%s %s %lld %lld %s :%s"
|
||||
#define STR_RPL_STATSSPAMF /* 229 */ "%c %s %s %s %lld %lld %lld %s %s %lld %lld %lld %lld %s :%s"
|
||||
#define STR_RPL_STATSEXCEPTTKL /* 230 */ "%s %s %lld %lld %s %s :%s"
|
||||
#define STR_RPL_RULES /* 232 */ ":- %s"
|
||||
#define STR_RPL_STATSLLINE /* 241 */ "%c %s * %s %d %d"
|
||||
#define STR_RPL_STATSUPTIME /* 242 */ ":Server Up %lld days, %lld:%02lld:%02lld"
|
||||
|
||||
+4
-1
@@ -204,7 +204,6 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia
|
||||
#define MAXCCUSERS 20 /* Maximum for set::anti-flood::max-concurrent-conversations */
|
||||
#define BATCHLEN 22
|
||||
#define MAXBATCHREFLEN 48 /* Max length of client-sent batch reference tags */
|
||||
#define MAXSPAMFILTERIDLEN 24
|
||||
|
||||
/*
|
||||
* Watch it - Don't change this unless you also change the ERR_TOOMANYWATCH
|
||||
@@ -1319,6 +1318,8 @@ struct BanException {
|
||||
#define TKL_FLAG_CONFIG 0x0001 /* Entry from configuration file. Cannot be removed by using commands. */
|
||||
#define TKL_FLAG_CENTRAL_SPAMFILTER 0x0002 /* Entry from central spamfilter. */
|
||||
|
||||
#define TKLIDLEN 16 /**< TKL id buffer size: native 'prefix+body' or an external id. Max 15 chars + NUL. */
|
||||
|
||||
/** A TKL entry, such as a KLINE, GLINE, Spamfilter, QLINE, Exception, .. */
|
||||
struct TKL {
|
||||
TKL *prev, *next;
|
||||
@@ -1327,6 +1328,8 @@ struct TKL {
|
||||
char *set_by; /**< By who was this entry added */
|
||||
time_t set_at; /**< When this entry was added */
|
||||
time_t expire_at; /**< When this entry will expire */
|
||||
char id[TKLIDLEN]; /**< Unique ID: assigned (random, generated by originating server) or external (eg from services), or empty string if none */
|
||||
char spamfilter_id[TKLIDLEN]; /**< For server bans created by a spamfilter: that spamfilter's id. Empty otherwise. */
|
||||
union {
|
||||
Spamfilter *spamfilter;
|
||||
ServerBan *serverban;
|
||||
|
||||
Reference in New Issue
Block a user