mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-24 05:49:29 -04:00
Added the infrastructure for propagating trust info through third parties
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@892 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6919d3bd7f
commit
19aa089701
10 changed files with 101 additions and 26 deletions
|
@ -267,6 +267,32 @@ int AuthXPGP::setConfigDirectories(std::string configfile, std::string neigh
|
|||
return 1;
|
||||
}
|
||||
|
||||
bool AuthXPGP::isTrustingMe(std::string id)
|
||||
{
|
||||
xpgpMtx.lock(); /***** LOCK *****/
|
||||
|
||||
bool res = false ;
|
||||
|
||||
for(std::list<std::string>::const_iterator it(_trusting_peers.begin());it!=_trusting_peers.end() && !res;++it)
|
||||
if( *it == id )
|
||||
res = true ;
|
||||
|
||||
xpgpMtx.unlock(); /**** UNLOCK ****/
|
||||
|
||||
return res ;
|
||||
}
|
||||
void AuthXPGP::addTrustingPeer(std::string id)
|
||||
{
|
||||
if( !isTrustingMe(id) )
|
||||
{
|
||||
xpgpMtx.lock(); /***** LOCK *****/
|
||||
|
||||
_trusting_peers.push_back(id) ;
|
||||
|
||||
xpgpMtx.unlock(); /**** UNLOCK ****/
|
||||
}
|
||||
}
|
||||
|
||||
std::string AuthXPGP::OwnId()
|
||||
{
|
||||
#ifdef AUTHXPGP_DEBUG
|
||||
|
@ -1546,6 +1572,7 @@ int LoadCheckXPGPandGetName(const char *cert_file, std::string &userName, std::s
|
|||
valid = false;
|
||||
}
|
||||
|
||||
std::cout << getXPGPInfo(xpgp) << std::endl ;
|
||||
// clean up.
|
||||
XPGP_free(xpgp);
|
||||
|
||||
|
|
|
@ -102,6 +102,10 @@ virtual bool isAuthenticated(std::string id);
|
|||
virtual std::string getName(std::string id);
|
||||
virtual bool getDetails(std::string id, pqiAuthDetails &details);
|
||||
|
||||
/* first party trust info */
|
||||
virtual bool isTrustingMe(std::string id) ;
|
||||
virtual void addTrustingPeer(std::string id) ;
|
||||
|
||||
/* High Level Load/Save Configuration */
|
||||
virtual bool FinalSaveCertificates();
|
||||
virtual bool CheckSaveCertificates();
|
||||
|
@ -183,6 +187,7 @@ bool locked_FindCert(std::string id, xpgpcert **cert);
|
|||
bool mConfigSaveActive;
|
||||
std::map<std::string, xpgpcert *> mCerts;
|
||||
|
||||
std::list<std::string> _trusting_peers ;
|
||||
};
|
||||
|
||||
/* Helper Functions */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "pqi/p3authmgr.h"
|
||||
|
||||
pqiAuthDetails::pqiAuthDetails()
|
||||
|
@ -53,6 +54,16 @@ p3DummyAuthMgr::p3DummyAuthMgr()
|
|||
|
||||
}
|
||||
|
||||
bool p3DummyAuthMgr::isTrustingMe(std::string id)
|
||||
{
|
||||
std::cerr << "isTrustingMe is not implemented in p3DummyAuthMgr. Look into authxpgp.cc." << std::endl ;
|
||||
return false ;
|
||||
}
|
||||
void p3DummyAuthMgr::addTrustingPeer(std::string id)
|
||||
{
|
||||
std::cerr << "addTrustingPeer is not implemented in p3DummyAuthMgr. Look into authxpgp.cc." << std::endl ;
|
||||
}
|
||||
|
||||
p3DummyAuthMgr::p3DummyAuthMgr(std::string ownId, std::list<pqiAuthDetails> peers)
|
||||
{
|
||||
mOwnId = ownId;
|
||||
|
|
|
@ -101,6 +101,10 @@ virtual bool CheckSaveCertificates() = 0;
|
|||
virtual bool saveCertificates() = 0;
|
||||
virtual bool loadCertificates() = 0;
|
||||
|
||||
/* first party trust info */
|
||||
virtual bool isTrustingMe(std::string id) = 0;
|
||||
virtual void addTrustingPeer(std::string id) = 0;
|
||||
|
||||
/* Load/Save certificates */
|
||||
|
||||
virtual bool LoadCertificateFromString(std::string pem, std::string &id) = 0;
|
||||
|
@ -170,6 +174,10 @@ virtual bool CheckSaveCertificates();
|
|||
virtual bool saveCertificates();
|
||||
virtual bool loadCertificates();
|
||||
|
||||
/* first party trust info */
|
||||
virtual bool isTrustingMe(std::string id) ;
|
||||
virtual void addTrustingPeer(std::string id) ;
|
||||
|
||||
/* Load/Save certificates */
|
||||
virtual bool LoadCertificateFromString(std::string pem, std::string &id);
|
||||
virtual std::string SaveCertificateToString(std::string id);
|
||||
|
|
|
@ -92,10 +92,11 @@ const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
|
|||
|
||||
/* flags of peerStatus */
|
||||
const uint32_t RS_NET_FLAGS_USE_DISC = 0x0001;
|
||||
const uint32_t RS_NET_FLAGS_USE_DHT = 0x0002;
|
||||
const uint32_t RS_NET_FLAGS_ONLINE = 0x0004;
|
||||
const uint32_t RS_NET_FLAGS_USE_DHT = 0x0002;
|
||||
const uint32_t RS_NET_FLAGS_ONLINE = 0x0004;
|
||||
const uint32_t RS_NET_FLAGS_EXTERNAL_ADDR = 0x0008;
|
||||
const uint32_t RS_NET_FLAGS_STABLE_UDP = 0x0010;
|
||||
const uint32_t RS_NET_FLAGS_TRUSTS_ME = 0x0020;
|
||||
|
||||
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue