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.
This commit is contained in:
Florian Westphal 2011-02-28 21:09:47 +01:00
parent 94e4562c1c
commit 5417a72536
1 changed files with 2 additions and 2 deletions

View File

@ -1082,10 +1082,10 @@ Channel_CheckKey(CHANNEL *Chan, CLIENT *Client, const char *Key)
if (!strchr(Chan->modes, 'k')) if (!strchr(Chan->modes, 'k'))
return true; return true;
if (strcmp(Chan->key, Key) == 0)
return true;
if (*Key == '\0') if (*Key == '\0')
return false; return false;
if (strcmp(Chan->key, Key) == 0)
return true;
file_name = array_start(&Chan->keyfile); file_name = array_start(&Chan->keyfile);
if (!file_name) if (!file_name)