From: Florian Westphal Date: Mon, 28 Feb 2011 20:09:47 +0000 (+0100) Subject: channel: always reject zero-length channel key X-Git-Tag: rel-18-rc1~45 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=commitdiff_plain;h=5417a72536954927371d597e9a4e0453e70620e3 channel: always reject zero-length channel key previously, any client could join in this configuration: [Channel] Name = #test Modes = tnk KeyFile = /tmp/foobar fix this by checking for zero-length key before comparing key to channel key. --- diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c index d1f9c6c9..6e8851b6 100644 --- a/src/ngircd/channel.c +++ b/src/ngircd/channel.c @@ -1082,10 +1082,10 @@ Channel_CheckKey(CHANNEL *Chan, CLIENT *Client, const char *Key) if (!strchr(Chan->modes, 'k')) return true; - if (strcmp(Chan->key, Key) == 0) - return true; if (*Key == '\0') return false; + if (strcmp(Chan->key, Key) == 0) + return true; file_name = array_start(&Chan->keyfile); if (!file_name)