From 883ac66b20f1ddffc8471b36a8b89b795c98569e Mon Sep 17 00:00:00 2001 From: Ed Kellett Date: Tue, 13 Jul 2021 15:13:47 +0100 Subject: [PATCH] kick,remove: don't confuse source and target membership --- extensions/m_remove.c | 16 ++++++++-------- modules/core/m_kick.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/extensions/m_remove.c b/extensions/m_remove.c index be2c2458..daea314b 100644 --- a/extensions/m_remove.c +++ b/extensions/m_remove.c @@ -67,7 +67,7 @@ DECLARE_MODULE_AV2(remove, NULL, NULL, remove_clist, NULL, remove_hfnlist, remov static void m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - struct membership *msptr; + struct membership *sourcems, *targetms; struct Client *who; struct Channel *chptr; int chasing = 0; @@ -95,16 +95,16 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source if(!IsServer(source_p)) { - msptr = find_channel_membership(chptr, source_p); + sourcems = find_channel_membership(chptr, source_p); - if((msptr == NULL) && MyConnect(source_p)) + if((sourcems == NULL) && MyConnect(source_p)) { sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name); return; } - if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP) + if(get_channel_access(source_p, chptr, sourcems, MODE_ADD, NULL) < CHFL_CHANOP) { if(MyConnect(source_p)) { @@ -154,9 +154,9 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source return; } - msptr = find_channel_membership(chptr, who); + targetms = find_channel_membership(chptr, who); - if(msptr != NULL) + if(targetms != NULL) { if(MyClient(source_p) && IsService(who)) { @@ -171,7 +171,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source hookdata.client = source_p; hookdata.chptr = chptr; - hookdata.msptr = msptr; + hookdata.msptr = sourcems; hookdata.target = who; hookdata.approved = 1; hookdata.dir = MODE_ADD; /* ensure modules like override speak up */ @@ -205,7 +205,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source ":%s KICK %s %s :%s", use_id(source_p), chptr->chname, use_id(who), comment); - remove_user_from_channel(msptr); + remove_user_from_channel(targetms); } else if (MyClient(source_p)) sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index 17231ecf..7a11d5b6 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -60,7 +60,7 @@ DECLARE_MODULE_AV2(kick, NULL, NULL, kick_clist, NULL, NULL, NULL, NULL, kick_de static void m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - struct membership *msptr; + struct membership *sourcems, *targetms; struct Client *who; struct Channel *chptr; int chasing = 0; @@ -88,16 +88,16 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p if(!IsServer(source_p)) { - msptr = find_channel_membership(chptr, source_p); + sourcems = find_channel_membership(chptr, source_p); - if((msptr == NULL) && MyConnect(source_p)) + if((sourcems == NULL) && MyConnect(source_p)) { sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name); return; } - if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP) + if(get_channel_access(source_p, chptr, sourcems, MODE_ADD, NULL) < CHFL_CHANOP) { if(MyConnect(source_p)) { @@ -127,9 +127,9 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p return; } - msptr = find_channel_membership(chptr, who); + targetms = find_channel_membership(chptr, who); - if(msptr != NULL) + if(targetms != NULL) { if(MyClient(source_p) && IsService(who)) { @@ -144,7 +144,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p hookdata.client = source_p; hookdata.chptr = chptr; - hookdata.msptr = msptr; + hookdata.msptr = sourcems; hookdata.target = who; hookdata.approved = 1; hookdata.dir = MODE_ADD; /* ensure modules like override speak up */ @@ -178,7 +178,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p sendto_server(client_p, chptr, CAP_TS6, NOCAPS, ":%s KICK %s %s :%s", use_id(source_p), chptr->chname, use_id(who), comment); - remove_user_from_channel(msptr); + remove_user_from_channel(targetms); } else if (MyClient(source_p)) sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,