summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2023-01-02 21:42:04 +0100
committerAlexander Barton <alex@barton.de>2023-01-02 21:48:42 +0100
commit3c9c54989ed20f4ed69ce6390430c01a1b0ce314 (patch)
tree3c4facf8d1e3a114db882c7b8463f7ad8bc7b0cb /src
parent0ea1715d00b5112f2c9abc0721164271d77825f6 (diff)
downloadngircd-3c9c54989ed20f4ed69ce6390430c01a1b0ce314.tar.gz
ngircd-3c9c54989ed20f4ed69ce6390430c01a1b0ce314.zip
Channel modes +k & +l: Always report an error when a parameter is missing
This relates to #290 and considerations which errors to show when: and I
think it is the better approach to give feedback instead of silently
failing.

Note that this code path is also used when handling modes of channels
defined in "[Channel]" blocks in configuration files: in this case the
client is the local server and we can't send messages to it, because it
has no socket connection! Therefore we need those "is_machine" checks
and log an error im this case.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-mode.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index baca6c10..4a26ef02 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -610,13 +610,14 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 				break;
 			}
 			if (arg_arg <= mode_arg) {
-#ifdef STRICT_RFC
-				/* Only send error message in "strict" mode,
-				 * this is how ircd2.11 and others behave ... */
-				connected = IRC_WriteErrClient(Origin,
-					ERR_NEEDMOREPARAMS_MSG,
-					Client_ID(Origin), Req->command);
-#endif
+				if (is_machine)
+					Log(LOG_ERR,
+					    "Got MODE +k without key for \"%s\" from \"%s\"! Ignored.",
+					    Channel_Name(Channel), Client_ID(Origin));
+				else
+					connected = IRC_WriteErrClient(Origin,
+						ERR_NEEDMOREPARAMS_MSG,
+						Client_ID(Origin), Req->command);
 				goto chan_exit;
 			}
 			if (is_oper || is_machine || is_owner ||
@@ -649,13 +650,14 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 				break;
 			}
 			if (arg_arg <= mode_arg) {
-#ifdef STRICT_RFC
-				/* Only send error message in "strict" mode,
-				 * this is how ircd2.11 and others behave ... */
-				connected = IRC_WriteErrClient(Origin,
-					ERR_NEEDMOREPARAMS_MSG,
-					Client_ID(Origin), Req->command);
-#endif
+				if (is_machine)
+					Log(LOG_ERR,
+					    "Got MODE +l without limit for \"%s\" from \"%s\"! Ignored.",
+					    Channel_Name(Channel), Client_ID(Origin));
+				else
+					connected = IRC_WriteErrClient(Origin,
+						ERR_NEEDMOREPARAMS_MSG,
+						Client_ID(Origin), Req->command);
 				goto chan_exit;
 			}
 			if (is_oper || is_machine || is_owner ||