summaryrefslogtreecommitdiff
path: root/src/modules/m_vhost.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 16:01:33 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-18 16:01:33 +0000
commita59d08fffd3dc8a9850ce34c9928fb6382b9b37f (patch)
tree1d5debd7915dddc122feec50443f42d535cba311 /src/modules/m_vhost.cpp
parentda6e45397e4ee86d6caf86d2fd5fd8f77af48a1e (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.cpp21
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> &parameters, 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;
}
};