escape password entry request

This commit is contained in:
BobTheBob 2021-12-29 17:46:17 +00:00
parent dce1bfc744
commit 6ba46a717f
1 changed files with 8 additions and 1 deletions

View File

@ -536,12 +536,19 @@ void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, c
CURL* curl = curl_easy_init();
std::string readBuffer;
curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/auth_with_server?id={}&playerToken={}&server={}&password={}", Cvar_ns_masterserver_hostname->m_pszString, uidStr, tokenStr, serverIdStr, passwordStr).c_str());
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
{
char* escapedPassword = curl_easy_escape(curl, passwordStr.c_str(), passwordStr.length());
curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/auth_with_server?id={}&playerToken={}&server={}&password={}", Cvar_ns_masterserver_hostname->m_pszString, uidStr, tokenStr, serverIdStr, escapedPassword).c_str());
curl_free(escapedPassword);
}
CURLcode result = curl_easy_perform(curl);
if (result == CURLcode::CURLE_OK)