]> arthur.barton.de Git - ngircd.git/commitdiff
channel: always reject zero-length channel key
authorFlorian Westphal <fw@strlen.de>
Mon, 28 Feb 2011 20:09:47 +0000 (21:09 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 28 Feb 2011 22:28:24 +0000 (23:28 +0100)
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.

src/ngircd/channel.c

index d1f9c6c9790a17748b1a37dbed6ae3bb24e69a84..6e8851b64113b44c4b5dd7e47faf370dba0f6675 100644 (file)
@@ -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)