mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 16:52:44 +01:00
Fix limits on simple modes.
Formerly some mode strings like +svvvv were not accepted.
This commit is contained in:
parent
46d59e1138
commit
84c9a8c7be
1 changed files with 24 additions and 2 deletions
26
src/chmode.c
26
src/chmode.c
|
@ -57,9 +57,12 @@
|
||||||
#define SM_ERR_RPL_Q 0x00000800
|
#define SM_ERR_RPL_Q 0x00000800
|
||||||
#define SM_ERR_RPL_F 0x00001000
|
#define SM_ERR_RPL_F 0x00001000
|
||||||
|
|
||||||
|
#define MAXMODES_SIMPLE 46 /* a-zA-Z except bqeIov */
|
||||||
|
|
||||||
static struct ChModeChange mode_changes[BUFSIZE];
|
static struct ChModeChange mode_changes[BUFSIZE];
|
||||||
static int mode_count;
|
static int mode_count;
|
||||||
static int mode_limit;
|
static int mode_limit;
|
||||||
|
static int mode_limit_simple;
|
||||||
static int mask_pos;
|
static int mask_pos;
|
||||||
|
|
||||||
static int orphaned_cflags = 0;
|
static int orphaned_cflags = 0;
|
||||||
|
@ -465,8 +468,8 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* +ntspmaikl == 9 + MAXMODEPARAMS (4 * +o) */
|
/* flags (possibly upto 32) + 4 with param */
|
||||||
if(MyClient(source_p) && (++mode_limit > (9 + MAXMODEPARAMS)))
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* setting + */
|
/* setting + */
|
||||||
|
@ -522,6 +525,9 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
/* setting + */
|
/* setting + */
|
||||||
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
|
if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type))
|
||||||
{
|
{
|
||||||
|
@ -924,6 +930,9 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
if((dir == MODE_ADD) && parc > *parn)
|
if((dir == MODE_ADD) && parc > *parn)
|
||||||
{
|
{
|
||||||
lstr = parv[(*parn)];
|
lstr = parv[(*parn)];
|
||||||
|
@ -980,6 +989,9 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
if((dir == MODE_ADD) && parc > *parn)
|
if((dir == MODE_ADD) && parc > *parn)
|
||||||
{
|
{
|
||||||
sscanf(parv[(*parn)], "%d:%d", &joins, ×lice);
|
sscanf(parv[(*parn)], "%d:%d", &joins, ×lice);
|
||||||
|
@ -1066,6 +1078,9 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
if(dir == MODE_ADD && parc > *parn)
|
if(dir == MODE_ADD && parc > *parn)
|
||||||
{
|
{
|
||||||
forward = parv[(*parn)];
|
forward = parv[(*parn)];
|
||||||
|
@ -1149,6 +1164,9 @@ chm_key(struct Client *source_p, struct Channel *chptr,
|
||||||
if(dir == MODE_QUERY)
|
if(dir == MODE_QUERY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
if((dir == MODE_ADD) && parc > *parn)
|
if((dir == MODE_ADD) && parc > *parn)
|
||||||
{
|
{
|
||||||
key = LOCAL_COPY(parv[(*parn)]);
|
key = LOCAL_COPY(parv[(*parn)]);
|
||||||
|
@ -1227,6 +1245,9 @@ chm_regonly(struct Client *source_p, struct Channel *chptr,
|
||||||
((dir == MODE_DEL) && !(chptr->mode.mode & MODE_REGONLY)))
|
((dir == MODE_DEL) && !(chptr->mode.mode & MODE_REGONLY)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||||
|
return;
|
||||||
|
|
||||||
if(dir == MODE_ADD)
|
if(dir == MODE_ADD)
|
||||||
chptr->mode.mode |= MODE_REGONLY;
|
chptr->mode.mode |= MODE_REGONLY;
|
||||||
else
|
else
|
||||||
|
@ -1543,6 +1564,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||||
mask_pos = 0;
|
mask_pos = 0;
|
||||||
mode_count = 0;
|
mode_count = 0;
|
||||||
mode_limit = 0;
|
mode_limit = 0;
|
||||||
|
mode_limit_simple = 0;
|
||||||
|
|
||||||
alevel = get_channel_access(source_p, msptr);
|
alevel = get_channel_access(source_p, msptr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue