chanroles: instead of checking for chanop + CHANROLE_UNSET combination, grant a default set of flags.
this allows ops with zero effective privilege.
This commit is contained in:
parent
460b6d9fb2
commit
f3bfe2c271
2 changed files with 8 additions and 12 deletions
|
@ -196,6 +196,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
|
||||||
#define CHANROLE_GRANT 0x008 /* Can grant (unused atm) */
|
#define CHANROLE_GRANT 0x008 /* Can grant (unused atm) */
|
||||||
#define CHANROLE_MODE 0x010 /* Can change modes */
|
#define CHANROLE_MODE 0x010 /* Can change modes */
|
||||||
#define CHANROLE_TOPIC 0x020 /* Can change topic */
|
#define CHANROLE_TOPIC 0x020 /* Can change topic */
|
||||||
|
#define CHANROLE_INHERIT 0x040 /* Role is inherited (backwards compat) */
|
||||||
|
|
||||||
#define CHANROLE_INITIAL (CHANROLE_KICK | CHANROLE_STATUS | CHANROLE_GRANT | CHANROLE_MODE | CHANROLE_TOPIC)
|
#define CHANROLE_INITIAL (CHANROLE_KICK | CHANROLE_STATUS | CHANROLE_GRANT | CHANROLE_MODE | CHANROLE_TOPIC)
|
||||||
|
|
||||||
|
|
19
src/chmode.c
19
src/chmode.c
|
@ -202,24 +202,12 @@ get_channel_access(struct Client *source_p, struct membership *msptr, int role)
|
||||||
moduledata.msptr = msptr;
|
moduledata.msptr = msptr;
|
||||||
moduledata.target = NULL;
|
moduledata.target = NULL;
|
||||||
|
|
||||||
if (is_chanop(msptr))
|
|
||||||
{
|
|
||||||
/* Their chanrole is unset by GRANT, for backwards compat let them pass */
|
|
||||||
if(HasChanRole(msptr, CHANROLE_UNSET))
|
|
||||||
{
|
|
||||||
moduledata.approved = CHFL_CHANOP;
|
|
||||||
goto finish_access;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if they have the proper role */
|
/* Check if they have the proper role */
|
||||||
if(HasChanRole(msptr, role))
|
if(HasChanRole(msptr, role))
|
||||||
moduledata.approved = CHFL_CHANOP;
|
moduledata.approved = CHFL_CHANOP;
|
||||||
else
|
else
|
||||||
moduledata.approved = CHFL_PEON;
|
moduledata.approved = CHFL_PEON;
|
||||||
|
|
||||||
finish_access:
|
|
||||||
|
|
||||||
call_hook(h_get_channel_access, &moduledata);
|
call_hook(h_get_channel_access, &moduledata);
|
||||||
|
|
||||||
return moduledata.approved;
|
return moduledata.approved;
|
||||||
|
@ -915,6 +903,11 @@ chm_op(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count++].client = targ_p;
|
mode_changes[mode_count++].client = targ_p;
|
||||||
|
|
||||||
mstptr->flags |= CHFL_CHANOP;
|
mstptr->flags |= CHFL_CHANOP;
|
||||||
|
if (msptr->roles & CHANROLE_UNSET)
|
||||||
|
{
|
||||||
|
mstptr->roles &= ~CHANROLE_UNSET;
|
||||||
|
mstptr->roles = CHANROLE_INITIAL | CHANROLE_INHERIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -935,6 +928,8 @@ chm_op(struct Client *source_p, struct Channel *chptr,
|
||||||
mode_changes[mode_count++].client = targ_p;
|
mode_changes[mode_count++].client = targ_p;
|
||||||
|
|
||||||
mstptr->flags &= ~CHFL_CHANOP;
|
mstptr->flags &= ~CHFL_CHANOP;
|
||||||
|
if (mstptr->roles & CHANROLE_INHERIT)
|
||||||
|
mstptr->roles = CHANROLE_UNSET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue