From: William Pitcock Date: Thu, 14 Jan 2016 04:16:44 +0000 (-0600) Subject: ircd: get_channel_access(): do not derive channel pointer from membership X-Git-Url: https://jfr.im/git/solanum.git/commitdiff_plain/3ee43bcf296ec634a5314b9b8c17b9ddc8d3bd24?hp=633531a4aac5b70e13a428361517bcf80c41f5b2 ircd: get_channel_access(): do not derive channel pointer from membership --- diff --git a/extensions/m_remove.c b/extensions/m_remove.c index 9321e37a..29c33b40 100644 --- a/extensions/m_remove.c +++ b/extensions/m_remove.c @@ -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)) { diff --git a/include/channel.h b/include/channel.h index 0999a964..7f6a1886 100644 --- a/include/channel.h +++ b/include/channel.h @@ -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); diff --git a/ircd/chmode.c b/ircd/chmode.c index 848cd101..127494ee 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -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; diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index 8473ae37..6f7e6a16 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -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)) { diff --git a/modules/m_topic.c b/modules/m_topic.c index f6a79fc4..d1728351 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -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))) {