X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_oper%2Fcmd_oper.cpp;h=2ca017525101bdb348de0691b6bd5f1d0af8e12f;hb=6cfabb0064cab52bbbab59974e53dc0fa1954da7;hp=e4ba69549e6f7a6ffb6adce0da1a754c8c15bd3d;hpb=7e0e54eba331339606265a8a4e11417bb2f832ba;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_oper/cmd_oper.cpp b/src/coremods/core_oper/cmd_oper.cpp index e4ba69549..2ca017525 100644 --- a/src/coremods/core_oper/cmd_oper.cpp +++ b/src/coremods/core_oper/cmd_oper.cpp @@ -1,9 +1,15 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2020 Matt Schatz + * Copyright (C) 2013-2014, 2017-2018 Sadie Powell + * Copyright (C) 2012, 2014, 2016 Attila Molnar + * Copyright (C) 2012 Robby + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2008 Thomas Stagner * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006, 2008, 2010 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -28,13 +34,13 @@ CommandOper::CommandOper(Module* parent) syntax = " "; } -CmdResult CommandOper::HandleLocal(const std::vector& parameters, LocalUser *user) +CmdResult CommandOper::HandleLocal(LocalUser* user, const Params& parameters) { bool match_login = false; bool match_pass = false; bool match_hosts = false; - const std::string userHost = user->ident + "@" + user->host; + const std::string userHost = user->ident + "@" + user->GetRealHost(); const std::string userIP = user->ident + "@" + user->GetIPString(); ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]); @@ -48,7 +54,6 @@ CmdResult CommandOper::HandleLocal(const std::vector& parameters, L if (match_pass && match_hosts) { - /* found this oper's opertype */ user->Oper(ifo); return CMD_SUCCESS; } @@ -60,13 +65,13 @@ CmdResult CommandOper::HandleLocal(const std::vector& parameters, L if (!match_pass) fields.append("password "); if (!match_hosts) - fields.append("hosts"); + fields.append("hosts "); + fields.erase(fields.length() - 1, 1); - // tell them they suck, and lag them up to help prevent brute-force attacks - user->WriteNumeric(ERR_NOOPERHOST, ":Invalid oper credentials"); + // Tell them they failed (generically) and lag them up to help prevent brute-force attacks + user->WriteNumeric(ERR_NOOPERHOST, "Invalid oper credentials"); user->CommandFloodPenalty += 10000; ServerInstance->SNO->WriteGlobalSno('o', "WARNING! Failed oper attempt by %s using login '%s': The following fields do not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); - ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "OPER: Failed oper attempt by %s using login '%s': The following fields did not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); return CMD_FAILURE; }