From: dz Date: Sat, 14 Mar 2009 15:12:36 +0000 (+0000) Subject: Strip a zline target of anything resembling an ident prior to sanity checking rather... X-Git-Tag: v2.0.23~2001 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=3c758944a930726fd269542d87e8de44ac1cdace;p=user%2Fhenk%2Fcode%2Finspircd.git Strip a zline target of anything resembling an ident prior to sanity checking rather than after, fixes bug #766 reported by Taros git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11220 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index b0df24a95..fa54590e2 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -41,27 +41,20 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User target = u->GetIPString(); } - if (ServerInstance->IPMatchesEveryone(target.c_str(),user)) - return CMD_FAILURE; - - long duration = ServerInstance->Duration(parameters[1].c_str()); - const char* ipaddr = target.c_str(); - User* find = ServerInstance->FindNick(target.c_str()); - if (find) - { - ipaddr = find->GetIPString(); - } - else + if (strchr(ipaddr,'@')) { - if (strchr(ipaddr,'@')) - { - while (*ipaddr != '@') - ipaddr++; + while (*ipaddr != '@') ipaddr++; - } + ipaddr++; } + + if (ServerInstance->IPMatchesEveryone(ipaddr,user)) + return CMD_FAILURE; + + long duration = ServerInstance->Duration(parameters[1].c_str()); + ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr); if (ServerInstance->XLines->AddLine(zl,user)) {