Revert "Update config to use the new online servers. Remove hardcoded certificate as we will use Let's encrypt from now on (#3690)"

This reverts commit ed225a21f2.
This commit is contained in:
auria.mg 2019-01-07 20:00:38 -05:00
parent ed225a21f2
commit 355aaaa658
8 changed files with 79 additions and 79 deletions

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDezCCAmOgAwIBAgIJAO+A8uXtEMRsMA0GCSqGSIb3DQEBCwUAMFQxCzAJBgNV
BAYTAlVTMQwwCgYDVQQIDANTVEsxFTATBgNVBAoMDFN1cGVyVHV4S2FydDEgMB4G
A1UEAwwXYWRkb25zLnN1cGVydHV4a2FydC5uZXQwHhcNMTQxMjEwMTEzMTAwWhcN
MjQxMjA3MTEzMTAwWjBUMQswCQYDVQQGEwJVUzEMMAoGA1UECAwDU1RLMRUwEwYD
VQQKDAxTdXBlclR1eEthcnQxIDAeBgNVBAMMF2FkZG9ucy5zdXBlcnR1eGthcnQu
bmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ysZE9rb4y0tHOhk
wxYpqsvDv5LCRFTAeyfAfyBVDcOn+4A3sX8MkQdoH/QDi823z4bn9ZsGV8T444FN
S4yK/aSRv3eAKkkJm5TUxbs3crATVt3JYusMr5W4wHvRVyDe0DlulSdW4EUEklMP
iPat/jwlDZRvZueio3wJoOhZXnl8E8EfnuYtlNONIB1nYGdUHD9xeNyKSPr4zTEp
brjvSw0l5G88LmQOROQBDbTDknAcIQwsFT1mf9Bt+N9LK14r95GWRmL3ZtfbrJn4
ZEfkOjl0Abv6gET4sQOXv0KioUdEJwzFCwKFLZVcuOrscmcHBOhgD3EruVvprIJ0
wZ3z1wIDAQABo1AwTjAdBgNVHQ4EFgQUmQwaPsD+ylVUUsUXMAYpUlnVbNwwHwYD
VR0jBBgwFoAUmQwaPsD+ylVUUsUXMAYpUlnVbNwwDAYDVR0TBAUwAwEB/zANBgkq
hkiG9w0BAQsFAAOCAQEASyl6BMpnZhJlirDL84/RkVeVjBkr7x68UFAblmKjgfGg
pRbYPNSld0IrfZ4pcrDAUkg9WJb0Zxuh0oYiV+RjdW/6s5mF/qiSv8V60xb2myRd
z90ZGfhB5SAECI5zfIZSmsMjOEjKjuz8S26aEtJe8Vq7GF2P7/889lfNXrbvIkZX
HQpx2P+T07zy++6Ca/K2vmWcf1a+GrN+o0nZTYbz/2r/JJwXdWqT1ZmtEA9GNwvZ
J8HhgvspgjgVP/EURUUhOaQ8zfhriU5CJAIuhMhzW7oOBPHxxtxme3auAfxi5zpK
wRNluCayrrjhy2I8mABRnBqgMwAQUIrgk9IU6SyQxw==
-----END CERTIFICATE-----

View File

@ -157,7 +157,7 @@
<minimap size="180.0" ai-icon="16.0" player-icon="20.0"/>
<urls donate="https://supertuxkart.net/Donate"
password-reset="https://online.supertuxkart.net/password-reset.php" />
password-reset="http://addons.supertuxkart.net/password-reset.php" />
<!-- Skidmark data: maximum number of skid marks, and
time for skidmarks to fade out. Maximum number will over

View File

@ -152,15 +152,15 @@ public:
}
std::map<T, U>& operator=(const std::map<T,U>& v)
{
m_elements = std::map<T, U>(v);
m_elements = std::map<T, U>(v);
return m_elements;
}
std::map<T, U>& operator=(const MapUserConfigParam& v)
{
m_elements = std::map<T,U>(v);
m_elements = std::map<T,U>(v);
return m_elements;
}
U& operator[] (const T key)
U& operator[] (const T key)
{
return m_elements[key];
}
@ -443,7 +443,7 @@ namespace UserConfigParams
PARAM_PREFIX StringUserConfigParam m_last_used_kart_group
PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
"Last selected kart group") );
// ---- Wiimote data
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
@ -482,7 +482,7 @@ namespace UserConfigParams
PARAM_DEFAULT( BoolUserConfigParam(false, "multitouch_enabled",
&m_multitouch_group,
"Enable multitouch support.") );
PARAM_PREFIX IntUserConfigParam m_multitouch_mode
PARAM_DEFAULT( IntUserConfigParam(1, "multitouch_mode",
&m_multitouch_group,
@ -508,12 +508,12 @@ namespace UserConfigParams
PARAM_DEFAULT( FloatUserConfigParam(0.2f, "multitouch_sensitivity_x",
&m_multitouch_group,
"A parameter in range [0, 1.0] that determines the sensitivity for x axis."));
PARAM_PREFIX FloatUserConfigParam m_multitouch_sensitivity_y
PARAM_DEFAULT( FloatUserConfigParam(0.65f, "multitouch_sensitivity_y",
&m_multitouch_group,
"A parameter in range [0, 1.0] that determines the sensitivity for y axis."));
PARAM_PREFIX FloatUserConfigParam m_multitouch_tilt_factor
PARAM_DEFAULT( FloatUserConfigParam(4.0f, "multitouch_tilt_factor",
&m_multitouch_group,
@ -530,7 +530,7 @@ namespace UserConfigParams
&m_multitouch_group,
"Screen keyboard mode: 0 = disabled, 1 = enabled if no hardware "
"keyboard, 2 = always enabled, 3 = android keyboard (experimental)") );
PARAM_PREFIX BoolUserConfigParam m_hidpi_enabled
PARAM_DEFAULT( BoolUserConfigParam(false, "hidpi_enabled",
&m_multitouch_group,
@ -728,7 +728,7 @@ namespace UserConfigParams
PARAM_PREFIX bool m_race_now PARAM_DEFAULT( false );
PARAM_PREFIX bool m_enforce_current_player PARAM_DEFAULT( false );
PARAM_PREFIX bool m_enable_sound PARAM_DEFAULT( true );
/** True to test funky ambient/diffuse/specularity in RGB &
@ -953,9 +953,8 @@ namespace UserConfigParams
PARAM_DEFAULT( IntUserConfigParam(0, "random-identifier", &m_hw_report_group,
"A random number to avoid duplicated reports.") );
// TODO change new-stats to stats before release
PARAM_PREFIX StringUserConfigParam m_server_hw_report
PARAM_DEFAULT( StringUserConfigParam( "https://new-stats.supertuxkart.net",
PARAM_DEFAULT( StringUserConfigParam( "http://addons.supertuxkart.net:8080",
"hw-report-server",
&m_hw_report_group,
"The server used for reporting statistics to."));
@ -979,7 +978,7 @@ namespace UserConfigParams
"Everything related to online play.") );
PARAM_PREFIX StringUserConfigParam m_server_multiplayer
PARAM_DEFAULT( StringUserConfigParam( "https://online.supertuxkart.net/api/",
PARAM_DEFAULT( StringUserConfigParam( "https://addons.supertuxkart.net/api/",
"server_multiplayer",
&m_online_group,
"The server used for online multiplayer."));
@ -997,7 +996,7 @@ namespace UserConfigParams
"Addon and news related settings") );
PARAM_PREFIX StringUserConfigParam m_server_addons
PARAM_DEFAULT( StringUserConfigParam("https://online.supertuxkart.net/dl/xml",
PARAM_DEFAULT( StringUserConfigParam("http://addons.supertuxkart.net/dl/xml",
"server_addons",
&m_addon_group,
"The server used for addon."));
@ -1045,7 +1044,7 @@ namespace UserConfigParams
PARAM_DEFAULT( IntUserConfigParam(0, "unlock_everything",
"Enable all karts and tracks: 0 = disabled, "
"1 = everything except final race, 2 = everything") );
PARAM_PREFIX StringUserConfigParam m_commandline
PARAM_DEFAULT( StringUserConfigParam("", "commandline",
"Allows to set commandline args in config file") );

View File

@ -115,7 +115,7 @@ FileManager* file_manager = 0;
/** The constructor of the file manager creates an irrlicht file system and
* detects paths for the user config file and assets base directory (data).
* A second initialisation is done later once (see init()), once the user
* config file is read. This is necessary since part of discoverPaths
* config file is read. This is necessary since part of discoverPaths
* depend on artist debug mode.
*/
FileManager::FileManager()
@ -208,17 +208,17 @@ FileManager::FileManager()
{
Log::error("FileManager", "Could not file '%s'in any "
"standard location (esp. ../data).", version.c_str());
Log::error("FileManager",
Log::error("FileManager",
"Last location checked '%s'.", root_dir.c_str());
Log::fatal("FileManager",
Log::fatal("FileManager",
"Set $SUPERTUXKART_DATADIR to point to the data directory.");
// fatal will exit the application
}
addRootDirs(root_dir);
std::string assets_dir;
if (getenv("SUPERTUXKART_ASSETS_DIR") != NULL)
{
assets_dir = std::string(getenv("SUPERTUXKART_ASSETS_DIR"));
@ -236,7 +236,7 @@ FileManager::FileManager()
//is this needed?
assets_dir = std::string(getenv("SUPERTUXKART_ROOT_PATH"));
}
if (!assets_dir.empty() && assets_dir != root_dir)
{
addRootDirs(assets_dir);
@ -348,6 +348,8 @@ void FileManager::init()
for(int i=0;i<(int)dirs.size(); i++)
pushMusicSearchPath(dirs[i]);
}
m_cert_location = m_file_system->getAbsolutePath(
getAsset("addons.supertuxkart.net.pem").c_str()).c_str();
} // init
//-----------------------------------------------------------------------------
@ -823,7 +825,7 @@ bool FileManager::checkAndCreateDirectoryP(const std::string &path)
current_path += split[i] + "/";
//Log::verbose("[FileManager]", "Checking for: '%s",
// current_path.c_str());
if (!checkAndCreateDirectory(current_path))
{
Log::error("[FileManager]", "Can't create dir '%s'",
@ -935,12 +937,12 @@ void FileManager::checkAndCreateConfigDir()
"falling back to '.'.", m_user_config_dir.c_str());
m_user_config_dir = "./";
}
if (m_stdout_dir.empty())
{
m_stdout_dir = m_user_config_dir;
}
return;
} // checkAndCreateConfigDir
@ -1186,7 +1188,7 @@ void FileManager::setStdoutName(const std::string& filename)
void FileManager::setStdoutDir(const std::string& dir)
{
m_stdout_dir = dir;
if (!m_stdout_dir.empty() && m_stdout_dir[m_stdout_dir.size() - 1] != '/')
{
m_stdout_dir += "/";
@ -1390,8 +1392,8 @@ bool FileManager::removeDirectory(const std::string &name) const
for (std::string file : files)
{
if (file == "." || file == ".." || file == name + "/." ||
file == name + "/..")
if (file == "." || file == ".." || file == name + "/." ||
file == name + "/..")
continue;
if (UserConfigParams::logMisc())
@ -1415,7 +1417,7 @@ bool FileManager::removeDirectory(const std::string &name) const
removeFile(file);
}
}
#if defined(WIN32)
return RemoveDirectory(name.c_str())==TRUE;
#else
@ -1481,3 +1483,4 @@ bool FileManager::fileIsNewer(const std::string& f1, const std::string& f2) cons
stat(f2.c_str(), &stat2);
return stat1.st_mtime > stat2.st_mtime;
} // fileIsNewer

View File

@ -86,7 +86,7 @@ private:
/** Name of stdout file. */
static std::string m_stdout_filename;
/** Directory of stdout file. */
static std::string m_stdout_dir;
@ -102,6 +102,8 @@ private:
/** Directory where user-defined grand prix are stored. */
std::string m_gp_dir;
std::string m_cert_location;
std::vector<TextureSearchPath> m_texture_search_path;
std::vector<std::string>
@ -175,7 +177,7 @@ public:
std::string getUserConfigFile(const std::string& fname) const;
bool fileExists(const std::string& path) const;
// ------------------------------------------------------------------------
/** Convenience function to save some typing in the
/** Convenience function to save some typing in the
* file manager constructor. */
bool fileExists(const char *prefix, const std::string& path) const
{
@ -214,7 +216,7 @@ public:
m_music_search_path.push_back(path);
} // pushMusicSearchPath
// ------------------------------------------------------------------------
/** Returns the full path to a shader (this function could be modified
/** Returns the full path to a shader (this function could be modified
* later to allow track-specific shaders).
* \param name Name of the shader.
*/
@ -223,11 +225,12 @@ public:
return getAsset(SHADER, name);
} // getShader
std::string getShadersDir() const
{
return m_subdir_name[SHADER];
}
const std::string& getCertLocation() const { return m_cert_location; }
}; // FileManager
extern FileManager* file_manager;

View File

@ -95,10 +95,10 @@ namespace Online
m_parameters = "";
m_curl_code = CURLE_OK;
m_progress.setAtomic(0);
if (m_http_header == nullptr)
if (m_http_header == NULL)
{
std::string Host = "Host: " + StringUtils::getHostNameFromURL(UserConfigParams::m_server_multiplayer);
m_http_header = curl_slist_append(m_http_header, Host.c_str());
m_http_header = curl_slist_append(m_http_header,
"Host: addons.supertuxkart.net");
}
m_disable_sending_log = false;
} // init
@ -182,8 +182,19 @@ namespace Online
if (m_url.substr(0, 8) == "https://")
{
// https, load certificate info
assert(m_http_header != nullptr);
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER, m_http_header);
assert(m_http_header != NULL);
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER,
m_http_header);
const std::string& ci = file_manager->getCertLocation();
CURLcode error = curl_easy_setopt(m_curl_session, CURLOPT_CAINFO,
ci.c_str());
if (error != CURLE_OK)
{
Log::error("HTTPRequest", "Error setting CAINFO to '%s'",
ci.c_str());
Log::error("HTTPRequest", "Error: '%s'.", error,
curl_easy_strerror(error));
}
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 1L);
#ifdef __APPLE__
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYHOST, 0L);

View File

@ -896,46 +896,18 @@ namespace StringUtils
std::string removeWhitespaces(const std::string& input)
{
std::string out;
for (char ch : input)
{
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
continue;
out += ch;
}
return out;
}
// ------------------------------------------------------------------------
std::string getHostNameFromURL(const std::string& url)
{
// Not even a valid URL
if (url.length() < 8)
return "";
// protocol is substr(0, first_color_position)
const size_t first_colon_position = url.find_first_of(":");
if (first_colon_position == std::string::npos)
return "";
// skip ://
const std::string url_without_protocol = url.substr(first_colon_position + 3);
// Find end with port
const size_t port_colon_position = url_without_protocol.find_first_of(":");
if (port_colon_position != std::string::npos)
return url_without_protocol.substr(0, port_colon_position);
// Find end with path
const size_t slash_position = url_without_protocol.find_first_of("/");
if (slash_position != std::string::npos)
return url_without_protocol.substr(0, slash_position);
return url_without_protocol;
}
// ------------------------------------------------------------------------
/** Breaks the text so that each line is smaller than max_width with the current settings.
* The result is put into output, a vector of strings, with each line having its own string */

View File

@ -240,7 +240,7 @@ namespace StringUtils
} // parseString
// ------------------------------------------------------------------------
irr::core::stringw utf8ToWide(const char* input);
irr::core::stringw utf8ToWide(const std::string &input);
std::string wideToUtf8(const wchar_t* input);
@ -270,15 +270,6 @@ namespace StringUtils
#endif
return uagent;
}
/**
* Returns the hostname part of an url (if any)
*
* Example https://online.supertuxkart.net/
*
*/
std::string getHostNameFromURL(const std::string& url);
} // namespace StringUtils
#endif