]> jfr.im git - solanum.git/commitdiff
ircd: get_channel_access(): do not derive channel pointer from membership
authorWilliam Pitcock <redacted>
Thu, 14 Jan 2016 04:16:44 +0000 (22:16 -0600)
committerWilliam Pitcock <redacted>
Thu, 14 Jan 2016 04:16:44 +0000 (22:16 -0600)
extensions/m_remove.c
include/channel.h
ircd/chmode.c
modules/core/m_kick.c
modules/m_topic.c

index 9321e37a0ad96aca5ecc60f1e0470bd64f625b98..29c33b4033bcf0412e1161ec0d89a24933f15373 100644 (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))
                        {
index 0999a96444dc44be1e0c761f85abbef2a66ecd39..7f6a1886230ea46b9c618b9ee6b0cf13a272648a 100644 (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);
 
index 848cd101e4220dd0a9465e7be335aab58e221795..127494ee5bb25bf1e44eae3f2811d3cdced7753d 100644 (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;
index 8473ae3789dbab963d16893ece2f6255f6397158..6f7e6a168ade9d5bd5cbe0e8dc460d2c4cb2c309 100644 (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))
                        {
index f6a79fc472961559e63e69e49e8db9c2daec7e6b..d1728351213a9cd8e348aab6a1fea0602ed3ba82 100644 (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)))
                {