From 9baff55ced3729c6b7a1415b951ef146d576e94f Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 30 Nov 2019 16:11:25 +0100 Subject: [PATCH 1/9] update the msys2 win install guide for rapidjson package --- build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md | 1 + 1 file changed, 1 insertion(+) diff --git a/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md b/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md index c9ce0edd7..5d939d2de 100644 --- a/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md +++ b/build_scripts/Windows-msys2/WindowsMSys2_InstallGuide.md @@ -47,6 +47,7 @@ Install all needed dependencies: pacman -S mingw-w64-i686-sqlcipher pacman -S mingw-w64-i686-qt5 pacman -S mingw32/mingw-w64-i686-cmake + pacman -S mingw-w64-i686-rapidjson We're done installing MSYS2, close the shell terminal. From 694e05d4b9ab8069eb15df9ef6cdd0b2b33982fb Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 30 Nov 2019 22:12:32 +0000 Subject: [PATCH 2/9] fixed compilation --- retroshare-service/src/retroshare-service.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 7242b08e4..71abaa81a 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -310,11 +310,11 @@ int main(int argc, char* argv[]) #endif // def RS_SERVICE_TERMINAL_LOGIN #if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) - if(rsJsonAPI && !webui_pass1.empty()) + if(rsJsonApi && !webui_pass1.empty()) { - rsWebUI->setHtmlFilesDirectory(webui_base_directory); - rsWebUI->setUserPassword(webui_pass1); - rsWebUI->restart(); + rsWebUi->setHtmlFilesDirectory(webui_base_directory); + rsWebUi->setUserPassword(webui_pass1); + rsWebUi->restart(); } #endif From 2340c8ff20fda7dc1d1952ed42c960f8cca4b256 Mon Sep 17 00:00:00 2001 From: felisucoibi Date: Sun, 1 Dec 2019 12:28:07 +0100 Subject: [PATCH 3/9] Update misc.cpp --- retroshare-gui/src/util/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/util/misc.cpp b/retroshare-gui/src/util/misc.cpp index adb422a4c..45b9ef41a 100644 --- a/retroshare-gui/src/util/misc.cpp +++ b/retroshare-gui/src/util/misc.cpp @@ -38,7 +38,7 @@ QString misc::friendlyUnit(float val) if(val < 0) { return tr("Unknown", "Unknown (size)"); } - const QString units[5] = {tr(" B", "bytes"), tr(" KB", "kilobytes (1024 bytes)"), tr(" MB", "megabytes (1024 kilobytes)"), tr(" GB", "gigabytes (1024 megabytes)"), tr(" TB", "terabytes (1024 gigabytes)") }; + const QString units[6] = {tr(" B", "bytes"), tr(" KB", "kilobytes (1024 bytes)"), tr(" MB", "megabytes (1024 kilobytes)"), tr(" GB", "gigabytes (1024 megabytes)"), tr(" TB", "terabytes (1024 gigabytes)"), tr(" PB", "petabytes (1024 terabytes)") }; for(unsigned int i=0; i<5; ++i) { if (val < 1024.) { return QString(QByteArray::number(val, 'f', 1)) + units[i]; From ff9c7774f27978d91e626926ae90d0fb85230a0f Mon Sep 17 00:00:00 2001 From: felisucoibi Date: Sun, 1 Dec 2019 12:28:52 +0100 Subject: [PATCH 4/9] Update hash_cache.cc --- libretroshare/src/file_sharing/hash_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index 340391f03..cdc675c10 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -69,7 +69,7 @@ bool HashStorage::hashingProcessPaused() static std::string friendlyUnit(uint64_t val) { - const std::string units[5] = {"B","KB","MB","GB","TB"}; + const std::string units[6] = {"B","KB","MB","GB","TB","PB"}; char buf[50] ; double fact = 1.0 ; From f5d32a8a9c8a1ed22efb0d3fcc90dd117e139967 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 1 Dec 2019 16:59:17 +0100 Subject: [PATCH 5/9] fixed compilation due to get_version not found in restbed --- retroshare-gui/src/gui/AboutWidget.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/AboutWidget.cpp b/retroshare-gui/src/gui/AboutWidget.cpp index c2b07a6fe..20acafb8b 100644 --- a/retroshare-gui/src/gui/AboutWidget.cpp +++ b/retroshare-gui/src/gui/AboutWidget.cpp @@ -973,11 +973,12 @@ void AboutWidget::on_copy_button_clicked() verInfo+=addLibraries("libretroshare", libraries); #ifdef RS_JSONAPI - /* Add version numbers of RetroShare */ - // Add versions here. Find a better place. - libraries.clear(); - libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version())); - verInfo+=addLibraries("RetroShare", libraries); +// Disabled because I could not find how to get restbed version number +// /* Add version numbers of RetroShare */ +// // Add versions here. Find a better place. +// libraries.clear(); +// libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version())); +// verInfo+=addLibraries("RetroShare", libraries); #endif /* Add version numbers of plugins */ From c9aab51c7ce1d35ddff0d12b5db050230859b62f Mon Sep 17 00:00:00 2001 From: felisucoibi Date: Sun, 1 Dec 2019 23:01:20 +0100 Subject: [PATCH 6/9] Update hash_cache.cc --- libretroshare/src/file_sharing/hash_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/file_sharing/hash_cache.cc b/libretroshare/src/file_sharing/hash_cache.cc index cdc675c10..22955ae9d 100644 --- a/libretroshare/src/file_sharing/hash_cache.cc +++ b/libretroshare/src/file_sharing/hash_cache.cc @@ -74,7 +74,7 @@ static std::string friendlyUnit(uint64_t val) double fact = 1.0 ; - for(unsigned int i=0; i<5; ++i) + for(unsigned int i=0; i<6; ++i) if(double(val)/fact < 1024.0) { sprintf(buf,"%2.2f",double(val)/fact) ; From b709e68c72e5ff4abfdc43767924d8b922b2ba03 Mon Sep 17 00:00:00 2001 From: felisucoibi Date: Mon, 2 Dec 2019 11:00:35 +0100 Subject: [PATCH 7/9] Update misc.cpp --- retroshare-gui/src/util/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/util/misc.cpp b/retroshare-gui/src/util/misc.cpp index 45b9ef41a..a66de053c 100644 --- a/retroshare-gui/src/util/misc.cpp +++ b/retroshare-gui/src/util/misc.cpp @@ -39,7 +39,7 @@ QString misc::friendlyUnit(float val) return tr("Unknown", "Unknown (size)"); } const QString units[6] = {tr(" B", "bytes"), tr(" KB", "kilobytes (1024 bytes)"), tr(" MB", "megabytes (1024 kilobytes)"), tr(" GB", "gigabytes (1024 megabytes)"), tr(" TB", "terabytes (1024 gigabytes)"), tr(" PB", "petabytes (1024 terabytes)") }; - for(unsigned int i=0; i<5; ++i) { + for(unsigned int i=0; i<6; ++i) { if (val < 1024.) { return QString(QByteArray::number(val, 'f', 1)) + units[i]; } From 60ed77461a33e753d2162fe4e040206f1b8abc1a Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 2 Dec 2019 13:14:18 +0000 Subject: [PATCH 8/9] removed duplicate call to StartupRetroshare --- retroshare-service/src/retroshare-service.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 71abaa81a..a57fef2da 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -303,9 +303,6 @@ int main(int argc, char* argv[]) << std::endl; return -result; } - - /* Start-up libretroshare server threads */ - RsControl::instance()->StartupRetroShare(); } #endif // def RS_SERVICE_TERMINAL_LOGIN From b799f18df88ab9ec61d586e6482deb1ae525f737 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 2 Dec 2019 13:14:56 +0000 Subject: [PATCH 9/9] fixed early crash caused by calling rsBanList before it is initialized --- libretroshare/src/dht/p3bitdht.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libretroshare/src/dht/p3bitdht.cc b/libretroshare/src/dht/p3bitdht.cc index f6ed68b68..e08a64ae6 100644 --- a/libretroshare/src/dht/p3bitdht.cc +++ b/libretroshare/src/dht/p3bitdht.cc @@ -79,6 +79,12 @@ virtual int dhtInfoCallback(const bdId *id, uint32_t type, uint32_t flags, std:: virtual int dhtIsBannedCallback(const sockaddr_in *addr, bool *isBanned) { + if(!rsBanList) + { + *isBanned = true; // rsBanList is not enabled yet. For security, default to banned. + return 0; + } + // check whether ip filtering is enabled // if not return 0 to signal that no filter is available if(!rsBanList->ipFilteringEnabled())