diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-03 08:30:37 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-03 08:30:37 +0000 |
commit | 4c19dfeed86fa4f42ab062ded09a9bfa42a2e3eb (patch) | |
tree | 28b5b685701fb1b33486b474d8d25eb41dd134bb /src/modules | |
parent | 2abef9282f22092a5421c66cb4d30507eb91119b (diff) |
Revert special's sqloper change, nice try but only half a biscuit.
With the old fix, it would echo out all the oper failure notices first then try again, annoying all the opers.
The new version uses a CommandParser method i added, to again use OnPreCommand, halt the /oper command, but after doing the sql lookup call the original handler of the OPER command with the original user and pass, so the original handler handles the definitive failure message.
DAMNIT STOP COMMITTING
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5636 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 0771ab30a..8def1e8d3 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -69,7 +69,19 @@ public: { if ((result == CMD_FAILURE) && (command == "OPER")) { +<<<<<<< .mine + if (LookupOper(user, parameters[0], parameters[1])) + { + /* Returning true here just means the query is in progress, or on it's way to being + * in progress. Nothing about the /oper actually being successful.. + * If the oper lookup fails later, we pass the command to the original handler + * for /oper by calling its Handle method directly. + */ + return 1; + } +======= LookupOper(user, parameters[0], parameters[1]); +>>>>>>> .r5635 } } @@ -165,9 +177,7 @@ public: * "insufficient awesomeness" (invalid credentials) error */ - user->WriteServ( "491 %s :Invalid oper credentials", user->nick); - Srv->SNO->WriteToSnoMask('o',"WARNING! Failed oper attempt by %s!%s@%s!", user->nick, user->ident, user->host); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); + LoginFail(user, row["username"].d, row["password"].d); } } else @@ -178,9 +188,7 @@ public: */ ServerInstance->Log(DEBUG, "Query failed: %s", res->error.Str()); - user->WriteServ( "491 %s :Invalid oper credentials", user->nick); - Srv->SNO->WriteToSnoMask('o',"WARNING! Failed oper attempt by %s!%s@%s! (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); - ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); + LoginFail(user, row["username"].d, row["password"].d); } } else @@ -194,7 +202,22 @@ public: ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); return NULL; - } + } + + void LoginFail(userrec* user, const std::string &user, const std::string &pass) + { + command_t* oper_command = ServerInstance->Parser->GetCommand("OPER"); + + if (oper_command) + { + const char* params = { user.c_str(), pass.c_str() }; + oper_command->Handle(params, 2, user); + } + else + { + ServerInstance->Log(DEBUG, "WHAT?! Why do we have no OPER command?!"); + } + } bool OperUser(userrec* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type) { |