Commit ade5ad44 authored by Nicolas Michon's avatar Nicolas Michon

Add comment for new urlUnescape method and use this method in authdb-soci

parent eb1d81ad
......@@ -173,15 +173,7 @@ void SociAuthDB::getPasswordWithPool(const std::string &id, const std::string &d
SLOGD << "[SOCI] Pool acquired in " << DURATION_MS(start, stop) << "ms";
start = stop;
// WARNING: it is necessary to create a temporary string here because use() function creates
// and returns an object that stores a reference on it. So, it must absolutely be destroyed
// at the end of this function.
char *unescapedId = new char[id.size() + 1];
memset(unescapedId, '\0', id.size() + 1);
url_unescape(unescapedId, id.c_str());
string unescapedIdStr(unescapedId);
delete[] unescapedId;
string unescapedIdStr = urlUnescape(id);
rowset<row> results = (sql->prepare << get_password_request, use(unescapedIdStr, "id"), use(domain, "domain"), use(authid, "authid"));
......
......@@ -89,7 +89,8 @@ void AuthDbBackend::declareConfig(GenericStruct *mc) {
#endif
}
//
//c++ style wrapper around sofia-sip 'url_unescape'
//Avoids creating a temporary buffer for the unescaped string
string AuthDbBackend::urlUnescape(const std::string &str) {
string unescapedStr;
char *unescaped = new char[str.size() + 1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment