From 0040fa888e1f318e8da59e3014d0a21277c6a258 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 28 Feb 2016 12:45:31 +0100 Subject: [PATCH 1/9] Fixed: Compilation under OS X --HG-- branch : develop --- code/nel/src/misc/common.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 55b8e0d62..d902cf47b 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -919,10 +919,12 @@ bool launchProgramArray (const std::string &programName, const std::vector Date: Sun, 28 Feb 2016 16:36:46 +0100 Subject: [PATCH 2/9] Added: Scripts launched after patch --HG-- branch : develop --- code/ryzom/client/macosx/upgd_nl.sh | 38 +++++++++++++++++++++++++++++ code/ryzom/client/unix/upgd_nl.sh | 15 ++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 code/ryzom/client/macosx/upgd_nl.sh create mode 100644 code/ryzom/client/unix/upgd_nl.sh diff --git a/code/ryzom/client/macosx/upgd_nl.sh b/code/ryzom/client/macosx/upgd_nl.sh new file mode 100644 index 000000000..046034027 --- /dev/null +++ b/code/ryzom/client/macosx/upgd_nl.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +if [ -z "$ROOTPATH" ] +then + echo "upgd_nl.sh can only be launched from updt_nl.sh" + exit 1 +fi + +# determine directory where all files reside +CONTENTSPATH=$(dirname $ROOTPATH) +MACOSPATH=$(dirname $RYZOM_CLIENT) +SIGNPATH=$CONTENTSPATH/_CodeSignature + +# all files of original Bundle are in the same directory +# we have to copy them to the right location + +# client_default.cfg and ryzom.icns are already in the right location + +# PkgInfo usually doesn't change so don't copy it + +# Info.plist contains updated version +cp -p $ROOTPATH/Info.plist $CONTENTSPATH + +cp -p $ROOTPATH/CodeResources $SIGNPATH + +# executable flag for all executables +chmod +x $ROOTPATH/Ryzom +chmod +x $ROOTPATH/CrashReport +chmod +x $ROOTPATH/RyzomClientPatcher +chmod +x $ROOTPATH/RyzomConfiguration + +# copy all binaries in MacOS directory +cp -p $ROOTPATH/Ryzom $MACOSPATH +cp -p $ROOTPATH/CrashReport $MACOSPATH +cp -p $ROOTPATH/RyzomClientPatcher $MACOSPATH +cp -p $ROOTPATH/RyzomConfiguration $MACOSPATH + +exit 0 diff --git a/code/ryzom/client/unix/upgd_nl.sh b/code/ryzom/client/unix/upgd_nl.sh new file mode 100644 index 000000000..a1af6867e --- /dev/null +++ b/code/ryzom/client/unix/upgd_nl.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ -z "$ROOTPATH" ] +then + echo "upgd_nl.sh can only be launched from updt_nl.sh" + exit 1 +fi + +# executable flag for all executables +chmod +x $ROOTPATH/ryzom_client +chmod +x $ROOTPATH/crash_report +chmod +x $ROOTPATH/ryzom_client_patcher +chmod +x $ROOTPATH/ryzom_configuration + +exit 0 From eac2cec7839712dc0cb5f5b67c09f0c49cea02fe Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 28 Feb 2016 16:38:12 +0100 Subject: [PATCH 3/9] Fixed: Wrong check for OS X --HG-- branch : develop --- code/ryzom/client/src/login_patch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 8208d6e28..bd806e8bf 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -171,7 +171,7 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st ForceRemovePatchCategories.push_back("main_exedll_linux32"); ForceRemovePatchCategories.push_back("main_exedll_linux64"); ForceRemovePatchCategories.push_back("main_exedll_osx"); -#elif defined(NL_OS_APPLE) +#elif defined(NL_OS_MAC) ForceRemovePatchCategories.push_back("main_exedll_win32"); ForceRemovePatchCategories.push_back("main_exedll_win64"); ForceRemovePatchCategories.push_back("main_exedll_linux32"); From 3ddefec294eec1d9df4893d2b18929df0f37df1c Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 28 Feb 2016 16:41:53 +0100 Subject: [PATCH 4/9] Changed: Delete updt_nl.bat/sh only when patch enabled and after determining ClientRootPath --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 18 ------------------ code/ryzom/client/src/login_patch.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 63392dd15..e4a77b3c6 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -275,20 +275,6 @@ int main(int argc, char **argv) pump (); - // Delete the .bat file because it s not useful anymore - if (NLMISC::CFile::fileExists("updt_nl.bat")) - NLMISC::CFile::deleteFile("updt_nl.bat"); - if (NLMISC::CFile::fileExists("bug_report.exe")) - NLMISC::CFile::deleteFile("bug_report.exe"); - if (NLMISC::CFile::fileExists("bug_report_r.exe")) - NLMISC::CFile::deleteFile("bug_report_r.exe"); - if (NLMISC::CFile::fileExists("bug_report_rd.exe")) - NLMISC::CFile::deleteFile("bug_report_rd.exe"); - if (NLMISC::CFile::fileExists("bug_report_df.exe")) - NLMISC::CFile::deleteFile("bug_report_df.exe"); - if (NLMISC::CFile::fileExists("bug_report_d.exe")) - NLMISC::CFile::deleteFile("bug_report_d.exe"); - // Delete all the .ttf file in the /data directory { vector files; @@ -303,10 +289,6 @@ int main(int argc, char **argv) #else // TODO for Linux : splashscreen - - // Delete the .sh file because it s not useful anymore - if (NLMISC::CFile::fileExists("updt_nl.sh")) - NLMISC::CFile::deleteFile("updt_nl.sh"); #endif // initialize patch manager and set the ryzom full path, before it's used diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index bd806e8bf..20bfcbed0 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -195,6 +195,12 @@ void CPatchManager::setClientRootPath(const std::string& clientRootPath) ClientRootPath = CPath::standardizePath(clientRootPath); ClientPatchPath = CPath::standardizePath(ClientRootPath + "unpack"); + // Delete the .sh file because it's not useful anymore + std::string fullUpdateBatchFilename = ClientRootPath + UpdateBatchFilename; + + if (NLMISC::CFile::fileExists(fullUpdateBatchFilename)) + NLMISC::CFile::deleteFile(fullUpdateBatchFilename); + WritableClientDataPath = CPath::standardizePath(ClientRootPath + "data"); #ifdef NL_OS_MAC From d39911345eaaef579840538616c68f78af90a8ed Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 28 Feb 2016 16:44:08 +0100 Subject: [PATCH 5/9] Fixed: Only use "open" if extension is app --HG-- branch : develop --- code/nel/src/misc/common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index d902cf47b..5954ac9c9 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -806,7 +806,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments, #ifdef NL_OS_MAC // special OS X case with bundles - if (toLower(programName).find(".app") != std::string::npos) + if (toLower(CFile::getExtension(programName)) == ".app") { // we need to open bundles with "open" command std::string command = NLMISC::toString("open \"%s\"", programName.c_str()); @@ -914,7 +914,7 @@ bool launchProgramArray (const std::string &programName, const std::vector Date: Mon, 29 Feb 2016 09:32:27 +0100 Subject: [PATCH 6/9] Fixed: Escape paths with quotes under OS X --HG-- branch : develop --- code/ryzom/client/macosx/upgd_nl.sh | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/code/ryzom/client/macosx/upgd_nl.sh b/code/ryzom/client/macosx/upgd_nl.sh index 046034027..c0da04a5a 100644 --- a/code/ryzom/client/macosx/upgd_nl.sh +++ b/code/ryzom/client/macosx/upgd_nl.sh @@ -7,8 +7,8 @@ then fi # determine directory where all files reside -CONTENTSPATH=$(dirname $ROOTPATH) -MACOSPATH=$(dirname $RYZOM_CLIENT) +CONTENTSPATH=$(dirname "$ROOTPATH") +MACOSPATH=$(dirname "$RYZOM_CLIENT") SIGNPATH=$CONTENTSPATH/_CodeSignature # all files of original Bundle are in the same directory @@ -19,20 +19,26 @@ SIGNPATH=$CONTENTSPATH/_CodeSignature # PkgInfo usually doesn't change so don't copy it # Info.plist contains updated version -cp -p $ROOTPATH/Info.plist $CONTENTSPATH +cp -p "$ROOTPATH/Info.plist" "$CONTENTSPATH" -cp -p $ROOTPATH/CodeResources $SIGNPATH +cp -p "$ROOTPATH/CodeResources" "$SIGNPATH" # executable flag for all executables -chmod +x $ROOTPATH/Ryzom -chmod +x $ROOTPATH/CrashReport -chmod +x $ROOTPATH/RyzomClientPatcher -chmod +x $ROOTPATH/RyzomConfiguration +chmod +x "$ROOTPATH/Ryzom" +chmod +x "$ROOTPATH/CrashReport" +chmod +x "$ROOTPATH/RyzomClientPatcher" +chmod +x "$ROOTPATH/RyzomConfiguration" + +# remove previous executables +rm -f "$MACOSPATH/Ryzom" +rm -f "$MACOSPATH/CrashReport" +rm -f "$MACOSPATH/RyzomClientPatcher" +rm -f "$MACOSPATH/RyzomConfiguration" # copy all binaries in MacOS directory -cp -p $ROOTPATH/Ryzom $MACOSPATH -cp -p $ROOTPATH/CrashReport $MACOSPATH -cp -p $ROOTPATH/RyzomClientPatcher $MACOSPATH -cp -p $ROOTPATH/RyzomConfiguration $MACOSPATH +cp -p "$ROOTPATH/Ryzom" "$MACOSPATH" +cp -p "$ROOTPATH/CrashReport" "$MACOSPATH" +cp -p "$ROOTPATH/RyzomClientPatcher" "$MACOSPATH" +cp -p "$ROOTPATH/RyzomConfiguration" "$MACOSPATH" exit 0 From 4519893d7856d38e49832cc91737164fac058865 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 1 Mar 2016 13:45:45 +0100 Subject: [PATCH 7/9] Fixed: Loading PEM file --HG-- branch : develop --- code/ryzom/client/src/http_client_curl.cpp | 60 ++++++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index ecbfd065b..0c433a598 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -61,21 +61,31 @@ bool CCurlHttpClient::authenticate(const std::string &user, const std::string &p const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA" +// *************************************************************************** static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) { + // look for certificate in search paths string path = CPath::lookup(CAFilename); nldebug("Cert path '%s'", path.c_str()); + if (path.empty()) + { + nlwarning("Unable to find %s", CAFilename); + return CURLE_SSL_CACERT; + } + CIFile file; - if (!file.open(CAFilename)) + // open certificate + if (!file.open(path)) { - nlwarning("Unable to open %s", CAFilename); + nlwarning("Unable to open %s", path.c_str()); return CURLE_SSL_CACERT; } CURLcode res = CURLE_OK; + // load certificate content into memory std::vector buffer(file.getFileSize()); file.serialBuffer(&buffer[0], file.getFileSize()); @@ -84,25 +94,33 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) if (bio) { + // get a pointer to the X509 certificate store (which may be empty!) + X509_STORE *store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); + // use it to read the PEM formatted certificate from memory into an X509 // structure that SSL can use - X509 *cert = NULL; - PEM_read_bio_X509(bio, &cert, 0, NULL); + STACK_OF(X509_INFO) *info = PEM_X509_INFO_read_bio(bio, NULL, NULL, NULL); - if (cert) + if (info) { - // get a pointer to the X509 certificate store (which may be empty!) - X509_STORE *store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); - - // add our certificate to this store - if (X509_STORE_add_cert(store, cert) == 0) + // iterate over all entries from the PEM file, add them to the x509_store one by one + for (sint i = 0; i < sk_X509_INFO_num(info); ++i) { - nlwarning("Error adding certificate"); - res = CURLE_SSL_CACERT; + X509_INFO *itmp = sk_X509_INFO_value(info, i); + + if (itmp->x509) + { + // add our certificate to this store + if (X509_STORE_add_cert(store, itmp->x509) == 0) + { + nlwarning("Error adding certificate"); + res = CURLE_SSL_CACERT; + } + } } - // decrease reference counts - X509_free(cert); + // cleanup + sk_X509_INFO_pop_free(info, X509_INFO_free); } else { @@ -113,9 +131,14 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm) // decrease reference counts BIO_free(bio); } + else + { + nlwarning("Unable to allocate BIO buffer for certificates"); + res = CURLE_SSL_CACERT; + } // all set to go - return CURLE_OK ; + return res; } // *************************************************************************** @@ -125,7 +148,10 @@ bool CCurlHttpClient::verifyServer(bool verify) curl_easy_setopt(_Curl, CURLOPT_SSL_VERIFYPEER, verify ? 1 : 0); curl_easy_setopt(_Curl, CURLOPT_SSLCERTTYPE, "PEM"); // would allow to provide the CA in memory instead of using CURLOPT_CAINFO, but needs to include and link OpenSSL - curl_easy_setopt(_Curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); + if (curl_easy_setopt(_Curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function) == CURLE_NOT_BUILT_IN) + { + nlwarning("Unable to support CURLOPT_SSL_CTX_FUNCTION, curl not compiled with OpenSSL ?"); + } // don't use that anymore, because CA can't be loaded from BNP and doesn't support UTF-8 under Windows // curl_easy_setopt(_Curl, CURLOPT_CAINFO, path.c_str()); curl_easy_setopt(_Curl, CURLOPT_CAPATH, NULL); @@ -181,7 +207,7 @@ bool CCurlHttpClient::sendRequest(const std::string& methodWB, const std::string curl_easy_getinfo(_Curl, CURLINFO_RESPONSE_CODE, &r); if (verbose) { - nldebug("%u", r); + nldebug("%u", (uint)r); } return true; From c182708cd002ed046fe1980e5635cf66af8309a2 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 1 Mar 2016 13:46:04 +0100 Subject: [PATCH 8/9] Changed: Escape Linux upgrade script as well --HG-- branch : develop --- code/ryzom/client/unix/upgd_nl.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/unix/upgd_nl.sh b/code/ryzom/client/unix/upgd_nl.sh index a1af6867e..6c44db85b 100644 --- a/code/ryzom/client/unix/upgd_nl.sh +++ b/code/ryzom/client/unix/upgd_nl.sh @@ -7,9 +7,9 @@ then fi # executable flag for all executables -chmod +x $ROOTPATH/ryzom_client -chmod +x $ROOTPATH/crash_report -chmod +x $ROOTPATH/ryzom_client_patcher -chmod +x $ROOTPATH/ryzom_configuration +chmod +x "$ROOTPATH/ryzom_client" +chmod +x "$ROOTPATH/crash_report" +chmod +x "$ROOTPATH/ryzom_client_patcher" +chmod +x "$ROOTPATH/ryzom_configuration" exit 0 From 81408bbc5ac6b4d2a2363d1e6f0361ba054ad2a9 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 1 Mar 2016 14:01:47 +0100 Subject: [PATCH 9/9] Fixed: Missing translation for bytes in patcher --HG-- branch : develop --- code/ryzom/tools/client/client_patcher/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index 7575e8fe8..f03943345 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -137,6 +137,7 @@ struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy "TheSagaOfRyzom [Ryzom]\n" "uiErrPatchApply [Error: Patch process ended but the patch has not been successfully applied.]\n" "uiErrChecking [Error: Patch files failed - checking.]\n" + "uiByte [B]\n" "uiKb [KiB]\n" "uiMb [MiB]\n" "uiLoginGetFile [Getting File:]\n"