ircd: get_channel_access(): do not derive channel pointer from membership

This commit is contained in:
William Pitcock 2016-01-13 22:16:44 -06:00
parent 633531a4aa
commit 3ee43bcf29
5 changed files with 10 additions and 10 deletions

View file

@ -114,7 +114,7 @@ m_remove(struct Client *client_p, struct Client *source_p, int parc, const char
return 0;
}
if(get_channel_access(source_p, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
{
if(MyConnect(source_p))
{

View file

@ -276,7 +276,7 @@ extern int match_extban(const char *banstr, struct Client *client_p, struct Chan
extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
const char * get_extban_string(void);
extern int get_channel_access(struct Client *source_p, struct membership *msptr, int dir, const char *modestr);
extern int get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr);
extern void send_channel_join(struct Channel *chptr, struct Client *client_p);

View file

@ -180,7 +180,7 @@ cflag_orphan(char c_)
}
int
get_channel_access(struct Client *source_p, struct membership *msptr, int dir, const char *modestr)
get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr)
{
hook_data_channel_approval moduledata;
@ -188,7 +188,7 @@ get_channel_access(struct Client *source_p, struct membership *msptr, int dir, c
return CHFL_CHANOP;
moduledata.client = source_p;
moduledata.chptr = msptr->chptr;
moduledata.chptr = chptr;
moduledata.msptr = msptr;
moduledata.target = NULL;
moduledata.approved = (msptr != NULL && is_chanop(msptr)) ? CHFL_CHANOP : CHFL_PEON;
@ -518,7 +518,7 @@ check_forward(struct Client *source_p, struct Channel *chptr,
if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET))
{
if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
get_channel_access(source_p, msptr, MODE_QUERY, NULL) != CHFL_CHANOP)
get_channel_access(source_p, targptr, msptr, MODE_QUERY, NULL) != CHFL_CHANOP)
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, targptr->chname);
@ -1702,7 +1702,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
else
fakesource_p = source_p;
alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
for(; (c = *ml) != 0; ml++)
{
@ -1712,7 +1712,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
dir = MODE_ADD;
if (!reauthorized)
{
alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
reauthorized = 1;
}
break;
@ -1720,7 +1720,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
dir = MODE_DEL;
if (!reauthorized)
{
alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
alevel = get_channel_access(source_p, chptr, msptr, dir, reconstruct_parv(parc, parv));
reauthorized = 1;
}
break;

View file

@ -97,7 +97,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
return 0;
}
if(get_channel_access(source_p, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
{
if(MyConnect(source_p))
{

View file

@ -120,7 +120,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
}
if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 ||
get_channel_access(source_p, msptr, MODE_ADD, NULL) >= CHFL_CHANOP) &&
get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) >= CHFL_CHANOP) &&
(!MyClient(source_p) ||
can_send(chptr, source_p, msptr)))
{