about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2024-01-09 16:36:10 +0100
committerAlexander Barton <alex@barton.de>2024-01-11 15:12:54 +0100
commita06f33d4e5854524f94aaab38d7a35e55c6c3422 (patch)
tree96dd7b8dd29c6a164affc0296b996acb84847c50 /src
parent541351858699bc7f196a197e417dce3b7f13b124 (diff)
downloadngircd-a06f33d4e5854524f94aaab38d7a35e55c6c3422.tar.gz
ngircd-a06f33d4e5854524f94aaab38d7a35e55c6c3422.zip
Channel Admins are not allowed to set Channel Owner status!
This was reported back in April 2021, thanks Sarah!

    Subject: NGIRCD bug report
    Date: April 28 2021, 14:30:08 MESZ
    To: alex@barton.de

    Hello,

    I am writing to you to report a bug in ngircd.
    In any give channel, if an user is with mode +a (admin), he/she can
    sets mode +/-q(owner) to any other user. This is not inline with the
    documentation.

    I've looked into the code irc-mode.c, apparently an if block is
    missing. Below are the code snippets that I believe fixes the bug.

This patch is what Sarah sent in. Thanks a lot!
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-mode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index 0ea046e5..b505aee5 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -740,6 +740,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 			break;
 		/* --- Channel user modes --- */
 		case 'q': /* Owner */
+			if(!is_oper && !is_machine && !is_owner) {
+				connected = IRC_WriteErrClient(Origin,
+					ERR_CHANOPPRIVTOOLOW_MSG,
+					Client_ID(Origin),
+					Channel_Name(Channel));
+				goto chan_exit;
+			}
 		case 'a': /* Channel admin */
 			if(!is_oper && !is_machine && !is_owner && !is_admin) {
 				connected = IRC_WriteErrClient(Origin,