summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-18 16:51:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-18 16:51:20 +0000
commit592f23e7053cb81b076057918c3459a3ba0f5317 (patch)
tree7774498c3390b8af9d6b3f62e3bda48f044950a4
parenta62f6e211361fc36113d5bcf490d62ac37fd4417 (diff)
Dont allow an empty key (thanks stskeeps)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4957 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modes/cmode_k.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 6e5ba0269..751b993d3 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -39,9 +39,14 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec*
else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source))))
{
/* Key isnt currently set */
- strlcpy(channel->key,parameter.c_str(),32);
- channel->modes[CM_KEY] = adding;
- return MODEACTION_ALLOW;
+ if (parameter.length())
+ {
+ strlcpy(channel->key,parameter.c_str(),32);
+ channel->modes[CM_KEY] = adding;
+ return MODEACTION_ALLOW;
+ }
+ else
+ return MODEACTION_DENY;
}
else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source))))
{