about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2011-02-28 21:09:47 +0100
committerFlorian Westphal <fw@strlen.de>2011-02-28 23:28:24 +0100
commit5417a72536954927371d597e9a4e0453e70620e3 (patch)
treea7034db84c64a2ea474070d621218d68afb89e75 /src
parent94e4562c1c732f7bf67bed2f77cc7b3b0aeaeafe (diff)
downloadngircd-5417a72536954927371d597e9a4e0453e70620e3.tar.gz
ngircd-5417a72536954927371d597e9a4e0453e70620e3.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/channel.c4
1 files changed, 2 insertions, 2 deletions
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)