Merge pull request #1624 from csoler/v0.6-RetroshareService

V0.6 retroshare service
This commit is contained in:
csoler 2019-09-09 10:33:18 +02:00 committed by GitHub
commit 4f4b3bfcdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 660 additions and 209 deletions

View File

@ -153,7 +153,7 @@ build_script:
# scripts to run after build # scripts to run after build
after_build: after_build:
- mkdir %RS_DEPLOY% - mkdir %RS_DEPLOY%
- copy retroshare-nogui\src\retroshare-nogui.exe %RS_DEPLOY%\ - copy retroshare-service\src\retroshare-service.exe %RS_DEPLOY%\
- copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\ - copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\
## In Debug build winedeplyqt forget the non debug Qt libs ## In Debug build winedeplyqt forget the non debug Qt libs

View File

@ -145,7 +145,8 @@ void RsControlModule::run()
#endif #endif
RsInit::InitRsConfig(); RsInit::InitRsConfig();
int initResult = RsInit::InitRetroShare(argc, argv, true); RsConfigOptions opt;
int initResult = RsInit::InitRetroShare(opt);
if (initResult < 0) { if (initResult < 0) {
std::cerr << "RsControlModule: FATAL ERROR, initialising libretroshare FAILED." << std::endl; std::cerr << "RsControlModule: FATAL ERROR, initialising libretroshare FAILED." << std::endl;

View File

@ -52,6 +52,8 @@ extern JsonApiServer* jsonApiServer;
*/ */
struct JsonApiServer : RsSingleJobThread, p3Config struct JsonApiServer : RsSingleJobThread, p3Config
{ {
static const uint16_t DEFAULT_PORT = 9092 ;
/** /**
* @brief construct a JsonApiServer instance with given parameters * @brief construct a JsonApiServer instance with given parameters
* @param[in] port listening port fpt the JSON API socket * @param[in] port listening port fpt the JSON API socket
@ -62,7 +64,7 @@ struct JsonApiServer : RsSingleJobThread, p3Config
* false otherwise, this usually requires user interacion to confirm access * false otherwise, this usually requires user interacion to confirm access
*/ */
JsonApiServer( JsonApiServer(
uint16_t port = 9092, uint16_t port = DEFAULT_PORT,
const std::string& bindAddress = "127.0.0.1", const std::string& bindAddress = "127.0.0.1",
const std::function<bool(const std::string&)> newAccessRequestCallback = [](const std::string&){return false;} ); const std::function<bool(const std::string&)> newAccessRequestCallback = [](const std::string&){return false;} );

View File

@ -480,6 +480,7 @@ HEADERS += turtle/p3turtle.h \
HEADERS += util/folderiterator.h \ HEADERS += util/folderiterator.h \
util/rsdebug.h \ util/rsdebug.h \
util/rskbdinput.h \
util/rsmemory.h \ util/rsmemory.h \
util/smallobject.h \ util/smallobject.h \
util/rsdir.h \ util/rsdir.h \
@ -626,6 +627,7 @@ SOURCES += turtle/p3turtle.cc \
SOURCES += util/folderiterator.cc \ SOURCES += util/folderiterator.cc \
util/rsdebug.cc \ util/rsdebug.cc \
util/rskbdinput.cc \
util/rsexpr.cc \ util/rsexpr.cc \
util/smallobject.cc \ util/smallobject.cc \
util/rsdir.cc \ util/rsdir.cc \

View File

@ -30,6 +30,7 @@
#define RS_INIT_AUTH_FAILED -1 // AuthGPG::InitAuth failed #define RS_INIT_AUTH_FAILED -1 // AuthGPG::InitAuth failed
#define RS_INIT_BASE_DIR_ERROR -2 // AuthGPG::InitAuth failed #define RS_INIT_BASE_DIR_ERROR -2 // AuthGPG::InitAuth failed
#define RS_INIT_NO_KEYRING -3 // Keyring is empty. Need to import it. #define RS_INIT_NO_KEYRING -3 // Keyring is empty. Need to import it.
#define RS_INIT_NO_EXECUTABLE -4 // executable path hasn't been set in config options
#include <stdint.h> #include <stdint.h>
#include <list> #include <list>
@ -45,6 +46,38 @@ struct RsLoginHelper;
*/ */
extern RsLoginHelper* rsLoginHelper; extern RsLoginHelper* rsLoginHelper;
/**
* @brief The RsInitConfig struct
* This class contains common configuration options, that executables using libretroshare may want to
* set using e.g. commandline options. To be passed to RsInit::InitRetroShare().
*/
struct RsConfigOptions
{
RsConfigOptions();
// required
std::string main_executable_path;/* this should be set to argv[0] */
// Optional. Only change if needed.
bool autoLogin; /* try auto-login */
bool udpListenerOnly; /* only listen to udp */
std::string forcedInetAddress; /* inet address to use.*/
uint16_t forcedPort; /* port to listen to */
bool outStderr;
int debugLevel;
std::string logfname; /* output filename for log */
std::string opModeStr; /* operating mode. Acceptable values: "Full", "NoTurtle", "Gaming", "Minimal" */
std::string optBaseDir; /* base directory where to find profiles, etc */
uint16_t jsonApiPort; /* port to use fo Json API */
std::string jsonApiBindAddress; /* bind address for Json API */
};
/*! /*!
* Initialisation Class (not publicly disclosed to RsIFace) * Initialisation Class (not publicly disclosed to RsIFace)
@ -57,7 +90,7 @@ public:
OK, /// Everything go as expected, no error occurred OK, /// Everything go as expected, no error occurred
ERR_ALREADY_RUNNING, /// Another istance is running already ERR_ALREADY_RUNNING, /// Another istance is running already
ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running? ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running?
ERR_UNKOWN /// Unkown error, maybe password is wrong? ERR_UNKNOWN /// Unkown error, maybe password is wrong?
}; };
/* reorganised RsInit system */ /* reorganised RsInit system */
@ -77,12 +110,19 @@ public:
* invalid argument passed and vice versa * invalid argument passed and vice versa
* @return RS_INIT_... * @return RS_INIT_...
*/ */
static int InitRetroShare(int argc, char **argv, bool strictCheck=true); static int InitRetroShare(const RsConfigOptions&);
static bool isPortable(); static bool isPortable();
static bool isWindowsXP(); static bool isWindowsXP();
static bool collectEntropy(uint32_t bytes) ; static bool collectEntropy(uint32_t bytes) ;
/*!
* \brief lockFilePath
* \return
* full path for the lock file. Can be used to warn the user about a non deleted lock that would prevent to start.
*/
static std::string lockFilePath();
/* /*
* Setup Hidden Location; * Setup Hidden Location;
*/ */
@ -270,8 +310,10 @@ extern RsAccounts* rsAccounts;
* This helper class have been implemented because there was not reasonable way * This helper class have been implemented because there was not reasonable way
* to login in the API that could be exposed via JSON API * to login in the API that could be exposed via JSON API
*/ */
struct RsLoginHelper class RsLoginHelper
{ {
public:
RsLoginHelper() {}
/** /**
* @brief Normal way to attempt login * @brief Normal way to attempt login
* @jsonapi{development,manualwrapper} * @jsonapi{development,manualwrapper}
@ -295,7 +337,7 @@ struct RsLoginHelper
RsPeerId mLocationId; RsPeerId mLocationId;
RsPgpId mPgpId; RsPgpId mPgpId;
std::string mLocationName; std::string mLocationName;
std::string mPpgName; std::string mPgpName;
/// @see RsSerializable::serial_process /// @see RsSerializable::serial_process
void serial_process( RsGenericSerializer::SerializeJob j, void serial_process( RsGenericSerializer::SerializeJob j,

View File

@ -42,6 +42,8 @@
#include "util/folderiterator.h" #include "util/folderiterator.h"
#include "util/rsstring.h" #include "util/rsstring.h"
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "retroshare/rsnotify.h"
#include "retroshare/rsiface.h"
#include "plugins/pluginmanager.h" #include "plugins/pluginmanager.h"
#include "rsserver/rsloginhandler.h" #include "rsserver/rsloginhandler.h"
@ -112,9 +114,29 @@ RsLoginHelper* rsLoginHelper = nullptr;
RsAccounts* rsAccounts = nullptr; RsAccounts* rsAccounts = nullptr;
RsConfigOptions::RsConfigOptions()
:
#ifdef RS_JSONAPI
jsonApiPort(JsonApiServer::DEFAULT_PORT),
jsonApiBindAddress("127.0.0.1"),
#endif
autoLogin(false),
forcedPort(0),
udpListenerOnly(false),
outStderr(false),
debugLevel(5)
{
}
struct RsInitConfig struct RsInitConfig
{ {
RsInitConfig() : jsonApiPort(0), jsonApiBindAddress("127.0.0.1") {} RsInitConfig()
#ifdef RS_JSONAPI
: jsonApiPort(JsonApiServer::DEFAULT_PORT),
jsonApiBindAddress("127.0.0.1")
#endif
{}
RsFileHash main_executable_hash; RsFileHash main_executable_hash;
@ -155,6 +177,7 @@ struct RsInitConfig
bool udpListenerOnly; bool udpListenerOnly;
std::string opModeStr; std::string opModeStr;
std::string optBaseDir;
uint16_t jsonApiPort; uint16_t jsonApiPort;
std::string jsonApiBindAddress; std::string jsonApiBindAddress;
@ -243,14 +266,6 @@ void RsInit::InitRsConfig()
setOutputLevel(RsLog::Warning); setOutputLevel(RsLog::Warning);
} }
/********
* LOCALNET_TESTING - allows port restrictions
*
* #define LOCALNET_TESTING 1
*
********/
#ifdef LOCALNET_TESTING #ifdef LOCALNET_TESTING
std::string portRestrictions; std::string portRestrictions;
@ -264,68 +279,33 @@ bool doPortRestrictions = false;
#endif #endif
#endif #endif
int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */) /********
* LOCALNET_TESTING - allows port restrictions
*
* #define LOCALNET_TESTING 1
*
********/
int RsInit::InitRetroShare(const RsConfigOptions& conf)
{ {
#ifdef DEBUG_RSINIT rsInitConfig->autoLogin = conf.autoLogin;
for(int i=0; i<argc; i++) printf("%d: %s\n", i, argv[i]); rsInitConfig->outStderr = conf.outStderr;
#endif rsInitConfig->logfname = conf.logfname ;
rsInitConfig->inet = conf.forcedInetAddress ;
rsInitConfig->port = conf.forcedPort ;
rsInitConfig->debugLevel = conf.debugLevel;
rsInitConfig->optBaseDir = conf.optBaseDir;
rsInitConfig->jsonApiPort = conf.jsonApiPort;
rsInitConfig->jsonApiBindAddress = conf.jsonApiBindAddress;
#ifdef PTW32_STATIC_LIB #ifdef PTW32_STATIC_LIB
// for static PThreads under windows... we need to init the library... // for static PThreads under windows... we need to init the library...
pthread_win32_process_attach_np(); pthread_win32_process_attach_np();
#endif #endif
if( rsInitConfig->autoLogin) rsInitConfig->startMinimised = true ;
std::string prefUserString = ""; if( rsInitConfig->outStderr) rsInitConfig->haveLogFile = false ;
std::string opt_base_dir;
#ifdef __APPLE__
// TODO: is this still needed with argstream?
/* HACK to avoid stupid OSX Finder behaviour
* remove the commandline arguments - if we detect we are launched from Finder,
* and we have the unparsable "-psn_0_12332" option.
* this is okay, as you cannot pass commandline arguments via Finder anyway
*/
if ((argc >= 2) && (0 == strncmp(argv[1], "-psn", 4))) argc = 1;
#endif
argstream as(argc,argv);
as >> option('m',"minimized" ,rsInitConfig->startMinimised ,"Start minimized." )
>> option('s',"stderr" ,rsInitConfig->outStderr ,"output to stderr instead of log file." )
>> option('u',"udp" ,rsInitConfig->udpListenerOnly,"Only listen to UDP." )
>> option('e',"external-port" ,rsInitConfig->forceExtPort ,"Use a forwarded external port." )
>> parameter('l',"log-file" ,rsInitConfig->logfname ,"logfile" ,"Set Log filename." ,false)
>> parameter('d',"debug-level" ,rsInitConfig->debugLevel ,"level" ,"Set debug level." ,false)
>> parameter('i',"ip-address" ,rsInitConfig->inet ,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false)
>> parameter('o',"opmode" ,rsInitConfig->opModeStr ,"opmode" ,"Set Operating mode (Full, NoTurtle, Gaming, Minimal)." ,false)
>> parameter('p',"port" ,rsInitConfig->port ,"port", "Set listenning port to use." ,false)
>> parameter('c',"base-dir" ,opt_base_dir ,"directory", "Set base directory." ,false)
>> parameter('U',"user-id" ,prefUserString ,"ID", "[ocation Id] Sets Account to Use, Useful when Autologin is enabled.",false);
#ifdef RS_JSONAPI
as >> parameter(
"jsonApiPort", rsInitConfig->jsonApiPort, "jsonApiPort",
"Enable JSON API on the specified port", false )
>> parameter(
"jsonApiBindAddress", rsInitConfig->jsonApiBindAddress,
"jsonApiBindAddress", "JSON API Bind Address.", false);
#endif // ifdef RS_JSONAPI
#ifdef LOCALNET_TESTING
as >> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false);
#endif // ifdef LOCALNET_TESTING
#ifdef RS_AUTOLOGIN
as >> option('a',"auto-login" ,rsInitConfig->autoLogin ,"AutoLogin (Windows Only) + StartMinimised");
#endif // ifdef RS_AUTOLOGIN
as >> help('h',"help","Display this Help");
as.defaultErrorHandling(true,true);
if(rsInitConfig->autoLogin) rsInitConfig->startMinimised = true ;
if(rsInitConfig->outStderr) rsInitConfig->haveLogFile = false ;
if(!rsInitConfig->logfname.empty()) rsInitConfig->haveLogFile = true; if(!rsInitConfig->logfname.empty()) rsInitConfig->haveLogFile = true;
if(rsInitConfig->inet != "127.0.0.1") rsInitConfig->forceLocalAddr = true; if( rsInitConfig->inet != "127.0.0.1") rsInitConfig->forceLocalAddr = true;
if( rsInitConfig->port != 0) rsInitConfig->forceExtPort = true;
#ifdef LOCALNET_TESTING #ifdef LOCALNET_TESTING
if(!portRestrictions.empty()) doPortRestrictions = true; if(!portRestrictions.empty()) doPortRestrictions = true;
#endif #endif
@ -384,7 +364,12 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
uint64_t tmp_size ; uint64_t tmp_size ;
if(!RsDirUtil::getFileHash(argv[0],rsInitConfig->main_executable_hash,tmp_size,NULL)) if(conf.main_executable_path.empty())
{
std::cerr << "Executable path is unknown. It should normally have been set in passed RsConfigOptions structure" << std::endl;
return 1;
}
if(!RsDirUtil::getFileHash(conf.main_executable_path,rsInitConfig->main_executable_hash,tmp_size,NULL))
std::cerr << "Cannot hash executable! Plugins will not be loaded correctly." << std::endl; std::cerr << "Cannot hash executable! Plugins will not be loaded correctly." << std::endl;
else else
std::cerr << "Hashed main executable: " << rsInitConfig->main_executable_hash << std::endl; std::cerr << "Hashed main executable: " << rsInitConfig->main_executable_hash << std::endl;
@ -402,27 +387,9 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
int error_code ; int error_code ;
if(!RsAccounts::init(opt_base_dir,error_code)) if(!RsAccounts::init(rsInitConfig->optBaseDir,error_code))
return error_code ; return error_code ;
// choose alternative account.
if(prefUserString != "")
{
RsPeerId ssl_id(prefUserString);
if(ssl_id.isNull())
{
std::cerr << "Invalid User location id: not found in list";
std::cerr << std::endl;
return RS_INIT_AUTH_FAILED ;
}
if(RsAccounts::SelectAccount(ssl_id))
{
std::cerr << "Auto-selectng account ID " << ssl_id << std::endl;
return RS_INIT_HAVE_ACCOUNT;
}
}
#ifdef RS_AUTOLOGIN #ifdef RS_AUTOLOGIN
/* check that we have selected someone */ /* check that we have selected someone */
@ -443,9 +410,7 @@ int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
if(rsInitConfig->jsonApiPort) if(rsInitConfig->jsonApiPort)
{ {
jsonApiServer = new JsonApiServer( jsonApiServer = new JsonApiServer( rsInitConfig->jsonApiPort, rsInitConfig->jsonApiBindAddress );
rsInitConfig->jsonApiPort,
rsInitConfig->jsonApiBindAddress );
jsonApiServer->start("JSON API Server"); jsonApiServer->start("JSON API Server");
} }
#endif // ifdef RS_JSONAPI #endif // ifdef RS_JSONAPI
@ -477,7 +442,7 @@ RsInit::LoadCertificateStatus RsInit::LockConfigDirectory(
case 0: return RsInit::OK; case 0: return RsInit::OK;
case 1: return RsInit::ERR_ALREADY_RUNNING; case 1: return RsInit::ERR_ALREADY_RUNNING;
case 2: return RsInit::ERR_CANT_ACQUIRE_LOCK; case 2: return RsInit::ERR_CANT_ACQUIRE_LOCK;
default: return RsInit::ERR_UNKOWN; default: return RsInit::ERR_UNKNOWN;
} }
} }
@ -510,27 +475,32 @@ bool RsInit::LoadPassword(const std::string& inPwd)
return true; return true;
} }
std::string RsInit::lockFilePath()
{
return RsAccounts::AccountDirectory() + "/lock" ;
}
RsInit::LoadCertificateStatus RsInit::LockAndLoadCertificates( RsInit::LoadCertificateStatus RsInit::LockAndLoadCertificates(
bool autoLoginNT, std::string& lockFilePath ) bool autoLoginNT, std::string& lockFilePath )
{ {
try try
{ {
if (!RsAccounts::lockPreferredAccount()) if (!RsAccounts::lockPreferredAccount())
throw RsInit::ERR_UNKOWN; // invalid PreferredAccount. throw RsInit::ERR_UNKNOWN; // invalid PreferredAccount.
// Logic that used to be external to RsInit... // Logic that used to be external to RsInit...
RsPeerId accountId; RsPeerId accountId;
if (!RsAccounts::GetPreferredAccountId(accountId)) if (!RsAccounts::GetPreferredAccountId(accountId))
throw RsInit::ERR_UNKOWN; // invalid PreferredAccount; throw RsInit::ERR_UNKNOWN; // invalid PreferredAccount;
RsPgpId pgpId; RsPgpId pgpId;
std::string pgpName, pgpEmail, location; std::string pgpName, pgpEmail, location;
if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location)) if(!RsAccounts::GetAccountDetails(accountId, pgpId, pgpName, pgpEmail, location))
throw RsInit::ERR_UNKOWN; // invalid PreferredAccount; throw RsInit::ERR_UNKNOWN; // invalid PreferredAccount;
if(0 == AuthGPG::getAuthGPG() -> GPGInit(pgpId)) if(0 == AuthGPG::getAuthGPG() -> GPGInit(pgpId))
throw RsInit::ERR_UNKOWN; // PGP Error. throw RsInit::ERR_UNKNOWN; // PGP Error.
LoadCertificateStatus retVal = LoadCertificateStatus retVal =
LockConfigDirectory(RsAccounts::AccountDirectory(), lockFilePath); LockConfigDirectory(RsAccounts::AccountDirectory(), lockFilePath);
@ -541,7 +511,7 @@ RsInit::LoadCertificateStatus RsInit::LockAndLoadCertificates(
if(LoadCertificates(autoLoginNT) != 1) if(LoadCertificates(autoLoginNT) != 1)
{ {
UnlockConfigDirectory(); UnlockConfigDirectory();
throw RsInit::ERR_UNKOWN; throw RsInit::ERR_UNKNOWN;
} }
return RsInit::OK; return RsInit::OK;
@ -1210,7 +1180,8 @@ int RsServer::StartupRetroShare()
plugins_directories.push_back(extensions_dir) ; plugins_directories.push_back(extensions_dir) ;
if(!RsDirUtil::checkCreateDirectory(extensions_dir)) if(!RsDirUtil::checkCreateDirectory(extensions_dir))
std::cerr << "(EE) Cannot create extensions directory " + extensions_dir + ". This is not mandatory, but you probably have a permission problem." << std::endl; std::cerr << "(EE) Cannot create extensions directory " << extensions_dir
<< ". This is not mandatory, but you probably have a permission problem." << std::endl;
#ifdef DEBUG_PLUGIN_SYSTEM #ifdef DEBUG_PLUGIN_SYSTEM
plugins_directories.push_back(".") ; // this list should be saved/set to some correct value. plugins_directories.push_back(".") ; // this list should be saved/set to some correct value.
@ -1909,21 +1880,24 @@ int RsServer::StartupRetroShare()
return 1; return 1;
} }
RsInit::LoadCertificateStatus RsLoginHelper::attemptLogin( RsInit::LoadCertificateStatus RsLoginHelper::attemptLogin(const RsPeerId& account, const std::string& password)
const RsPeerId& account, const std::string& password)
{ {
if(isLoggedIn()) return RsInit::ERR_ALREADY_RUNNING; if(isLoggedIn()) return RsInit::ERR_ALREADY_RUNNING;
if(!rsNotify->cachePgpPassphrase(password)) return RsInit::ERR_UNKOWN;
if(!rsNotify->setDisableAskPassword(true)) return RsInit::ERR_UNKOWN; if(!password.empty())
if(!RsAccounts::SelectAccount(account)) return RsInit::ERR_UNKOWN; {
if(!rsNotify->cachePgpPassphrase(password)) return RsInit::ERR_UNKNOWN;
if(!rsNotify->setDisableAskPassword(true)) return RsInit::ERR_UNKNOWN;
}
if(!RsAccounts::SelectAccount(account)) return RsInit::ERR_UNKNOWN;
std::string _ignore_lockFilePath; std::string _ignore_lockFilePath;
RsInit::LoadCertificateStatus ret = RsInit::LoadCertificateStatus ret = RsInit::LockAndLoadCertificates(false, _ignore_lockFilePath);
RsInit::LockAndLoadCertificates(false, _ignore_lockFilePath);
if(!rsNotify->setDisableAskPassword(false)) return RsInit::ERR_UNKOWN; if(!rsNotify->setDisableAskPassword(false)) return RsInit::ERR_UNKNOWN;
if(!rsNotify->clearPgpPassphrase()) return RsInit::ERR_UNKOWN; if(!rsNotify->clearPgpPassphrase()) return RsInit::ERR_UNKNOWN;
if(ret != RsInit::OK) return ret; if(ret != RsInit::OK) return ret;
if(RsControl::instance()->StartupRetroShare() == 1) return RsInit::OK; if(RsControl::instance()->StartupRetroShare() == 1) return RsInit::OK;
return RsInit::ERR_UNKOWN; return RsInit::ERR_UNKNOWN;
} }
/*static*/ bool RsLoginHelper::collectEntropy(uint32_t bytes) /*static*/ bool RsLoginHelper::collectEntropy(uint32_t bytes)
@ -1939,7 +1913,7 @@ void RsLoginHelper::getLocations(std::vector<RsLoginHelper::Location>& store)
{ {
Location l; l.mLocationId = locId; Location l; l.mLocationId = locId;
std::string discardPgpMail; std::string discardPgpMail;
RsAccounts::GetAccountDetails( locId, l.mPgpId, l.mPpgName, RsAccounts::GetAccountDetails( locId, l.mPgpId, l.mPgpName,
discardPgpMail, l.mLocationName ); discardPgpMail, l.mLocationName );
store.push_back(l); store.push_back(l);
} }
@ -1957,14 +1931,14 @@ bool RsLoginHelper::createLocation(
return false; return false;
} }
if(l.mPgpId.isNull() && l.mPpgName.empty()) if(l.mPgpId.isNull() && l.mPgpName.empty())
{ {
errorMessage = "Either PGP name or PGP id is needed"; errorMessage = "Either PGP name or PGP id is needed";
return false; return false;
} }
if(l.mPgpId.isNull() && !RsAccounts::GeneratePGPCertificate( if(l.mPgpId.isNull() && !RsAccounts::GeneratePGPCertificate(
l.mPpgName, "", password, l.mPgpId, 4096, errorMessage) ) l.mPgpName, "", password, l.mPgpId, 4096, errorMessage) )
{ {
errorMessage = "Failure creating PGP key: " + errorMessage; errorMessage = "Failure creating PGP key: " + errorMessage;
return false; return false;
@ -1999,7 +1973,7 @@ void RsLoginHelper::Location::serial_process(
RS_SERIAL_PROCESS(mLocationId); RS_SERIAL_PROCESS(mLocationId);
RS_SERIAL_PROCESS(mPgpId); RS_SERIAL_PROCESS(mPgpId);
RS_SERIAL_PROCESS(mLocationName); RS_SERIAL_PROCESS(mLocationName);
RS_SERIAL_PROCESS(mPpgName); RS_SERIAL_PROCESS(mPgpName);
} }
/*static*/ bool RsAccounts::getCurrentAccountId(RsPeerId& id) /*static*/ bool RsAccounts::getCurrentAccountId(RsPeerId& id)

View File

@ -0,0 +1,130 @@
/*******************************************************************************
* libretroshare/src/retroshare/util/rskbdinput.cc *
* *
* Copyright (C) 2019 Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef __ANDROID__
#include <iostream>
#include <util/rskbdinput.h>
#ifdef WINDOWS_SYS
#include <conio.h>
#include <stdio.h>
#define PASS_MAX 512
namespace RsUtil {
std::string rs_getpass(const std::string& prompt,bool no_echo)
{
static char getpassbuf [PASS_MAX + 1];
size_t i = 0;
int c;
if (!prompt.empty()) {
std::cerr << prompt ;
std::cerr.flush();
}
for (;;) {
c = _getch ();
if (c == '\r') {
getpassbuf [i] = '\0';
break;
}
else if (i < PASS_MAX) {
getpassbuf[i++] = c;
}
if (i >= PASS_MAX) {
getpassbuf [i] = '\0';
break;
}
}
if (!prompt.empty()) {
std::cerr << "\r\n" ;
std::cerr.flush();
}
return std::string(getpassbuf);
}
}
#else
#include <stdio.h>
#include <string>
#include <iostream>
#include <termios.h>
#include <unistd.h>
static int getch()
{
int ch;
struct termios t_old, t_new;
tcgetattr(STDIN_FILENO, &t_old);
t_new = t_old;
t_new.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &t_new);
ch = getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &t_old);
return ch;
}
namespace RsUtil {
std::string rs_getpass(const std::string& prompt, bool no_echo)
{
const char BACKSPACE=127;
const char RETURN=10;
std::string password;
unsigned char ch=0;
std::cout <<prompt; std::cout.flush();
while((ch=getch())!=RETURN)
{
if(ch==BACKSPACE)
{
if(password.length()!=0)
{
if(no_echo)
std::cout <<"\b \b";
password.resize(password.length()-1);
}
}
else
{
password+=ch;
if(no_echo)
std::cout <<'*';
else
std::cout << ch,std::cout.flush();
}
}
std::cout <<std::endl;
return std::string(password);
}
}
#endif
#endif

View File

@ -0,0 +1,27 @@
/*******************************************************************************
* libretroshare/src/retroshare/util/rskbdinput.h *
* *
* Copyright (C) 2019 Cyril Soler <csoler@users.sourceforge.net> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <string>
namespace RsUtil {
std::string rs_getpass(const std::string& prompt,bool no_echo=true) ;
}

View File

@ -21,6 +21,7 @@
*******************************************************************************/ *******************************************************************************/
#include "util/stacktrace.h" #include "util/stacktrace.h"
#include "util/argstream.h"
CrashStackTrace gCrashStackTrace; CrashStackTrace gCrashStackTrace;
@ -50,6 +51,7 @@ CrashStackTrace gCrashStackTrace;
#include "util/RsGxsUpdateBroadcast.h" #include "util/RsGxsUpdateBroadcast.h"
#include "util/rsdir.h" #include "util/rsdir.h"
#include "util/rstime.h" #include "util/rstime.h"
#include "retroshare/rsinit.h"
#ifdef MESSENGER_WINDOW #ifdef MESSENGER_WINDOW
#include "gui/MessengerWindow.h" #include "gui/MessengerWindow.h"
@ -228,7 +230,34 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
/* RetroShare Core Objects */ /* RetroShare Core Objects */
RsInit::InitRsConfig(); RsInit::InitRsConfig();
int initResult = RsInit::InitRetroShare(argc, argv);
RsConfigOptions conf;
argstream as(argc,argv);
as >> option('s',"stderr" ,conf.outStderr ,"output to stderr instead of log file." )
>> option('u',"udp" ,conf.udpListenerOnly,"Only listen to UDP." )
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory", "Set base directory." ,false)
>> parameter('l',"log-file" ,conf.logfname ,"logfile" ,"Set Log filename." ,false)
>> parameter('d',"debug-level" ,conf.debugLevel ,"level" ,"Set debug level." ,false)
>> parameter('i',"ip-address" ,conf.forcedInetAddress,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false)
>> parameter('p',"port" ,conf.forcedPort ,"port" ,"Set listenning port to use." ,false)
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode" ,"Set Operating mode (Full, NoTurtle, Gaming, Minimal)." ,false);
#ifdef RS_JSONAPI
as >> parameter('J', "jsonApiPort", conf.jsonApiPort, "jsonApiPort", "Enable JSON API on the specified port", false )
>> parameter('P', "jsonApiBindAddress", conf.jsonApiBindAddress, "jsonApiBindAddress", "JSON API Bind Address.", false);
#endif // ifdef RS_JSONAPI
#ifdef LOCALNET_TESTING
as >> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false);
#endif // ifdef LOCALNET_TESTING
#ifdef RS_AUTOLOGIN
as >> option('a',"auto-login" ,conf.autoLogin ,"AutoLogin (Windows Only) + StartMinimised");
#endif // ifdef RS_AUTOLOGIN
conf.main_executable_path = argv[0];
int initResult = RsInit::InitRetroShare(conf);
if(initResult == RS_INIT_NO_KEYRING) // happens when we already have accounts, but no pgp key. This is when switching to the openpgp-sdk version. if(initResult == RS_INIT_NO_KEYRING) // happens when we already have accounts, but no pgp key. This is when switching to the openpgp-sdk version.
{ {
@ -252,7 +281,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
if(!RsAccounts::CopyGnuPGKeyrings()) if(!RsAccounts::CopyGnuPGKeyrings())
return 0 ; return 0 ;
initResult = RsInit::InitRetroShare(argc, argv); initResult = RsInit::InitRetroShare(conf);
displayWarningAboutDSAKeys() ; displayWarningAboutDSAKeys() ;

View File

@ -57,8 +57,10 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#ifdef ENABLE_WEBUI RsConfigOptions conf;
conf.main_executable_path = argv[0];
#ifdef ENABLE_WEBUI
std::string docroot = resource_api::getDefaultDocroot(); std::string docroot = resource_api::getDefaultDocroot();
uint16_t httpPort = 0; uint16_t httpPort = 0;
std::string listenAddress; std::string listenAddress;
@ -77,7 +79,8 @@ int main(int argc, char **argv)
std::cerr << args.usage() << std::endl; std::cerr << args.usage() << std::endl;
// print libretroshare command line args and exit // print libretroshare command line args and exit
RsInit::InitRsConfig(); RsInit::InitRsConfig();
RsInit::InitRetroShare(argc, argv, true);
RsInit::InitRetroShare(conf);
return 0; return 0;
} }
@ -126,7 +129,7 @@ int main(int argc, char **argv)
bool strictCheck = true; bool strictCheck = true;
RsInit::InitRsConfig(); RsInit::InitRsConfig();
int initResult = RsInit::InitRetroShare(argc, argv, strictCheck); int initResult = RsInit::InitRetroShare(conf);
if (initResult < 0) { if (initResult < 0) {
/* Error occured */ /* Error occured */

View File

@ -17,37 +17,55 @@
*/ */
#include "util/stacktrace.h" #include "util/stacktrace.h"
#include "util/argstream.h"
#include "util/rskbdinput.h"
#include "retroshare/rsinit.h"
#ifdef RS_JSONAPI
#include "jsonapi/jsonapi.h"
#endif
CrashStackTrace gCrashStackTrace; CrashStackTrace gCrashStackTrace;
#include <QCoreApplication> #include <cmath>
#include <csignal> #include <csignal>
#include <QObject> #include <iomanip>
#include <QStringList> #include <atomic>
#ifdef __ANDROID__ #ifdef __ANDROID__
# include <QAndroidService> # include <QAndroidService>
# include <QCoreApplication>
# include <QObject>
# include <QStringList>
# include "util/androiddebug.h"
#endif // def __ANDROID__ #endif // def __ANDROID__
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#ifdef __ANDROID__ class RsServiceNotify: public NotifyClient
# include "util/androiddebug.h" {
#endif public:
RsServiceNotify(){}
virtual ~RsServiceNotify() {}
virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel)
{
std::string question1=title + "\nPlease enter your PGP password for key:\n " + question + " :";
password = RsUtil::rs_getpass(question1.c_str()) ;
cancel = false ;
return !password.empty();
}
};
#ifndef RS_JSONAPI
# error Inconsistent build configuration retroshare_service needs rs_jsonapi
#endif
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#ifdef __ANDROID__ #ifdef __ANDROID__
AndroidStdIOCatcher dbg; (void) dbg; AndroidStdIOCatcher dbg; (void) dbg;
QAndroidService app(argc, argv); QAndroidService app(argc, argv);
#else // def __ANDROID__
QCoreApplication app(argc, argv);
#endif // def __ANDROID__
signal(SIGINT, QCoreApplication::exit); signal(SIGINT, QCoreApplication::exit);
signal(SIGTERM, QCoreApplication::exit); signal(SIGTERM, QCoreApplication::exit);
@ -55,23 +73,161 @@ int main(int argc, char* argv[])
signal(SIGBREAK, QCoreApplication::exit); signal(SIGBREAK, QCoreApplication::exit);
#endif // ifdef SIGBREAK #endif // ifdef SIGBREAK
#endif // def __ANDROID__
std::cerr << "+================================================================+" << std::endl;
std::cerr << "| o---o o |" << std::endl;
std::cerr << "| \\ / - Retroshare Service - / \\ |" << std::endl;
std::cerr << "| o o---o |" << std::endl;
std::cerr << "+================================================================+" << std::endl;
std::cerr << std::endl;
RsInit::InitRsConfig(); RsInit::InitRsConfig();
// clumsy way to enable JSON API by default
if(!QCoreApplication::arguments().contains("--jsonApiPort"))
{
int argc2 = argc + 2;
char* argv2[argc2]; for (int i = 0; i < argc; ++i ) argv2[i] = argv[i];
char opt[] = "--jsonApiPort";
char val[] = "9092";
argv2[argc] = opt;
argv2[argc+1] = val;
RsInit::InitRetroShare(argc2, argv2, true);
}
else RsInit::InitRetroShare(argc, argv, true);
RsControl::earlyInitNotificationSystem(); RsControl::earlyInitNotificationSystem();
#ifdef __APPLE__
// TODO: is this still needed with argstream?
/* HACK to avoid stupid OSX Finder behaviour
* remove the commandline arguments - if we detect we are launched from Finder,
* and we have the unparsable "-psn_0_12332" option.
* this is okay, as you cannot pass commandline arguments via Finder anyway
*/
if ((argc >= 2) && (0 == strncmp(argv[1], "-psn", 4))) argc = 1;
#endif
std::string prefUserString;
RsConfigOptions conf;
argstream as(argc,argv);
as >> option('s',"stderr" ,conf.outStderr ,"output to stderr instead of log file." )
>> option('u',"udp" ,conf.udpListenerOnly ,"Only listen to UDP." )
>> parameter('c',"base-dir" ,conf.optBaseDir ,"directory", "Set base directory." ,false)
>> parameter('l',"log-file" ,conf.logfname ,"logfile" ,"Set Log filename." ,false)
>> parameter('d',"debug-level" ,conf.debugLevel ,"level" ,"Set debug level." ,false)
>> parameter('i',"ip-address" ,conf.forcedInetAddress,"nnn.nnn.nnn.nnn", "Force IP address to use (if cannot be detected)." ,false)
>> parameter('o',"opmode" ,conf.opModeStr ,"opmode" ,"Set Operating mode (Full, NoTurtle, Gaming, Minimal)." ,false)
>> parameter('p',"port" ,conf.forcedPort ,"port", "Set listenning port to use." ,false)
>> parameter('U',"user-id" ,prefUserString ,"ID", "[node Id] Selected account to use and asks for passphrase. Use \"-U list\" in order to list available accounts.",false);
#ifdef RS_JSONAPI
as >> parameter('J', "jsonApiPort", conf.jsonApiPort, "jsonApiPort", "Enable JSON API on the specified port", false )
>> parameter('P', "jsonApiBindAddress", conf.jsonApiBindAddress, "jsonApiBindAddress", "JSON API Bind Address.", false);
#endif // ifdef RS_JSONAPI
#ifdef LOCALNET_TESTING
as >> parameter('R',"restrict-port" ,portRestrictions ,"port1-port2","Apply port restriction" ,false);
#endif // ifdef LOCALNET_TESTING
#ifdef RS_AUTOLOGIN
as >> option('a',"auto-login" ,conf.autoLogin ,"AutoLogin (Windows Only) + StartMinimised");
#endif // ifdef RS_AUTOLOGIN
as >> help('h',"help","Display this Help");
as.defaultErrorHandling(true,true);
std::string webui_pass1 = "Y";
if(!prefUserString.empty())
{
std::string webui_pass2 = "N";
for(;;)
{
webui_pass1 = RsUtil::rs_getpass("Please register a password for the web interface: ");
webui_pass2 = RsUtil::rs_getpass("Please enter the same password again : ");
if(webui_pass1 != webui_pass2)
{
std::cerr << "Passwords do not match!" << std::endl;
continue;
}
if(webui_pass1.empty())
{
std::cerr << "Password cannot be empty!" << std::endl;
continue;
}
break;
}
}
conf.main_executable_path = argv[0];
if(RS_INIT_OK != RsInit::InitRetroShare(conf))
{
std::cerr << "Could not properly init Retroshare core." << std::endl;
return 1;
}
// choose alternative account.
if(prefUserString != "")
{
if(prefUserString == "list")
{
std::cerr << "Available accounts:" << std::endl;
std::vector<RsLoginHelper::Location> locations;
rsLoginHelper->getLocations(locations);
int account_number_size = (int)ceil(log(locations.size())/log(10.0f)) ;
for(uint32_t i=0;i<locations.size();++i)
std::cout << "[" << std::setw(account_number_size) << std::setfill('0')
<< i+1 << "] " << locations[i].mLocationId << " (" << locations[i].mPgpId << "): " << locations[i].mPgpName
<< " \t (" << locations[i].mLocationName << ")" << std::endl;
int nacc=0;
while(nacc < 1 || nacc >= locations.size())
{
std::cout << "Please enter account number: ";
std::cout.flush();
std::string str;
std::getline(std::cin, str);
nacc = atoi(str.c_str())-1;
if(nacc >= 0 && nacc < locations.size())
{
prefUserString = locations[nacc].mLocationId.toStdString();
break;
}
nacc=0; // allow to continue if something goes wrong.
}
}
RsPeerId ssl_id(prefUserString);
if(ssl_id.isNull())
{
std::cerr << "Invalid User location id: a hexadecimal ID is expected." << std::endl;
return 1;
}
RsServiceNotify *notify = new RsServiceNotify();
rsNotify->registerNotifyClient(notify);
RsInit::LoadCertificateStatus result = rsLoginHelper->attemptLogin(ssl_id,std::string()); // supply empty passwd so that it is properly asked 3 times on console
std::string lock_file_path = RsAccounts::AccountDirectory()+"/lock" ;
switch(result)
{
case RsInit::OK: break;
case RsInit::ERR_ALREADY_RUNNING: std::cerr << "Another RetroShare using the same profile is already running on your system. Please close "
"that instance first.\nLock file: " << RsInit::lockFilePath() << std::endl;
return 1;
case RsInit::ERR_CANT_ACQUIRE_LOCK: std::cerr << "An unexpected error occurred when Retroshare tried to acquire the single instance lock file. \nLock file: " << RsInit::lockFilePath() << std::endl;
return 1;
case RsInit::ERR_UNKNOWN:
default: std::cerr << "Cannot login. Check your passphrase." << std::endl << std::endl;
return 1;
}
}
#ifdef __ANDROID__
rsControl->setShutdownCallback(QCoreApplication::exit); rsControl->setShutdownCallback(QCoreApplication::exit);
QObject::connect( QObject::connect(
&app, &QCoreApplication::aboutToQuit, &app, &QCoreApplication::aboutToQuit,
[](){ [](){
@ -79,4 +235,18 @@ int main(int argc, char* argv[])
RsControl::instance()->rsGlobalShutDown(); } ); RsControl::instance()->rsGlobalShutDown(); } );
return app.exec(); return app.exec();
#else
#ifdef RS_JSONAPI
if(jsonApiServer && !webui_pass1.empty())
jsonApiServer->authorizeToken("webui:"+webui_pass1);
#endif
std::atomic<bool> keepRunning(true);
rsControl->setShutdownCallback([&](int){keepRunning = false;});
while(keepRunning)
std::this_thread::sleep_for(std::chrono::seconds(2));
#endif
} }

View File

@ -40,3 +40,75 @@ unix {
target.path = "$${RS_BIN_DIR}" target.path = "$${RS_BIN_DIR}"
INSTALLS += target INSTALLS += target
} }
macx {
# ENABLE THIS OPTION FOR Univeral Binary BUILD.
#CONFIG += ppc x86
#QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
LIBS += -lz
#LIBS += -lssl -lcrypto -lz -lgpgme -lgpg-error -lassuan
for(lib, LIB_DIR):exists($$lib/libminiupnpc.a){ LIBS += $$lib/libminiupnpc.a}
LIBS += -framework CoreFoundation
LIBS += -framework Security
LIBS += -framework Carbon
for(lib, LIB_DIR):LIBS += -L"$$lib"
for(bin, BIN_DIR):LIBS += -L"$$bin"
DEPENDPATH += . $$INC_DIR
INCLUDEPATH += . $$INC_DIR
}
win32-g++ {
CONFIG(debug, debug|release) {
# show console output
CONFIG += console
} else {
CONFIG -= console
}
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
CONFIG(debug, debug|release) {
} else {
# Tell linker to use ASLR protection
QMAKE_LFLAGS += -Wl,-dynamicbase
# Tell linker to use DEP protection
QMAKE_LFLAGS += -Wl,-nxcompat
}
# Fix linking error (ld.exe: Error: export ordinal too large) due to too
# many exported symbols.
QMAKE_LFLAGS+=-Wl,--exclude-libs,ALL
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
OBJECTS_DIR = temp/obj
dLib = ws2_32 gdi32 uuid ole32 iphlpapi crypt32 winmm
LIBS *= $$linkDynamicLibs(dLib)
# export symbols for the plugins
LIBS += -Wl,--export-all-symbols,--out-implib,lib/libretroshare-service.a
# create lib directory
isEmpty(QMAKE_SH) {
QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib $(MKDIR) lib
} else {
QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib || $(MKDIR) lib
}
}

View File

@ -33,8 +33,8 @@ CONFIG *= gxsdistsync
# To disable RetroShare-nogui append the following # To disable RetroShare-nogui append the following
# assignation to qmake command line "CONFIG+=no_retroshare_nogui" # assignation to qmake command line "CONFIG+=no_retroshare_nogui"
CONFIG *= retroshare_nogui CONFIG *= no_retroshare_nogui
no_retroshare_nogui:CONFIG -= retroshare_nogui retroshare_nogui:CONFIG -= no_retroshare_nogui
# To disable cmark append the following # To disable cmark append the following
# assignation to qmake command line "CONFIG+=no_cmark" # assignation to qmake command line "CONFIG+=no_cmark"
@ -64,13 +64,12 @@ retroshare_qml_app:CONFIG -= no_retroshare_qml_app
# To enable RetroShare service append the following assignation to # To enable RetroShare service append the following assignation to
# qmake command line "CONFIG+=retroshare_service" # qmake command line "CONFIG+=retroshare_service"
CONFIG *= no_retroshare_service CONFIG *= retroshare_service
retroshare_service:CONFIG -= no_retroshare_service retroshare_service:CONFIG -= no_retroshare_service
# To disable libresapi append the following assignation to qmake command line # To enable libresapi (deprecated) append the following assignation to qmake command line
#"CONFIG+=no_libresapi" CONFIG+=no_libresapi
CONFIG *= libresapi libresapi:CONFIG -= no_libresapi
no_libresapi:CONFIG -= libresapi
# To enable libresapi via local socket (unix domain socket or windows named # To enable libresapi via local socket (unix domain socket or windows named
# pipes) append the following assignation to qmake command line # pipes) append the following assignation to qmake command line
@ -85,8 +84,8 @@ libresapi_settings:CONFIG -= no_libresapi_settings
# To disable libresapi via HTTP (based on libmicrohttpd) append the following # To disable libresapi via HTTP (based on libmicrohttpd) append the following
# assignation to qmake command line "CONFIG+=no_libresapihttpserver" # assignation to qmake command line "CONFIG+=no_libresapihttpserver"
CONFIG *= libresapihttpserver CONFIG *= no_libresapihttpserver
no_libresapihttpserver:CONFIG -= libresapihttpserver libresapihttpserver:CONFIG -= no_libresapihttpserver
# To disable SQLCipher support append the following assignation to qmake # To disable SQLCipher support append the following assignation to qmake
# command line "CONFIG+=no_sqlcipher" # command line "CONFIG+=no_sqlcipher"