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:
joss17 2010-01-13 21:01:06 +00:00
parent a0a64fb588
commit 9d53481946
16 changed files with 54 additions and 79 deletions

View File

@ -272,8 +272,6 @@ class CachePair
bool operator<(const CachePair &a, const CachePair &b);
class p3AuthMgr;
class CacheStrapper: public pqiMonitor, public p3Config
{
public:
@ -317,7 +315,6 @@ virtual bool loadList(std::list<RsItem *> load);
private:
/* these are static - so shouldn't need mutex */
p3AuthMgr *mAuthMgr;
p3ConnectMgr *mConnMgr;
std::map<uint16_t, CachePair> caches;

View File

@ -51,7 +51,6 @@
#include "pqi/p3cfgmgr.h"
class p3ConnectMgr;
class p3AuthMgr;
class CacheStrapper;
class CacheTransfer;
@ -242,7 +241,6 @@ bool loadConfigMap(std::map<std::string, std::string> &configMap);
*/
P3Interface *mP3iface; /* XXX THIS NEEDS PROTECTION */
p3AuthMgr *mAuthMgr;
p3ConnectMgr *mConnMgr;
ftCacheStrapper *mCacheStrapper;

View File

@ -813,22 +813,33 @@ bool AuthSSL::getCertDetails(SSL_id id, sslcert &cert)
bool valid = false;
sslcert *tcert = NULL;
if (id == mOwnId)
{
cert = *mOwnCert;
valid = true;
}
else if (locked_FindCert(id, &tcert))
{
valid = true;
if (id == mOwnId) {
cert.authed = mOwnCert->authed;
cert.certificate = mOwnCert->certificate;
cert.email = mOwnCert->email;
cert.fpr = mOwnCert->fpr;
cert.id = mOwnCert->id;
cert.issuer = mOwnCert->issuer;
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)
{
cert = *tcert;
}
sslMtx.unlock(); /**** UNLOCK ****/
sslMtx.unlock(); /**** UNLOCK ****/
return valid;
}

View File

@ -2083,7 +2083,7 @@ bool p3ConnectMgr::addFriend(std::string id, uint32_t netMode, uint32_t visState
peerConnectState pstate;
pstate.id = id;
pstate.name = detail.name;
pstate.name = detail.name;
pstate.state = RS_PEER_S_FRIEND;
pstate.actions = RS_PEER_NEW;
@ -2192,7 +2192,7 @@ bool p3ConnectMgr::addNeighbour(std::string id)
peerConnectState pstate;
pstate.id = id;
pstate.name = detail.name;
pstate.name = detail.name;
pstate.state = 0;
pstate.actions = 0; //RS_PEER_NEW;

View File

@ -109,7 +109,7 @@ pqissl::pqissl(pqissllistener *l, PQInterface *parent, p3ConnectMgr *cm)
rslog(RSL_ALERT, pqisslzone, out.str());
}
if (!(mAuthMgr->isAuthenticated(PeerId())))
if (!(AuthSSL::getAuthSSL()->isAuthenticated(PeerId())))
{
rslog(RSL_ALERT, pqisslzone,
"pqissl::Warning Certificate Not Approved!");
@ -945,7 +945,7 @@ int pqissl::Initiate_SSL_Connection()
// Perform SSL magic.
// library already inited by sslroot().
SSL *ssl = SSL_new(mAuthMgr->getCTX());
SSL *ssl = SSL_new(AuthSSL::getAuthSSL()->getCTX());
if (ssl == NULL)
{
rslog(RSL_ALERT, pqisslzone,
@ -1089,14 +1089,7 @@ int pqissl::Extract_Failed_SSL_Certificate()
// we actually connected to remote_addr,
// which could be
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
/**************** PQI_USE_XPGP ******************/
#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 ******************/
AuthSSL::getAuthSSL()->FailedCertificate(peercert, false);
return 1;
}
@ -1153,7 +1146,7 @@ int pqissl::Authorise_SSL_Connection()
// (pqissl's case) sslcert->serveraddr or sslcert->localaddr.
bool certCorrect = false;
certCorrect = mAuthMgr->CheckCertificate(PeerId(), peercert);
certCorrect = AuthSSL::getAuthSSL()->CheckCertificate(PeerId(), peercert);
// check it's the right one.
if (certCorrect)

View File

@ -205,20 +205,6 @@ virtual int net_internal_fcntl_nonblock(int fd) { return unix_fcntl_nonblock(fd)
time_t mTimeoutTS;
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;
private:

View File

@ -59,8 +59,7 @@ pqissllistenbase::pqissllistenbase(struct sockaddr_in addr, p3ConnectMgr *cm)
:laddr(addr), active(false), mConnMgr(cm)
{
if (!(mAuthMgr -> active()))
{
if (!(AuthSSL::getAuthSSL()-> active())) {
pqioutput(PQL_ALERT, pqissllistenzone,
"SSL-CTX-CERT-ROOT not initialised!");
@ -346,7 +345,7 @@ int pqissllistenbase::acceptconnection()
// Negotiate certificates. SSL stylee.
// Allow negotiations for secure transaction.
SSL *ssl = SSL_new(mAuthMgr -> getCTX());
SSL *ssl = SSL_new(AuthSSL::getAuthSSL() -> getCTX());
SSL_set_fd(ssl, fd);
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)
// false for outgoing....
mAuthMgr->FailedCertificate(peercert, true);
AuthSSL::getAuthSSL()->FailedCertificate(peercert, true);
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!
****/
bool certOk = mAuthMgr->ValidateCertificate(peercert, newPeerId);
bool certOk = AuthSSL::getAuthSSL()->ValidateCertificate(peercert, newPeerId);
bool found = false;
std::map<std::string, pqissl *>::iterator it;
@ -685,7 +684,7 @@ int pqissllistener::completeConnection(int fd, SSL *ssl, struct sockaddr_in &rem
}
/* Certificate consumed! */
bool certKnown = mAuthMgr->CheckCertificate(it->first, peercert);
bool certKnown = AuthSSL::getAuthSSL()->CheckCertificate(it->first, peercert);
if (certKnown == false)
{

View File

@ -88,8 +88,6 @@ int Extract_Failed_SSL_Certificate(SSL *ssl, struct sockaddr_in *inaddr);
protected:
AuthSSL *mAuthMgr;
p3ConnectMgr *mConnMgr;
};

View File

@ -102,7 +102,7 @@ pqissltunnel::pqissltunnel(PQInterface *parent, p3ConnectMgr *cm)
rslog(RSL_ALERT, pqisslzone, out.str());
}
if (!(mAuthMgr->isAuthenticated(PeerId()))) {
if (!(AuthSSL::getAuthSSL()->isAuthenticated(PeerId()))) {
rslog(RSL_ALERT, pqisslzone,
"pqissltunnel::Warning Certificate Not Approved!");
rslog(RSL_ALERT, pqisslzone,
@ -470,7 +470,7 @@ int pqissltunnel::senddata(void *data, int len)
item->connection_accepted = 1;
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;
return -1;
}
@ -499,7 +499,7 @@ int pqissltunnel::readdata(void *data, int len)
//let's read a new packet
current_data_offset = 0;
//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;
curent_data_packet.length = 0;
return -1;

View File

@ -128,8 +128,6 @@ private:
/* Need Certificate specific functions here! */
time_t mConnectTS;
AuthSSL *mAuthMgr;
p3ConnectMgr *mConnMgr;
p3tunnel *mP3tunnel;

View File

@ -161,7 +161,6 @@ class RsServer: public RsControl, public RsThread
ftServer *ftserver;
p3ConnectMgr *mConnMgr;
p3AuthMgr *mAuthMgr;
pqipersongrp *pqih;

View File

@ -28,7 +28,6 @@
#include "rsiface/rsmsgs.h"
class p3AuthMgr;
class p3MsgService;
class p3ChatService;
@ -38,8 +37,8 @@ class p3Msgs: public RsMsgs
{
public:
p3Msgs(p3AuthMgr *p3a, p3MsgService *p3m, p3ChatService *p3c)
:mAuthMgr(p3a), mMsgSrv(p3m), mChatSrv(p3c) { return; }
p3Msgs(p3MsgService *p3m, p3ChatService *p3c)
:mMsgSrv(p3m), mChatSrv(p3c) { return; }
virtual ~p3Msgs() { return; }
/****************************************/
@ -78,7 +77,6 @@ class p3Msgs: public RsMsgs
void initRsChatInfo(RsChatMsgItem *c, ChatInfo &i);
p3AuthMgr *mAuthMgr;
p3MsgService *mMsgSrv;
p3ChatService *mChatSrv;
};

View File

@ -308,15 +308,15 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
return false;
}
d.fpr = authDetail.fpr;
d.id = authDetail.id;
d.name = authDetail.name;
d.email = authDetail.email;
d.location = authDetail.location;
d.org = authDetail.org;
d.signers = authDetail.signers;
d.fpr = authDetail.fpr;
d.id = authDetail.id;
d.name = authDetail.name;
d.email = authDetail.email;
d.location = authDetail.location;
d.org = authDetail.org;
d.signers = authDetail.signers;
d.issuer = authDetail.issuer;
d.issuer = authDetail.issuer;
d.trusted = AuthGPG::getAuthGPG()->isPGPAuthenticated(AuthSSL::getAuthSSL()->getGPGId(id));
@ -509,7 +509,7 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getPGPFriendList() Cert Id: " << *it;
std::cerr << " Issuer: " << detail.issuer;
std::cerr << " Issuer: " << detail.issuer;
std::cerr << std::endl;
#endif
@ -520,16 +520,16 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
}
#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
std::cerr << "p3Peers::getPGPFriendList() Adding Friend: ";
std::cerr << detail.issuer;
std::cerr << detail.issuer;
std::cerr << std::endl;
#endif
ids.push_back(detail.issuer);
ids.push_back(detail.issuer);
}
}
return true;

View File

@ -2133,7 +2133,7 @@ int RsServer::StartupRetroShare()
/* Setup GUI Interfaces. */
rsPeers = new p3Peers(mConnMgr);
rsMsgs = new p3Msgs(mAuthMgr, msgSrv, chatSrv);
rsMsgs = new p3Msgs(msgSrv, chatSrv);
rsDisc = new p3Discovery(ad);
rsForums = mForums;

View File

@ -390,7 +390,6 @@ bool groupsChanged(std::list<std::string> &groupIds);
RsMutex distribMtx; /* Protects All Data Below */
std::string mOwnId;
p3AuthMgr *mAuthMgr;
private:

View File

@ -153,7 +153,6 @@
#include "rsturtleitem.h"
class ftServer ;
class p3AuthMgr;
class p3ConnectMgr;
class ftDataMultiplex;
class RsSerialiser;