1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 01:40:27 +00:00

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.
This commit is contained in:
Alexander Barton 2023-01-02 21:42:04 +01:00
parent 0ea1715d00
commit 3c9c54989e

View File

@ -610,13 +610,14 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
break; break;
} }
if (arg_arg <= mode_arg) { if (arg_arg <= mode_arg) {
#ifdef STRICT_RFC if (is_machine)
/* Only send error message in "strict" mode, Log(LOG_ERR,
* this is how ircd2.11 and others behave ... */ "Got MODE +k without key for \"%s\" from \"%s\"! Ignored.",
connected = IRC_WriteErrClient(Origin, Channel_Name(Channel), Client_ID(Origin));
ERR_NEEDMOREPARAMS_MSG, else
Client_ID(Origin), Req->command); connected = IRC_WriteErrClient(Origin,
#endif ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
goto chan_exit; goto chan_exit;
} }
if (is_oper || is_machine || is_owner || if (is_oper || is_machine || is_owner ||
@ -649,13 +650,14 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
break; break;
} }
if (arg_arg <= mode_arg) { if (arg_arg <= mode_arg) {
#ifdef STRICT_RFC if (is_machine)
/* Only send error message in "strict" mode, Log(LOG_ERR,
* this is how ircd2.11 and others behave ... */ "Got MODE +l without limit for \"%s\" from \"%s\"! Ignored.",
connected = IRC_WriteErrClient(Origin, Channel_Name(Channel), Client_ID(Origin));
ERR_NEEDMOREPARAMS_MSG, else
Client_ID(Origin), Req->command); connected = IRC_WriteErrClient(Origin,
#endif ERR_NEEDMOREPARAMS_MSG,
Client_ID(Origin), Req->command);
goto chan_exit; goto chan_exit;
} }
if (is_oper || is_machine || is_owner || if (is_oper || is_machine || is_owner ||