From 486aa83680a2d359025613be44cabe871e6b44e3 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 2 Nov 2022 21:00:24 +0100 Subject: [PATCH 1/2] added parameter to supply user defined tor executable path --- .../src/retroshare-friendserver.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/retroshare-friendserver/src/retroshare-friendserver.cc b/retroshare-friendserver/src/retroshare-friendserver.cc index d80ad71d6..36b4dd2c2 100644 --- a/retroshare-friendserver/src/retroshare-friendserver.cc +++ b/retroshare-friendserver/src/retroshare-friendserver.cc @@ -47,17 +47,22 @@ int main(int argc, char* argv[]) //RsControl::earlyInitNotificationSystem(); std::string base_directory = "FSData"; + std::string tor_executable_path ; argstream as(argc,argv); as >> parameter( 'c',"base-dir", base_directory, "set base directory to store data files (keys, etc)", false ) - >> help( 'h', "help", "Display this Help" ); + >> parameter( 't',"tor-executable", tor_executable_path, "set absolute path for tor executable", false ) + >> help( 'h', "help", "Display this Help" ); as.defaultErrorHandling(true, true); RsConfigOptions conf; conf.main_executable_path = argv[0]; + if(!tor_executable_path.empty()) + RsTor::setTorExecutablePath(tor_executable_path); + RsInit::InitRsConfig(); RsInit::InitRetroShare(conf); @@ -68,6 +73,17 @@ int main(int argc, char* argv[]) RsErr() << "Cannot create base directory \"" << base_directory << "\". Check permissions, paths, etc." ; return 1; } + + // Check the existance of the Tor executable path + + if (!RsDirUtil::fileExists(RsTor::torExecutablePath())) + { + RsErr() << "Tor executable not found. Try supplying the full path for tor executable with the -t option."; + return 1; + } + else + RsDbg() << "Using Tor executable: \"" << RsTor::torExecutablePath() << "\""; + // Create/start TorManager RsTor::setTorDataDirectory(RsDirUtil::makePath(base_directory,"tor")); From f7c22af9953c2d4065e8d0917b36b011c62922d8 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 2 Nov 2022 21:03:20 +0100 Subject: [PATCH 2/2] improved debug output --- retroshare-friendserver/src/retroshare-friendserver.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/retroshare-friendserver/src/retroshare-friendserver.cc b/retroshare-friendserver/src/retroshare-friendserver.cc index 36b4dd2c2..6c5cba940 100644 --- a/retroshare-friendserver/src/retroshare-friendserver.cc +++ b/retroshare-friendserver/src/retroshare-friendserver.cc @@ -76,13 +76,15 @@ int main(int argc, char* argv[]) // Check the existance of the Tor executable path - if (!RsDirUtil::fileExists(RsTor::torExecutablePath())) + auto tor_path = RsTor::torExecutablePath(); + + if (!RsDirUtil::fileExists(tor_path)) { - RsErr() << "Tor executable not found. Try supplying the full path for tor executable with the -t option."; + RsErr() << "Tor executable \"" << tor_path << "\" not found. Try supplying the correct full path for a tor executable with the -t option."; return 1; } else - RsDbg() << "Using Tor executable: \"" << RsTor::torExecutablePath() << "\""; + RsDbg() << "Using Tor executable: \"" << tor_path << "\""; // Create/start TorManager