From 3c758944a930726fd269542d87e8de44ac1cdace Mon Sep 17 00:00:00 2001 From: dz Date: Sat, 14 Mar 2009 15:12:36 +0000 Subject: 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 --- src/commands/cmd_zline.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src') 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)) { -- cgit v1.2.3