static struct ChModeChange mode_changes[BUFSIZE];
static int mode_count;
-static int mode_limit;
-static int mode_limit_simple;
static int mask_pos;
static int removed_mask_pos;
if(!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
return;
}
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
return;
}
- if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
/* setting + */
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
{
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
-
- if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
/* empty ban, or starts with ':' which messes up s2s, ignore it */
if (EmptyString(arg) || *arg == ':')
return;
return;
}
- if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
if(dir == MODE_ADD)
{
if(targ_p == source_p && mstptr->flags & CHFL_CHANOP)
return;
}
- if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
- return;
-
if(dir == MODE_ADD)
{
mode_changes[mode_count].letter = c;
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if (EmptyString(arg) || (limit = atoi(arg)) <= 0)
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if (sscanf(arg, "%d:%d", &joins, ×lice) < 2)
}
#endif
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
if(EmptyString(arg))
if (!allow_mode_change(source_p, chptr, alevel, errors, c))
return;
- if (MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
- return;
-
if (dir == MODE_ADD)
{
key = LOCAL_COPY(arg);
char c;
struct Client *fakesource_p;
int flags_list[3] = { ALL_MEMBERS, ONLY_CHANOPS, ONLY_OPERS };
+ int mode_limit = 0;
+ int mode_limit_simple = 0;
mask_pos = 0;
removed_mask_pos = 0;
mode_count = 0;
- mode_limit = 0;
- mode_limit_simple = 0;
/* Hide connecting server on netburst -- jilles */
if (ConfigServerHide.flatten_links && IsServer(source_p) && !has_id(source_p) && !HasSentEob(source_p))
continue;
}
+ if (MyClient(source_p))
+ {
+ if (use_arg && ++mode_limit > MAXMODEPARAMS)
+ continue;
+ if (!use_arg && ++mode_limit_simple > MAXMODES_SIMPLE)
+ continue;
+ }
+
char op = effective_dir == MODE_ADD ? '+' :
effective_dir == MODE_DEL ? '-' :
'=';
remove_hook("get_channel_access", chmode_access_hook);
}
+void
+test_chmode_limits(void)
+{
+ char chmode_buf[2 + MAXMODEPARAMS + 1] = "+";
+ const char *chmode_parv[1 + MAXMODEPARAMS + 1] = { chmode_buf };
+ add_hook_prio("get_channel_access", chmode_access_hook, HOOK_MONITOR);
+
+ for (size_t i = 0; i < MAXMODEPARAMS + 1; i++)
+ {
+ chmode_buf[i + 1] = 'l';
+ chmode_parv[i + 1] = "7";
+ }
+
+ set_channel_mode(client, client, channel, NULL, 1 + MAXMODEPARAMS + 1, chmode_parv);
+
+ is_int('+', chmode_hdata.modestr[0], MSG);
+
+ for (size_t i = 0; i < MAXMODEPARAMS; i++)
+ {
+ is_int('l', chmode_hdata.modestr[i + 1], MSG);
+ }
+
+ is_int(' ', chmode_hdata.modestr[MAXMODEPARAMS + 1], MSG);
+
+ for (size_t i = 0; i < MAXMODEPARAMS; i++)
+ {
+ is_int(' ', chmode_hdata.modestr[MAXMODEPARAMS + 1 + i * 2], MSG);
+ is_int('7', chmode_hdata.modestr[MAXMODEPARAMS + 2 + i * 2], MSG);
+ }
+
+ is_int('\0', chmode_hdata.modestr[MAXMODEPARAMS * 3 + 1], MSG);
+
+ remove_hook("get_channel_access", chmode_access_hook);
+}
+
static void
chmode_init(void)
{
chmode_init();
test_chmode_parse();
+ test_chmode_limits();
client_util_free();
ircd_util_free();