]> arthur.barton.de Git - ngircd-alex.git/commitdiff
MODE: don't report error on "more modes than parameters"
authorAlexander Barton <alex@barton.de>
Sun, 13 Jan 2013 15:52:00 +0000 (16:52 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 13 Jan 2013 16:18:04 +0000 (17:18 +0100)
Don't report ERR_NEEDMOREPARAMS(461) when a MDOE command with more modes
than nicknames is handled, as well as for channel limit and key changes
without specifying the limit or key parameters.

This is how a lot (all?) other IRC servers behave, including ircd2.11,
InspIRCd, and ircd-seven. And because of clients (tested with Textual and
mIRC) sending bogus MODE commands like "MODE -ooo nick", end-users got the
expected result as well as correct but misleading error messages ...

If ngIRCd is compiled using "strict mode", these errors are still reported.

Reported-by: Tim <tim@stackwatch.net>
src/ngircd/irc-mode.c

index a63a0f411bc95a4320fa2bc9a47ff84d176bcc49..b5f28fa36d73cc0f3bac75d394d1504c667b79a7 100644 (file)
@@ -628,9 +628,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Only send error message in "strict" mode,
+                                * this is how ircd2.11 and others behave ... */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;
@@ -668,9 +672,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Only send error message in "strict" mode,
+                                * this is how ircd2.11 and others behave ... */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;
@@ -761,9 +769,17 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                                Req->argv[arg_arg][0] = '\0';
                                arg_arg++;
                        } else {
+#ifdef STRICT_RFC
+                               /* Report an error to the client, when a user
+                                * mode should be changed but no nickname is
+                                * given. But don't do it when not in "strict"
+                                * mode, because most other servers don't do
+                                * it as well and some clients send "wired"
+                                * MODE commands like "MODE #chan -ooo nick". */
                                connected = IRC_WriteStrClient(Origin,
                                        ERR_NEEDMOREPARAMS_MSG,
                                        Client_ID(Origin), Req->command);
+#endif
                                goto chan_exit;
                        }
                        break;