diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
commit | a59d08fffd3dc8a9850ce34c9928fb6382b9b37f (patch) | |
tree | 1d5debd7915dddc122feec50443f42d535cba311 /src/modules/m_vhost.cpp | |
parent | da6e45397e4ee86d6caf86d2fd5fd8f77af48a1e (diff) |
Remove VF_SERVICEPROVIDER, prevent heap allocation of ConfigReader
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11904 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_vhost.cpp')
-rw-r--r-- | src/modules/m_vhost.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index a8f7b98e6..18c2a1eb0 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -27,29 +27,28 @@ class CommandVhost : public Command CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { - ConfigReader *Conf = new ConfigReader; - - for (int index = 0; index < Conf->Enumerate("vhost"); index++) + for (int index = 0;; index++) { - std::string mask = Conf->ReadValue("vhost","host",index); - std::string username = Conf->ReadValue("vhost","user",index); - std::string pass = Conf->ReadValue("vhost","pass",index); - std::string hash = Conf->ReadValue("vhost","hash",index); + ConfigTag* tag = ServerInstance->Config->ConfValue("vhost", index); + if (!tag) + break; + std::string mask = tag->getString("host"); + std::string username = tag->getString("user"); + std::string pass = tag->getString("pass"); + std::string hash = tag->getString("hash"); - if ((!strcmp(parameters[0].c_str(),username.c_str())) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str())) + if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash)) { if (!mask.empty()) { - user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask); + user->WriteServ("NOTICE "+user->nick+" :Setting your VHost: " + mask); user->ChangeDisplayedHost(mask.c_str()); - delete Conf; return CMD_SUCCESS; } } } user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password."); - delete Conf; return CMD_FAILURE; } }; |