From 13c91911b3df8857a59faade63dce0f07e598448 Mon Sep 17 00:00:00 2001 From: Duarte Duarte Date: Sun, 29 Sep 2019 01:41:14 +0200 Subject: [PATCH] Tools/ConnectionPatcher: Fix a typo when checking if moduleName dir exists --- src/tools/connection_patcher/Program.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/tools/connection_patcher/Program.cpp b/src/tools/connection_patcher/Program.cpp index 1ea5194a2f6..4d3b21a7e6a 100644 --- a/src/tools/connection_patcher/Program.cpp +++ b/src/tools/connection_patcher/Program.cpp @@ -43,20 +43,27 @@ namespace Connection_Patcher template void PatchModule(boost::filesystem::path file, boost::filesystem::path path) { + namespace fs = boost::filesystem; + std::cout << "Patching module...\n"; Patcher patcher(file); + std::cout << "patching Password\n"; + // if (Authentication::ServerSignature::ClientValidateProof(x)) to if (true) patcher.Patch(PATCH::Password(), PATTERN::Password()); std::string const moduleName(Helper::GetFileChecksum(patcher.binary) + ".auth"); - boost::filesystem::path const modulePath + fs::path const modulePath (path / std::string(&moduleName[0], 2) / std::string(&moduleName[2], 2)); - if (!boost::filesystem::exists(modulePath)) - boost::filesystem::create_directories(modulePath); + if (!fs::exists(modulePath)) + fs::create_directories(modulePath); + if (fs::exists(modulePath / moduleName)) + fs::permissions(modulePath / moduleName, fs::add_perms | fs::others_write | fs::group_write | fs::owner_write); patcher.Finish(modulePath / moduleName); + fs::permissions(modulePath / moduleName, fs::remove_perms | fs::others_write | fs::group_write | fs::owner_write); std::cout << "Patching module finished.\n"; }