X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_k.cpp;h=fd5808b739b3e2b3c94a9d32a812fea308795b12;hb=c5077c1c908ffb5581b8c54253d63ea6b38c0be0;hp=b32ad5c2ba2aabcae72d61bb055b40240b01cc9a;hpb=26e4582c2ebaa82b63ba1d85d52be7b69d1f468d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index b32ad5c2b..fd5808b73 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -22,6 +22,9 @@ ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channe void ModeChannelKey::RemoveMode(chanrec* channel) { + /** +k needs a parameter when being removed, + * so we have a special-case RemoveMode here for it + */ char moderemove[MAXBUF]; const char* parameters[] = { channel->name, moderemove, channel->key }; @@ -55,13 +58,12 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source))) { /* Key is currently set and the correct key wasnt given */ - ServerInstance->Log(DEBUG,"Key Cond 2"); return MODEACTION_DENY; } else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source)))) { /* Key isnt currently set */ - if ((parameter.length()) && (parameter.rfind(' ') == std::string::npos)) + if ((parameter.length()) && (parameter.length() < 32) && (parameter.rfind(' ') == std::string::npos)) { strlcpy(channel->key,parameter.c_str(),32); channel->modes[CM_KEY] = adding; @@ -77,12 +79,11 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel->modes[CM_KEY] = adding; return MODEACTION_ALLOW; } - ServerInstance->Log(DEBUG,"Key Cond three"); return MODEACTION_DENY; } else { - ServerInstance->Log(DEBUG,"Key Condition one"); return MODEACTION_DENY; } } +