forked from teamnwah/openmw-tes3coop
[General] Check integrity of credits only on Windows clients
This avoids the problems that were encountered in Linux and macOS builds regarding this check while also still addressing the scenario where official Windows builds had their credits modified by people unrelated to the project.
This commit is contained in:
parent
a0ad0b29bc
commit
f3b8a5b909
2 changed files with 5 additions and 23 deletions
|
@ -202,26 +202,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION);
|
Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION);
|
||||||
|
|
||||||
// Check for unmodified tes3mp-credits file; this makes it so people can't repackage official releases with
|
|
||||||
// their own made-up credits, though it obviously has no bearing on unofficial releases that change
|
|
||||||
// the checksum below
|
|
||||||
boost::filesystem::path folderPath(boost::filesystem::initial_path<boost::filesystem::path>());
|
|
||||||
folderPath = boost::filesystem::system_complete(boost::filesystem::path(argv[0])).remove_filename();
|
|
||||||
std::string creditsPath = folderPath.string() + "/tes3mp-credits";
|
|
||||||
|
|
||||||
unsigned int expectedChecksumInt = Utils::hexStrToInt(TES3MP_CREDITS_CHECKSUM);
|
|
||||||
bool hasValidCredits = Utils::doesFileHaveChecksum(creditsPath + ".md", expectedChecksumInt);
|
|
||||||
|
|
||||||
if (!hasValidCredits)
|
|
||||||
hasValidCredits = Utils::doesFileHaveChecksum(creditsPath + ".txt", expectedChecksumInt);
|
|
||||||
|
|
||||||
if (!hasValidCredits)
|
|
||||||
{
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_FATAL, "The server is shutting down");
|
|
||||||
LOG_APPEND(Log::LOG_FATAL, "- %s", TES3MP_CREDITS_ERROR);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Script::SetModDir(dataDirectory);
|
Script::SetModDir(dataDirectory);
|
||||||
|
|
||||||
#ifdef ENABLE_LUA
|
#ifdef ENABLE_LUA
|
||||||
|
|
|
@ -221,10 +221,11 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
Check for unmodified tes3mp-credits file; this makes it so people can't repackage official releases with
|
Check for unmodified tes3mp-credits file on Windows; this makes it so people can't repackage official
|
||||||
their own made-up credits, though it obviously has no bearing on unofficial releases that change
|
releases with their own made-up credits, though it obviously has no bearing on unofficial releases that
|
||||||
the checksum below
|
change the checksum below
|
||||||
*/
|
*/
|
||||||
|
#ifdef _WIN32
|
||||||
boost::filesystem::path folderPath(boost::filesystem::initial_path<boost::filesystem::path>());
|
boost::filesystem::path folderPath(boost::filesystem::initial_path<boost::filesystem::path>());
|
||||||
folderPath = boost::filesystem::system_complete(boost::filesystem::path(argv[0])).remove_filename();
|
folderPath = boost::filesystem::system_complete(boost::filesystem::path(argv[0])).remove_filename();
|
||||||
std::string creditsPath = folderPath.string() + "/tes3mp-credits";
|
std::string creditsPath = folderPath.string() + "/tes3mp-credits";
|
||||||
|
@ -242,6 +243,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", TES3MP_CREDITS_ERROR, 0);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", TES3MP_CREDITS_ERROR, 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue