From 90ee2ee38c733520a8d149f90498bdbdb6091d67 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 27 Aug 2007 13:54:15 +0000 Subject: Add FindNickOnly, that wont fall through to uid checks if isdigit(*first). We may need this. (i thought we did for this fix, we dont) Fix cmd_nick to not treat all nicks as invalid and make the client give up. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7883 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_nick.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/cmd_nick.cpp') diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 06c1c8766..c1638469e 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -76,7 +76,8 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) * the nickname too, we force a nickchange on the older user (Simply the one who was * here first, no TS checks need to take place here) */ - userrec* InUse = ServerInstance->FindNick(parameters[0]); + userrec* InUse = ServerInstance->FindNickOnly(parameters[0]); + ServerInstance->Log(DEBUG,"Nick in use"); if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0]) || allowinvalid))) { if (InUse->registered != REG_ALL) @@ -93,15 +94,19 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) } else { + ServerInstance->Log(DEBUG,"Nick in use and user REG_ALL"); user->WriteServ("433 %s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]); return CMD_FAILURE; } } } - if (((!allowinvalid || !ServerInstance->IsNick(parameters[0]))) && (IS_LOCAL(user))) + if (((!ServerInstance->IsNick(parameters[0]))) && (IS_LOCAL(user))) { - user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]); - return CMD_FAILURE; + if (!allowinvalid) + { + user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]); + return CMD_FAILURE; + } } if (user->registered == REG_ALL) -- cgit v1.3.1-10-gc9f91