mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 04:44:21 -05:00
make it run
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2003 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a0a64fb588
commit
9d53481946
@ -272,8 +272,6 @@ class CachePair
|
|||||||
bool operator<(const CachePair &a, const CachePair &b);
|
bool operator<(const CachePair &a, const CachePair &b);
|
||||||
|
|
||||||
|
|
||||||
class p3AuthMgr;
|
|
||||||
|
|
||||||
class CacheStrapper: public pqiMonitor, public p3Config
|
class CacheStrapper: public pqiMonitor, public p3Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -317,7 +315,6 @@ virtual bool loadList(std::list<RsItem *> load);
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
/* these are static - so shouldn't need mutex */
|
/* these are static - so shouldn't need mutex */
|
||||||
p3AuthMgr *mAuthMgr;
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
|
|
||||||
std::map<uint16_t, CachePair> caches;
|
std::map<uint16_t, CachePair> caches;
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include "pqi/p3cfgmgr.h"
|
#include "pqi/p3cfgmgr.h"
|
||||||
|
|
||||||
class p3ConnectMgr;
|
class p3ConnectMgr;
|
||||||
class p3AuthMgr;
|
|
||||||
|
|
||||||
class CacheStrapper;
|
class CacheStrapper;
|
||||||
class CacheTransfer;
|
class CacheTransfer;
|
||||||
@ -242,7 +241,6 @@ bool loadConfigMap(std::map<std::string, std::string> &configMap);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
P3Interface *mP3iface; /* XXX THIS NEEDS PROTECTION */
|
P3Interface *mP3iface; /* XXX THIS NEEDS PROTECTION */
|
||||||
p3AuthMgr *mAuthMgr;
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
|
|
||||||
ftCacheStrapper *mCacheStrapper;
|
ftCacheStrapper *mCacheStrapper;
|
||||||
|
@ -813,22 +813,33 @@ bool AuthSSL::getCertDetails(SSL_id id, sslcert &cert)
|
|||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
sslcert *tcert = NULL;
|
sslcert *tcert = NULL;
|
||||||
if (id == mOwnId)
|
if (id == mOwnId) {
|
||||||
{
|
cert.authed = mOwnCert->authed;
|
||||||
cert = *mOwnCert;
|
cert.certificate = mOwnCert->certificate;
|
||||||
valid = true;
|
cert.email = mOwnCert->email;
|
||||||
}
|
cert.fpr = mOwnCert->fpr;
|
||||||
else if (locked_FindCert(id, &tcert))
|
cert.id = mOwnCert->id;
|
||||||
{
|
cert.issuer = mOwnCert->issuer;
|
||||||
valid = true;
|
cert.location = mOwnCert->location;
|
||||||
|
cert.name = mOwnCert->name;
|
||||||
|
cert.org = mOwnCert->org;
|
||||||
|
cert.signers = mOwnCert->signers;
|
||||||
|
valid = true;
|
||||||
|
} else if (locked_FindCert(id, &tcert)) {
|
||||||
|
cert.authed = tcert->authed;
|
||||||
|
cert.certificate = tcert->certificate;
|
||||||
|
cert.email = tcert->email;
|
||||||
|
cert.fpr = tcert->fpr;
|
||||||
|
cert.id = tcert->id;
|
||||||
|
cert.issuer = tcert->issuer;
|
||||||
|
cert.location = tcert->location;
|
||||||
|
cert.name = tcert->name;
|
||||||
|
cert.org = tcert->org;
|
||||||
|
cert.signers = tcert->signers;
|
||||||
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid)
|
sslMtx.unlock(); /**** UNLOCK ****/
|
||||||
{
|
|
||||||
cert = *tcert;
|
|
||||||
}
|
|
||||||
|
|
||||||
sslMtx.unlock(); /**** UNLOCK ****/
|
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
@ -2083,7 +2083,7 @@ bool p3ConnectMgr::addFriend(std::string id, uint32_t netMode, uint32_t visState
|
|||||||
peerConnectState pstate;
|
peerConnectState pstate;
|
||||||
|
|
||||||
pstate.id = id;
|
pstate.id = id;
|
||||||
pstate.name = detail.name;
|
pstate.name = detail.name;
|
||||||
|
|
||||||
pstate.state = RS_PEER_S_FRIEND;
|
pstate.state = RS_PEER_S_FRIEND;
|
||||||
pstate.actions = RS_PEER_NEW;
|
pstate.actions = RS_PEER_NEW;
|
||||||
@ -2192,7 +2192,7 @@ bool p3ConnectMgr::addNeighbour(std::string id)
|
|||||||
peerConnectState pstate;
|
peerConnectState pstate;
|
||||||
|
|
||||||
pstate.id = id;
|
pstate.id = id;
|
||||||
pstate.name = detail.name;
|
pstate.name = detail.name;
|
||||||
|
|
||||||
pstate.state = 0;
|
pstate.state = 0;
|
||||||
pstate.actions = 0; //RS_PEER_NEW;
|
pstate.actions = 0; //RS_PEER_NEW;
|
||||||
|
@ -109,7 +109,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3ConnectMgr *cm)
|
|||||||
rslog(RSL_ALERT, pqisslzone, out.str());
|
rslog(RSL_ALERT, pqisslzone, out.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mAuthMgr->isAuthenticated(PeerId())))
|
if (!(AuthSSL::getAuthSSL()->isAuthenticated(PeerId())))
|
||||||
{
|
{
|
||||||
rslog(RSL_ALERT, pqisslzone,
|
rslog(RSL_ALERT, pqisslzone,
|
||||||
"pqissl::Warning Certificate Not Approved!");
|
"pqissl::Warning Certificate Not Approved!");
|
||||||
@ -945,7 +945,7 @@ int pqissl::Initiate_SSL_Connection()
|
|||||||
|
|
||||||
// Perform SSL magic.
|
// Perform SSL magic.
|
||||||
// library already inited by sslroot().
|
// library already inited by sslroot().
|
||||||
SSL *ssl = SSL_new(mAuthMgr->getCTX());
|
SSL *ssl = SSL_new(AuthSSL::getAuthSSL()->getCTX());
|
||||||
if (ssl == NULL)
|
if (ssl == NULL)
|
||||||
{
|
{
|
||||||
rslog(RSL_ALERT, pqisslzone,
|
rslog(RSL_ALERT, pqisslzone,
|
||||||
@ -1089,14 +1089,7 @@ int pqissl::Extract_Failed_SSL_Certificate()
|
|||||||
// we actually connected to remote_addr,
|
// we actually connected to remote_addr,
|
||||||
// which could be
|
// which could be
|
||||||
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
|
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
|
||||||
/**************** PQI_USE_XPGP ******************/
|
AuthSSL::getAuthSSL()->FailedCertificate(peercert, false);
|
||||||
#if defined(PQI_USE_XPGP)
|
|
||||||
mAuthMgr->FailedCertificateXPGP(peercert, false);
|
|
||||||
#else /* X509 Certificates */
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
|
||||||
mAuthMgr->FailedCertificate(peercert, false);
|
|
||||||
#endif /* X509 Certificates */
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1153,7 +1146,7 @@ int pqissl::Authorise_SSL_Connection()
|
|||||||
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
|
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
|
||||||
|
|
||||||
bool certCorrect = false;
|
bool certCorrect = false;
|
||||||
certCorrect = mAuthMgr->CheckCertificate(PeerId(), peercert);
|
certCorrect = AuthSSL::getAuthSSL()->CheckCertificate(PeerId(), peercert);
|
||||||
|
|
||||||
// check it's the right one.
|
// check it's the right one.
|
||||||
if (certCorrect)
|
if (certCorrect)
|
||||||
|
@ -205,20 +205,6 @@ virtual int net_internal_fcntl_nonblock(int fd) { return unix_fcntl_nonblock(fd)
|
|||||||
time_t mTimeoutTS;
|
time_t mTimeoutTS;
|
||||||
bool quietShutdown;
|
bool quietShutdown;
|
||||||
|
|
||||||
/* Need Certificate specific functions here! */
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
|
||||||
#if defined(PQI_USE_XPGP)
|
|
||||||
|
|
||||||
AuthXPGP *mAuthMgr;
|
|
||||||
|
|
||||||
#else /* X509 Certificates */
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
|
||||||
|
|
||||||
AuthSSL *mAuthMgr;
|
|
||||||
|
|
||||||
#endif /* X509 Certificates */
|
|
||||||
/**************** PQI_USE_XPGP ******************/
|
|
||||||
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -59,8 +59,7 @@ pqissllistenbase::pqissllistenbase(struct sockaddr_in addr, p3ConnectMgr *cm)
|
|||||||
:laddr(addr), active(false), mConnMgr(cm)
|
:laddr(addr), active(false), mConnMgr(cm)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!(mAuthMgr -> active()))
|
if (!(AuthSSL::getAuthSSL()-> active())) {
|
||||||
{
|
|
||||||
pqioutput(PQL_ALERT, pqissllistenzone,
|
pqioutput(PQL_ALERT, pqissllistenzone,
|
||||||
"SSL-CTX-CERT-ROOT not initialised!");
|
"SSL-CTX-CERT-ROOT not initialised!");
|
||||||
|
|
||||||
@ -346,7 +345,7 @@ int pqissllistenbase::acceptconnection()
|
|||||||
// Negotiate certificates. SSL stylee.
|
// Negotiate certificates. SSL stylee.
|
||||||
// Allow negotiations for secure transaction.
|
// Allow negotiations for secure transaction.
|
||||||
|
|
||||||
SSL *ssl = SSL_new(mAuthMgr -> getCTX());
|
SSL *ssl = SSL_new(AuthSSL::getAuthSSL() -> getCTX());
|
||||||
SSL_set_fd(ssl, fd);
|
SSL_set_fd(ssl, fd);
|
||||||
|
|
||||||
return continueSSL(ssl, remote_addr, true); // continue and save if incomplete.
|
return continueSSL(ssl, remote_addr, true); // continue and save if incomplete.
|
||||||
@ -477,7 +476,7 @@ int pqissllistenbase::Extract_Failed_SSL_Certificate(SSL *ssl, struct sockaddr_
|
|||||||
|
|
||||||
// save certificate... (and ip locations)
|
// save certificate... (and ip locations)
|
||||||
// false for outgoing....
|
// false for outgoing....
|
||||||
mAuthMgr->FailedCertificate(peercert, true);
|
AuthSSL::getAuthSSL()->FailedCertificate(peercert, true);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -630,7 +629,7 @@ int pqissllistener::completeConnection(int fd, SSL *ssl, struct sockaddr_in &rem
|
|||||||
* we should only need to call CheckCertificate here!
|
* we should only need to call CheckCertificate here!
|
||||||
****/
|
****/
|
||||||
|
|
||||||
bool certOk = mAuthMgr->ValidateCertificate(peercert, newPeerId);
|
bool certOk = AuthSSL::getAuthSSL()->ValidateCertificate(peercert, newPeerId);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
std::map<std::string, pqissl *>::iterator it;
|
std::map<std::string, pqissl *>::iterator it;
|
||||||
@ -685,7 +684,7 @@ int pqissllistener::completeConnection(int fd, SSL *ssl, struct sockaddr_in &rem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Certificate consumed! */
|
/* Certificate consumed! */
|
||||||
bool certKnown = mAuthMgr->CheckCertificate(it->first, peercert);
|
bool certKnown = AuthSSL::getAuthSSL()->CheckCertificate(it->first, peercert);
|
||||||
|
|
||||||
if (certKnown == false)
|
if (certKnown == false)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,6 @@ int Extract_Failed_SSL_Certificate(SSL *ssl, struct sockaddr_in *inaddr);
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
AuthSSL *mAuthMgr;
|
|
||||||
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -102,7 +102,7 @@ pqissltunnel::pqissltunnel(PQInterface *parent, p3ConnectMgr *cm)
|
|||||||
rslog(RSL_ALERT, pqisslzone, out.str());
|
rslog(RSL_ALERT, pqisslzone, out.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mAuthMgr->isAuthenticated(PeerId()))) {
|
if (!(AuthSSL::getAuthSSL()->isAuthenticated(PeerId()))) {
|
||||||
rslog(RSL_ALERT, pqisslzone,
|
rslog(RSL_ALERT, pqisslzone,
|
||||||
"pqissltunnel::Warning Certificate Not Approved!");
|
"pqissltunnel::Warning Certificate Not Approved!");
|
||||||
rslog(RSL_ALERT, pqisslzone,
|
rslog(RSL_ALERT, pqisslzone,
|
||||||
@ -470,7 +470,7 @@ int pqissltunnel::senddata(void *data, int len)
|
|||||||
item->connection_accepted = 1;
|
item->connection_accepted = 1;
|
||||||
|
|
||||||
int oulen;
|
int oulen;
|
||||||
if (!mAuthMgr->encrypt(item->encoded_data, oulen, data, len, parent()->PeerId())) {
|
if (!AuthSSL::getAuthSSL()->encrypt(item->encoded_data, oulen, data, len, parent()->PeerId())) {
|
||||||
std::cerr << "pqissltunnel::readdata() problem while crypting packet, ignoring it." << std::endl;
|
std::cerr << "pqissltunnel::readdata() problem while crypting packet, ignoring it." << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ int pqissltunnel::readdata(void *data, int len)
|
|||||||
//let's read a new packet
|
//let's read a new packet
|
||||||
current_data_offset = 0;
|
current_data_offset = 0;
|
||||||
//decrypt one packet from the queue and put it into the current data packet.
|
//decrypt one packet from the queue and put it into the current data packet.
|
||||||
if (!mAuthMgr->decrypt(curent_data_packet.data, curent_data_packet.length, data_packet_queue.back().data, data_packet_queue.back().length)) {
|
if (!AuthSSL::getAuthSSL()->decrypt(curent_data_packet.data, curent_data_packet.length, data_packet_queue.back().data, data_packet_queue.back().length)) {
|
||||||
std::cerr << "pqissltunnel::readdata() problem while decrypting packet, ignoring it." << std::endl;
|
std::cerr << "pqissltunnel::readdata() problem while decrypting packet, ignoring it." << std::endl;
|
||||||
curent_data_packet.length = 0;
|
curent_data_packet.length = 0;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -128,8 +128,6 @@ private:
|
|||||||
/* Need Certificate specific functions here! */
|
/* Need Certificate specific functions here! */
|
||||||
time_t mConnectTS;
|
time_t mConnectTS;
|
||||||
|
|
||||||
AuthSSL *mAuthMgr;
|
|
||||||
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
|
|
||||||
p3tunnel *mP3tunnel;
|
p3tunnel *mP3tunnel;
|
||||||
|
@ -161,7 +161,6 @@ class RsServer: public RsControl, public RsThread
|
|||||||
ftServer *ftserver;
|
ftServer *ftserver;
|
||||||
|
|
||||||
p3ConnectMgr *mConnMgr;
|
p3ConnectMgr *mConnMgr;
|
||||||
p3AuthMgr *mAuthMgr;
|
|
||||||
|
|
||||||
pqipersongrp *pqih;
|
pqipersongrp *pqih;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "rsiface/rsmsgs.h"
|
#include "rsiface/rsmsgs.h"
|
||||||
|
|
||||||
class p3AuthMgr;
|
|
||||||
class p3MsgService;
|
class p3MsgService;
|
||||||
class p3ChatService;
|
class p3ChatService;
|
||||||
|
|
||||||
@ -38,8 +37,8 @@ class p3Msgs: public RsMsgs
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
p3Msgs(p3AuthMgr *p3a, p3MsgService *p3m, p3ChatService *p3c)
|
p3Msgs(p3MsgService *p3m, p3ChatService *p3c)
|
||||||
:mAuthMgr(p3a), mMsgSrv(p3m), mChatSrv(p3c) { return; }
|
:mMsgSrv(p3m), mChatSrv(p3c) { return; }
|
||||||
virtual ~p3Msgs() { return; }
|
virtual ~p3Msgs() { return; }
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
@ -78,7 +77,6 @@ class p3Msgs: public RsMsgs
|
|||||||
|
|
||||||
void initRsChatInfo(RsChatMsgItem *c, ChatInfo &i);
|
void initRsChatInfo(RsChatMsgItem *c, ChatInfo &i);
|
||||||
|
|
||||||
p3AuthMgr *mAuthMgr;
|
|
||||||
p3MsgService *mMsgSrv;
|
p3MsgService *mMsgSrv;
|
||||||
p3ChatService *mChatSrv;
|
p3ChatService *mChatSrv;
|
||||||
};
|
};
|
||||||
|
@ -308,15 +308,15 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
d.fpr = authDetail.fpr;
|
d.fpr = authDetail.fpr;
|
||||||
d.id = authDetail.id;
|
d.id = authDetail.id;
|
||||||
d.name = authDetail.name;
|
d.name = authDetail.name;
|
||||||
d.email = authDetail.email;
|
d.email = authDetail.email;
|
||||||
d.location = authDetail.location;
|
d.location = authDetail.location;
|
||||||
d.org = authDetail.org;
|
d.org = authDetail.org;
|
||||||
d.signers = authDetail.signers;
|
d.signers = authDetail.signers;
|
||||||
|
|
||||||
d.issuer = authDetail.issuer;
|
d.issuer = authDetail.issuer;
|
||||||
|
|
||||||
d.trusted = AuthGPG::getAuthGPG()->isPGPAuthenticated(AuthSSL::getAuthSSL()->getGPGId(id));
|
d.trusted = AuthGPG::getAuthGPG()->isPGPAuthenticated(AuthSSL::getAuthSSL()->getGPGId(id));
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
|
|||||||
|
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::getPGPFriendList() Cert Id: " << *it;
|
std::cerr << "p3Peers::getPGPFriendList() Cert Id: " << *it;
|
||||||
std::cerr << " Issuer: " << detail.issuer;
|
std::cerr << " Issuer: " << detail.issuer;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -520,16 +520,16 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ids.end() == std::find(ids.begin(),ids.end(),detail.issuer))
|
if (ids.end() == std::find(ids.begin(),ids.end(),detail.issuer))
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::getPGPFriendList() Adding Friend: ";
|
std::cerr << "p3Peers::getPGPFriendList() Adding Friend: ";
|
||||||
std::cerr << detail.issuer;
|
std::cerr << detail.issuer;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ids.push_back(detail.issuer);
|
ids.push_back(detail.issuer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2133,7 +2133,7 @@ int RsServer::StartupRetroShare()
|
|||||||
/* Setup GUI Interfaces. */
|
/* Setup GUI Interfaces. */
|
||||||
|
|
||||||
rsPeers = new p3Peers(mConnMgr);
|
rsPeers = new p3Peers(mConnMgr);
|
||||||
rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv);
|
rsMsgs = new p3Msgs(msgSrv, chatSrv);
|
||||||
rsDisc = new p3Discovery(ad);
|
rsDisc = new p3Discovery(ad);
|
||||||
|
|
||||||
rsForums = mForums;
|
rsForums = mForums;
|
||||||
|
@ -390,7 +390,6 @@ bool groupsChanged(std::list<std::string> &groupIds);
|
|||||||
|
|
||||||
RsMutex distribMtx; /* Protects All Data Below */
|
RsMutex distribMtx; /* Protects All Data Below */
|
||||||
std::string mOwnId;
|
std::string mOwnId;
|
||||||
p3AuthMgr *mAuthMgr;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@
|
|||||||
#include "rsturtleitem.h"
|
#include "rsturtleitem.h"
|
||||||
|
|
||||||
class ftServer ;
|
class ftServer ;
|
||||||
class p3AuthMgr;
|
|
||||||
class p3ConnectMgr;
|
class p3ConnectMgr;
|
||||||
class ftDataMultiplex;
|
class ftDataMultiplex;
|
||||||
class RsSerialiser;
|
class RsSerialiser;
|
||||||
|
Loading…
Reference in New Issue
Block a user