From ab6a5c07cce1a01ca40614690d2e63c97e17c6ca Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 22 Aug 2018 17:22:27 +0200 Subject: [PATCH] RsLoginHelper::createLocation expose capability of creating hidden locations --- libretroshare/src/retroshare/rsinit.h | 7 +++++-- libretroshare/src/rsserver/rsaccounts.cc | 5 ++++- libretroshare/src/rsserver/rsinit.cc | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/retroshare/rsinit.h b/libretroshare/src/retroshare/rsinit.h index 2f2810e73..292ecab96 100644 --- a/libretroshare/src/retroshare/rsinit.h +++ b/libretroshare/src/retroshare/rsinit.h @@ -252,12 +252,15 @@ struct RsLoginHelper * @param[inout] location provide input information to generate the location * and storage to output the data of the generated location * @param[in] password to protect and unlock the associated PGP key + * @param[in] makeHidden pass true to create an hidden location + * @param[in] makeAutoTor pass true to create an automatically configured + * Tor hidden location * @param[out] errorMessage * @return true if success, false otherwise */ bool createLocation( RsLoginHelper::Location& location, - const std::string& password, - std::string& errorMessage ); + const std::string& password, bool makeHidden, + bool makeAutoTor, std::string& errorMessage ); /** * @brief Close RetroShare session diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index f6120e788..c989d0bca 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -1410,7 +1410,10 @@ bool RsAccounts::GetAccountDetails(const RsPeerId &id, return rsAccounts->getCurrentAccountDetails(id, pgpId, pgpName, pgpEmail, location); } -bool RsAccounts::createNewAccount(const RsPgpId& pgp_id, const std::string& org, const std::string& loc, const std::string& country, bool ishiddenloc, bool isautotor, const std::string& passwd, RsPeerId &sslId, std::string &errString) +bool RsAccounts::createNewAccount( + const RsPgpId& pgp_id, const std::string& org, const std::string& loc, + const std::string& country, bool ishiddenloc, bool isautotor, + const std::string& passwd, RsPeerId &sslId, std::string &errString ) { return rsAccounts->GenerateSSLCertificate(pgp_id, org, loc, country, ishiddenloc, isautotor, passwd, sslId, errString); } diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index c2c23bd8b..c6b12d1b2 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1967,7 +1967,7 @@ void RsLoginHelper::getLocations(std::vector& store) bool RsLoginHelper::createLocation( RsLoginHelper::Location& l, const std::string& password, - std::string& errorMessage ) + bool makeHidden, bool makeAutoTor, std::string& errorMessage ) { if(l.mLocationName.empty()) { @@ -1992,7 +1992,7 @@ bool RsLoginHelper::createLocation( if(!rsNotify->setDisableAskPassword(true)) return false; bool ret = RsAccounts::createNewAccount( - l.mPgpId, "", l.mLocationName, "", false, false, + l.mPgpId, "", l.mLocationName, "", makeHidden, makeAutoTor, RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()), l.mLocationId, errorMessage );