1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-09 15:43:12 +02:00

Add crule function match_asn(64496)

This commit is contained in:
Bram Matthys
2024-07-12 11:37:18 +02:00
parent 156e38f538
commit da6cf4f6fa
2 changed files with 14 additions and 1 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ in progress and may not always be a stable version.
reason "Too much abuse from this ISP. You are required to log in with an account using SASL.";
}
```
* In [Crule](https://www.unrealircd.org/docs/Crule) functions as `match_asn(64496)`
* Also available in regular extbans/invex, but normally users don't
know the IP or ASN of other users, unless you use no cloaking or
change [set::whois-details::geo](https://www.unrealircd.org/docs/Set_block#set::whois-details::geo).
@@ -35,7 +36,7 @@ in progress and may not always be a stable version.
and configures what JSON methods can be called.
There are two default json-rpc classes:
* `full`: access to all JSON-RPC Methods
* `read-only`: access to things list *server_ban.list* but not to *server_ban.add*
* `read-only`: access to things like *server_ban.list* but not to *server_ban.add*
* [set::spamfilter::except](https://www.unrealircd.org/docs/Set_block#set::spamfilter::except)
is now a [Mask item](https://www.unrealircd.org/docs/Mask_item) instead of
only a list of exempted targets. A warning is created to existing users
+12
View File
@@ -141,6 +141,7 @@ static int crule_match_mask(crule_context *, int, void **);
static int crule_match_ip(crule_context *, int, void **);
static int crule_match_account(crule_context *, int, void **);
static int crule_match_country(crule_context *, int, void **);
static int crule_match_asn(crule_context *, int, void **);
static int crule_match_certfp(crule_context *, int, void **);
static int crule_match_realname(crule_context *, int, void **);
@@ -200,6 +201,7 @@ struct crule_funclistent crule_funclist[] = {
{"match_ip", 1, crule_match_ip},
{"match_account", 1, crule_match_account},
{"match_country", 1, crule_match_country},
{"match_asn", 1, crule_match_asn},
{"match_certfp", 1, crule_match_certfp},
{"match_realname", 1, crule_match_realname},
{"", 0, NULL} /* this must be here to mark end of list */
@@ -518,6 +520,16 @@ static int crule_match_country(crule_context *context, int numargs, void *crulea
return 0;
}
static int crule_match_asn(crule_context *context, int numargs, void *crulearg[])
{
const char *arg = (char *)crulearg[0];
if (context && context->client && user_matches_extended_server_ban(context->client, "asn", arg))
return 1;
return 0;
}
static int crule_match_certfp(crule_context *context, int numargs, void *crulearg[])
{
const char *arg = (char *)crulearg[0];