Module: ngircd.git Branch: master Commit: 8ae2cdfce9f8ba75fe72d65603d4c05c87f6d9c2 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=8ae2c...
Author: Alexander Barton alex@barton.de Date: Wed Jan 8 14:18:09 2014 +0100
Send "fake '*' key" in "MODE -k" replies
According to RFC 2812 3.2.3 "Channel mode message" and the examples there, it looks like clients should use "MODE -k <key>" to unset channel keys; and that's how other servers and services behave and do expect it.
(But please note that this is NOT the case for "MODE -l"!)
In the end, it doesn't make sense to specify a key when UNsetting it at all, and different services behave diffrently when clients do not send the currently set key to unset it - some ignore such calls, for example!
But this implementation is quite relaxed, it accepts any key when unsetting channel mode "k" and even accepts no key at all. But the reply will always include an "*" character for every "-k" parameter.
---
src/ngircd/irc-mode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c index a29ed23..a59f085 100644 --- a/src/ngircd/irc-mode.c +++ b/src/ngircd/irc-mode.c @@ -582,9 +582,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) goto chan_exit; if (!set) { if (is_oper || is_machine || is_owner || - is_admin || is_op || is_halfop) + is_admin || is_op || is_halfop) { x[0] = *mode_ptr; - else + if (Channel_HasMode(Channel, 'k')) + strlcpy(argadd, "*", sizeof(argadd)); + if (arg_arg > mode_arg) + arg_arg++; + } else connected = IRC_WriteErrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID(Origin),