diff --git a/doc/RELEASE-NOTES.md b/doc/RELEASE-NOTES.md index a08f915df..ce3be31ca 100644 --- a/doc/RELEASE-NOTES.md +++ b/doc/RELEASE-NOTES.md @@ -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 diff --git a/src/modules/crule.c b/src/modules/crule.c index f1e49f613..7a39a8b7e 100644 --- a/src/modules/crule.c +++ b/src/modules/crule.c @@ -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];