diff --git a/include/modules.h b/include/modules.h index a34da1442..e963a7120 100644 --- a/include/modules.h +++ b/include/modules.h @@ -405,13 +405,13 @@ typedef struct { Client *client; /**< Client to check, can be a remote client */ Channel *channel; /**< Channel to check */ const char *banstr; /**< Mask string (ban) */ - ExtbanCheck checktype; /**< Check type, one of BANCHK_* */ + int ban_check_types; /**< Ban types to check for, one or more of BANCHK_* OR'd together */ const char *msg; /**< Message, only for some BANCHK_* types (for censoring text) */ const char *error_msg; /**< Error message, can be NULL */ int no_extbans; /**< Set to 1 to disable extended bans checking - only nick!user@host allowed */ int what; /**< MODE_ADD or MODE_DEL (for is_ok) */ - ExtbanType what2; /**< EXBTYPE_BAN or EXBTYPE_EXCEPT (for is_ok) */ - int is_ok_checktype; /**< One of EXBCHK_* (for is_ok) */ + ExtbanType ban_type; /**< EXBTYPE_BAN or EXBTYPE_EXCEPT (for is_ok) */ + ExtbanCheck is_ok_check;/**< One of EXBCHK_* (for is_ok) */ int conv_options; /**< One of BCTX_CONV_OPTION_* (for conv_param) */ } BanContext; diff --git a/src/api-extban.c b/src/api-extban.c index 81a872d28..e09eaf6d5 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -198,7 +198,7 @@ int extban_is_ok_nuh_extban(BanContext *b) if (extban_is_ok_recursion) return 0; /* Rule #1 violation (more than one stacked extban) */ - if ((b->is_ok_checktype == EXBCHK_PARAM) && RESTRICT_EXTENDEDBANS && !ValidatePermissionsForPath("immune:restrict-extendedbans",b->client,NULL,b->channel,NULL)) + if ((b->is_ok_check == EXBCHK_PARAM) && RESTRICT_EXTENDEDBANS && !ValidatePermissionsForPath("immune:restrict-extendedbans",b->client,NULL,b->channel,NULL)) { /* Test if this specific extban has been disabled. * (We can be sure RESTRICT_EXTENDEDBANS is not *. Else this extended ban wouldn't be happening at all.) diff --git a/src/channel.c b/src/channel.c index 6a4dba42e..4b5e3aab7 100644 --- a/src/channel.c +++ b/src/channel.c @@ -385,7 +385,7 @@ inline int ban_check_mask(BanContext *b) /* Is an extended ban. */ const char *nextbanstr; Extban *extban = findmod_by_bantype(b->banstr, &nextbanstr); - if (!extban || !(extban->is_banned_events & b->checktype)) + if (!extban || !(extban->is_banned_events & b->ban_check_types)) { return 0; } else { @@ -435,7 +435,7 @@ Ban *is_banned_with_nick(Client *client, Channel *channel, int type, const char b->client = client; b->channel = channel; - b->checktype = type; + b->ban_check_types = type; if (msg) b->msg = *msg; @@ -820,7 +820,7 @@ int find_invex(Channel *channel, Client *client) b->client = client; b->channel = channel; - b->checktype = BANCHK_JOIN; + b->ban_check_types = BANCHK_JOIN; for (inv = channel->invexlist; inv; inv = inv->next) { diff --git a/src/modules/chanmodes/link.c b/src/modules/chanmodes/link.c index f9de9b0f4..8090eaa75 100644 --- a/src/modules/chanmodes/link.c +++ b/src/modules/chanmodes/link.c @@ -229,9 +229,9 @@ int extban_link_is_ok(BanContext *b) if (b->what == MODE_DEL) return 1; - if (b->what2 != EXBTYPE_BAN) + if (b->ban_type != EXBTYPE_BAN) { - if (b->is_ok_checktype == EXBCHK_PARAM) + if (b->is_ok_check == EXBCHK_PARAM) sendnotice(b->client, "Ban type ~f only works with bans (+b) and not with exceptions or invex (+e/+I)"); return 0; // Reject } @@ -240,15 +240,15 @@ int extban_link_is_ok(BanContext *b) chan = paramtmp; matchby = strchr(paramtmp, ':'); if (!matchby || !matchby[1]) - return extban_link_syntax(b->client, b->is_ok_checktype, "Invalid syntax"); + return extban_link_syntax(b->client, b->is_ok_check, "Invalid syntax"); *matchby++ = '\0'; if (*chan != '#' || strchr(b->banstr, ',')) - return extban_link_syntax(b->client, b->is_ok_checktype, "Invalid channel"); + return extban_link_syntax(b->client, b->is_ok_check, "Invalid channel"); b->banstr = matchby; if (extban_is_ok_nuh_extban(b) == 0) - return extban_link_syntax(b->client, b->is_ok_checktype, "Invalid matcher"); + return extban_link_syntax(b->client, b->is_ok_check, "Invalid matcher"); return 1; // Is ok } @@ -360,7 +360,7 @@ int link_pre_localjoin_cb(Client *client, Channel *channel, const char *key) b->client = client; b->channel = channel; - b->checktype = BANCHK_JOIN; + b->ban_check_types = BANCHK_JOIN; for (ban = channel->banlist; ban; ban = ban->next) { diff --git a/src/modules/extbans/certfp.c b/src/modules/extbans/certfp.c index 8d9a61bfa..8bb110292 100644 --- a/src/modules/extbans/certfp.c +++ b/src/modules/extbans/certfp.c @@ -79,7 +79,7 @@ int extban_certfp_usage(Client *client) int extban_certfp_is_ok(BanContext *b) { - if (b->is_ok_checktype == EXCHK_PARAM) + if (b->is_ok_check == EXCHK_PARAM) { const char *p; diff --git a/src/modules/extbans/country.c b/src/modules/extbans/country.c index 0921656e0..012bfe965 100644 --- a/src/modules/extbans/country.c +++ b/src/modules/extbans/country.c @@ -77,7 +77,7 @@ int extban_country_usage(Client *client) int extban_country_is_ok(BanContext *b) { - if (b->is_ok_checktype == EXCHK_PARAM) + if (b->is_ok_check == EXCHK_PARAM) { const char *p; diff --git a/src/modules/extbans/inchannel.c b/src/modules/extbans/inchannel.c index 1cd9695f3..5d5a3ac58 100644 --- a/src/modules/extbans/inchannel.c +++ b/src/modules/extbans/inchannel.c @@ -99,7 +99,7 @@ int extban_inchannel_is_ok(BanContext *b) { const char *p = b->banstr; - if ((b->is_ok_checktype == EXBCHK_PARAM) && MyUser(b->client) && (b->what == MODE_ADD) && (strlen(b->banstr) > 3)) + if ((b->is_ok_check == EXBCHK_PARAM) && MyUser(b->client) && (b->what == MODE_ADD) && (strlen(b->banstr) > 3)) { if ((*p == '+') || (*p == '%') || (*p == '%') || (*p == '@') || (*p == '&') || (*p == '~')) diff --git a/src/modules/extbans/msgbypass.c b/src/modules/extbans/msgbypass.c index 32fc67830..ef0b6fcc0 100644 --- a/src/modules/extbans/msgbypass.c +++ b/src/modules/extbans/msgbypass.c @@ -76,7 +76,7 @@ int msgbypass_can_bypass(Client *client, Channel *channel, BypassChannelMessageR b->client = client; b->channel = channel; - b->checktype = BANCHK_MSG; + b->ban_check_types = BANCHK_MSG; for (ban = channel->exlist; ban; ban=ban->next) { @@ -187,9 +187,9 @@ int msgbypass_extban_is_ok(BanContext *b) if (b->what == MODE_DEL) return 1; - if (b->what2 != EXBTYPE_EXCEPT) + if (b->ban_type != EXBTYPE_EXCEPT) { - if (b->is_ok_checktype == EXBCHK_PARAM) + if (b->is_ok_check == EXBCHK_PARAM) sendnotice(b->client, "Ban type ~m only works with exceptions (+e) and not with bans or invex (+b/+I)"); return 0; /* reject */ } @@ -203,11 +203,11 @@ int msgbypass_extban_is_ok(BanContext *b) type = para; matchby = strchr(para, ':'); if (!matchby || !matchby[1]) - return msgbypass_extban_syntax(b->client, b->is_ok_checktype, "Invalid syntax"); + return msgbypass_extban_syntax(b->client, b->is_ok_check, "Invalid syntax"); *matchby++ = '\0'; if (!msgbypass_extban_type_ok(type)) - return msgbypass_extban_syntax(b->client, b->is_ok_checktype, "Unknown type"); + return msgbypass_extban_syntax(b->client, b->is_ok_check, "Unknown type"); b->banstr = matchby; if (extban_is_ok_nuh_extban(b) == 0) @@ -216,7 +216,7 @@ int msgbypass_extban_is_ok(BanContext *b) * invalid n!u@h syntax, unknown (sub)extbantype, * disabled extban type in conf, too much recursion, etc. */ - return msgbypass_extban_syntax(b->client, b->is_ok_checktype, "Invalid matcher"); + return msgbypass_extban_syntax(b->client, b->is_ok_check, "Invalid matcher"); } return 1; /* OK */ diff --git a/src/modules/extbans/securitygroup.c b/src/modules/extbans/securitygroup.c index 5e73f7289..ac412f2ab 100644 --- a/src/modules/extbans/securitygroup.c +++ b/src/modules/extbans/securitygroup.c @@ -95,7 +95,7 @@ int extban_securitygroup_generic(char *mask, int strict) int extban_securitygroup_is_ok(BanContext *b) { - if (MyUser(b->client) && (b->what == MODE_ADD) && (b->is_ok_checktype == EXBCHK_PARAM)) + if (MyUser(b->client) && (b->what == MODE_ADD) && (b->is_ok_check == EXBCHK_PARAM)) { char banbuf[SECURITYGROUPLEN+8]; strlcpy(banbuf, b->banstr, sizeof(banbuf)); diff --git a/src/modules/extbans/textban.c b/src/modules/extbans/textban.c index 7389f773c..580824ce1 100644 --- a/src/modules/extbans/textban.c +++ b/src/modules/extbans/textban.c @@ -256,11 +256,11 @@ int extban_modeT_is_ok(BanContext *b) { int n; - if ((b->what == MODE_ADD) && (b->what2 == EXBTYPE_EXCEPT) && MyUser(b->client)) + if ((b->what == MODE_ADD) && (b->ban_type == EXBTYPE_EXCEPT) && MyUser(b->client)) return 0; /* except is not supported */ /* We check the # of bans in the channel, may not exceed MAX_EXTBANT_PER_CHAN */ - if ((b->what == MODE_ADD) && (b->is_ok_checktype == EXBCHK_PARAM) && + if ((b->what == MODE_ADD) && (b->is_ok_check == EXBCHK_PARAM) && MyUser(b->client) && !IsOper(b->client) && ((n = counttextbans(b->channel)) >= MAX_EXTBANT_PER_CHAN)) { diff --git a/src/modules/extbans/timedban.c b/src/modules/extbans/timedban.c index 25e67adbc..043186dd1 100644 --- a/src/modules/extbans/timedban.c +++ b/src/modules/extbans/timedban.c @@ -255,13 +255,13 @@ int generic_ban_is_ok(BanContext *b) { if (!strcmp(RESTRICT_EXTENDEDBANS, "*")) { - if (b->is_ok_checktype == EXBCHK_ACCESS_ERR) + if (b->is_ok_check == EXBCHK_ACCESS_ERR) sendnotice(b->client, "Setting/removing of extended bans has been disabled"); return 0; /* REJECT */ } if (strchr(RESTRICT_EXTENDEDBANS, b->banstr[1])) { - if (b->is_ok_checktype == EXBCHK_ACCESS_ERR) + if (b->is_ok_check == EXBCHK_ACCESS_ERR) sendnotice(b->client, "Setting/removing of extended bantypes '%s' has been disabled", RESTRICT_EXTENDEDBANS); return 0; /* REJECT */ } @@ -271,7 +271,7 @@ int generic_ban_is_ok(BanContext *b) if (extban && extban->is_ok) { b->banstr = nextbanstr; - if ((b->is_ok_checktype == EXBCHK_ACCESS) || (b->is_ok_checktype == EXBCHK_ACCESS_ERR)) + if ((b->is_ok_check == EXBCHK_ACCESS) || (b->is_ok_check == EXBCHK_ACCESS_ERR)) { if (!extban->is_ok(b) && !ValidatePermissionsForPath("channel:override:mode:extban",b->client,NULL,b->channel,NULL)) @@ -279,7 +279,7 @@ int generic_ban_is_ok(BanContext *b) return 0; /* REJECT */ } } else - if (b->is_ok_checktype == EXBCHK_PARAM) + if (b->is_ok_check == EXBCHK_PARAM) { if (!extban->is_ok(b)) { @@ -326,17 +326,17 @@ int timedban_extban_is_ok(BanContext *b) durationstr = para; matchby = strchr(para, ':'); if (!matchby || !matchby[1]) - return timedban_extban_syntax(b->client, b->is_ok_checktype, "Invalid syntax"); + return timedban_extban_syntax(b->client, b->is_ok_check, "Invalid syntax"); *matchby++ = '\0'; duration = atoi(durationstr); if ((duration <= 0) || (duration > TIMEDBAN_MAX_TIME)) - return timedban_extban_syntax(b->client, b->is_ok_checktype, "Invalid duration time"); + return timedban_extban_syntax(b->client, b->is_ok_check, "Invalid duration time"); strlcpy(tmpmask, matchby, sizeof(tmpmask)); timedban_extban_is_ok_recursion++; - //res = extban_is_ok_nuh_extban(b->client, b->channel, tmpmask, b->is_ok_checktype, b->what, b->what2); + //res = extban_is_ok_nuh_extban(b->client, b->channel, tmpmask, b->is_ok_check, b->what, b->ban_type); b->banstr = tmpmask; res = generic_ban_is_ok(b); timedban_extban_is_ok_recursion--; @@ -346,7 +346,7 @@ int timedban_extban_is_ok(BanContext *b) * invalid n!u@h syntax, unknown (sub)extbantype, * disabled extban type in conf, too much recursion, etc. */ - return timedban_extban_syntax(b->client, b->is_ok_checktype, "Invalid matcher"); + return timedban_extban_syntax(b->client, b->is_ok_check, "Invalid matcher"); } return 1; /* OK */ diff --git a/src/modules/mode.c b/src/modules/mode.c index 7b9e375d8..4e48fab6b 100644 --- a/src/modules/mode.c +++ b/src/modules/mode.c @@ -551,9 +551,9 @@ const char *mode_ban_handler(Client *client, Channel *channel, const char *param b->client = client; b->channel = channel; b->banstr = nextbanstr; - b->is_ok_checktype = EXBCHK_PARAM; + b->is_ok_check = EXBCHK_PARAM; b->what = what; - b->what2 = extbtype; + b->ban_type = extbtype; if (extban && extban->is_ok) extban->is_ok(b); safe_free(b); @@ -576,9 +576,9 @@ const char *mode_ban_handler(Client *client, Channel *channel, const char *param b->client = client; b->channel = channel; b->what = what; - b->what2 = extbtype; + b->ban_type = extbtype; - b->is_ok_checktype = EXBCHK_ACCESS; + b->is_ok_check = EXBCHK_ACCESS; b->banstr = nextbanstr; if (!extban->is_ok(b)) { @@ -587,14 +587,14 @@ const char *mode_ban_handler(Client *client, Channel *channel, const char *param /* TODO: send operoverride notice */ } else { b->banstr = nextbanstr; - b->is_ok_checktype = EXBCHK_ACCESS_ERR; + b->is_ok_check = EXBCHK_ACCESS_ERR; extban->is_ok(b); safe_free(b); return NULL; } } b->banstr = nextbanstr; - b->is_ok_checktype = EXBCHK_PARAM; + b->is_ok_check = EXBCHK_PARAM; if (!extban->is_ok(b)) { safe_free(b); diff --git a/src/modules/svsmode.c b/src/modules/svsmode.c index b3b259f77..c6ba8807a 100644 --- a/src/modules/svsmode.c +++ b/src/modules/svsmode.c @@ -119,7 +119,7 @@ void unban_user(Client *client, Channel *channel, Client *acptr, char chmode) b = safe_alloc(sizeof(BanContext)); b->client = acptr; b->channel = channel; - b->checktype = BANCHK_JOIN; + b->ban_check_types = BANCHK_JOIN; for (ban = *banlist; ban; ban = bnext) { @@ -134,7 +134,7 @@ void unban_user(Client *client, Channel *channel, Client *acptr, char chmode) } else if (chmode != 'I' && *ban->banstr == '~' && (extban = findmod_by_bantype(ban->banstr, &nextbanstr))) { - if ((extban->options & EXTBOPT_CHSVSMODE) && (extban->is_banned_events & b->checktype)) + if ((extban->options & EXTBOPT_CHSVSMODE) && (extban->is_banned_events & b->ban_check_types)) { b->banstr = nextbanstr; if (extban->is_banned(b)) diff --git a/src/modules/tkl.c b/src/modules/tkl.c index 0f94a7b59..816e10643 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -1306,9 +1306,9 @@ int parse_extended_server_ban(const char *mask_in, Client *client, char **error, b = safe_alloc(sizeof(BanContext)); b->client = client; b->banstr = nextbanstr; - b->is_ok_checktype = EXBCHK_PARAM; + b->is_ok_check = EXBCHK_PARAM; b->what = MODE_ADD; - b->what2 = EXBTYPE_TKL; + b->ban_type = EXBTYPE_TKL; /* Run .is_ok() for the extban. This check is skipped if coming from a remote user/server */ if (skip_checking == 0) @@ -5177,7 +5177,7 @@ int _match_user_extended_server_ban(const char *banstr, Client *client) b = safe_alloc(sizeof(BanContext)); b->client = client; b->banstr = nextbanstr; - b->checktype = BANCHK_TKL; + b->ban_check_types = BANCHK_TKL; ret = extban->is_banned(b); safe_free(b); return ret;