summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_sqlauth.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-23 13:40:24 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-23 13:40:24 +0000
commit0b44d28a3143c7f6925a5d3956d9e982974a46de (patch)
tree681fcdcdd910e5e0e3f85c73266575cf53d5ab09 /src/modules/extra/m_sqlauth.cpp
parenta3fb932831ca09b2a931616f1701ea39429356c2 (diff)
Templateise this
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10991 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_sqlauth.cpp')
-rw-r--r--src/modules/extra/m_sqlauth.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index f03ec08db..4d0cc6a76 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -89,26 +89,28 @@ public:
{
std::string thisquery = freeformquery;
std::string safepass = user->password;
+ std::string safegecos = user->fullname;
/* Search and replace the escaped nick and escaped pass into the query */
- SearchAndReplace(safepass, "\"", "");
+ SearchAndReplace(safepass, std::string("\""), std::string("\\\""));
+ SearchAndReplace(safegecos, std::string("\""), std::string("\\\""));
- SearchAndReplace(thisquery, "$nick", user->nick);
- SearchAndReplace(thisquery, "$pass", safepass);
- SearchAndReplace(thisquery, "$host", user->host);
- SearchAndReplace(thisquery, "$ip", user->GetIPString());
- SearchAndReplace(thisquery, "$gecos", user->fullname);
- SearchAndReplace(thisquery, "$ident", user->ident);
- SearchAndReplace(thisquery, "$server", user->server);
- SearchAndReplace(thisquery, "$uuid", user->uuid);
+ SearchAndReplace(thisquery, std::string("$nick"), user->nick);
+ SearchAndReplace(thisquery, std::string("$pass"), safepass);
+ SearchAndReplace(thisquery, std::string("$host"), user->host);
+ SearchAndReplace(thisquery, std::string("$ip"), std::string(user->GetIPString()));
+ SearchAndReplace(thisquery, std::string("$gecos"), safegecos);
+ SearchAndReplace(thisquery, std::string("$ident"), user->ident);
+ SearchAndReplace(thisquery, std::string("$server"), std::string(user->server));
+ SearchAndReplace(thisquery, std::string("$uuid"), user->uuid);
Module* HashMod = ServerInstance->Modules->Find("m_md5.so");
if (HashMod)
{
HashResetRequest(this, HashMod).Send();
- SearchAndReplace(thisquery, "$md5pass", HashSumRequest(this, HashMod, user->password).Send());
+ SearchAndReplace(thisquery, std::string("$md5pass"), std::string(HashSumRequest(this, HashMod, user->password).Send()));
}
HashMod = ServerInstance->Modules->Find("m_sha256.so");
@@ -116,7 +118,7 @@ public:
if (HashMod)
{
HashResetRequest(this, HashMod).Send();
- SearchAndReplace(thisquery, "$sha256pass", HashSumRequest(this, HashMod, user->password).Send());
+ SearchAndReplace(thisquery, std::string("$sha256pass"), std::string(HashSumRequest(this, HashMod, user->password).Send()));
}
/* Build the query */