diff --git a/libretroshare/src/dbase/cachestrapper.h b/libretroshare/src/dbase/cachestrapper.h index 2ca6f72e0..9c0c45f3e 100644 --- a/libretroshare/src/dbase/cachestrapper.h +++ b/libretroshare/src/dbase/cachestrapper.h @@ -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 load); private: /* these are static - so shouldn't need mutex */ - p3AuthMgr *mAuthMgr; p3ConnectMgr *mConnMgr; std::map caches; diff --git a/libretroshare/src/ft/ftserver.h b/libretroshare/src/ft/ftserver.h index 0e1720de0..fb25b128c 100644 --- a/libretroshare/src/ft/ftserver.h +++ b/libretroshare/src/ft/ftserver.h @@ -51,7 +51,6 @@ #include "pqi/p3cfgmgr.h" class p3ConnectMgr; -class p3AuthMgr; class CacheStrapper; class CacheTransfer; @@ -242,7 +241,6 @@ bool loadConfigMap(std::map &configMap); */ P3Interface *mP3iface; /* XXX THIS NEEDS PROTECTION */ - p3AuthMgr *mAuthMgr; p3ConnectMgr *mConnMgr; ftCacheStrapper *mCacheStrapper; diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 60be47615..bf653d9a7 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -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; } diff --git a/libretroshare/src/pqi/p3connmgr.cc b/libretroshare/src/pqi/p3connmgr.cc index 9c7de1658..4c2538e79 100644 --- a/libretroshare/src/pqi/p3connmgr.cc +++ b/libretroshare/src/pqi/p3connmgr.cc @@ -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; diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 195d76346..fbfbe7f3e 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -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) diff --git a/libretroshare/src/pqi/pqissl.h b/libretroshare/src/pqi/pqissl.h index 6cfe88772..e784e545a 100644 --- a/libretroshare/src/pqi/pqissl.h +++ b/libretroshare/src/pqi/pqissl.h @@ -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: diff --git a/libretroshare/src/pqi/pqissllistener.cc b/libretroshare/src/pqi/pqissllistener.cc index b02ea35fd..ebc3e35e8 100644 --- a/libretroshare/src/pqi/pqissllistener.cc +++ b/libretroshare/src/pqi/pqissllistener.cc @@ -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::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) { diff --git a/libretroshare/src/pqi/pqissllistener.h b/libretroshare/src/pqi/pqissllistener.h index 2446f0199..59edc8522 100644 --- a/libretroshare/src/pqi/pqissllistener.h +++ b/libretroshare/src/pqi/pqissllistener.h @@ -88,8 +88,6 @@ int Extract_Failed_SSL_Certificate(SSL *ssl, struct sockaddr_in *inaddr); protected: - AuthSSL *mAuthMgr; - p3ConnectMgr *mConnMgr; }; diff --git a/libretroshare/src/pqi/pqissltunnel.cc b/libretroshare/src/pqi/pqissltunnel.cc index 96cc2be9f..7f18ae214 100644 --- a/libretroshare/src/pqi/pqissltunnel.cc +++ b/libretroshare/src/pqi/pqissltunnel.cc @@ -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; diff --git a/libretroshare/src/pqi/pqissltunnel.h b/libretroshare/src/pqi/pqissltunnel.h index 5006e067f..e2189912a 100644 --- a/libretroshare/src/pqi/pqissltunnel.h +++ b/libretroshare/src/pqi/pqissltunnel.h @@ -128,8 +128,6 @@ private: /* Need Certificate specific functions here! */ time_t mConnectTS; - AuthSSL *mAuthMgr; - p3ConnectMgr *mConnMgr; p3tunnel *mP3tunnel; diff --git a/libretroshare/src/rsserver/p3face.h b/libretroshare/src/rsserver/p3face.h index 87692463a..0dfcfbbbc 100644 --- a/libretroshare/src/rsserver/p3face.h +++ b/libretroshare/src/rsserver/p3face.h @@ -161,7 +161,6 @@ class RsServer: public RsControl, public RsThread ftServer *ftserver; p3ConnectMgr *mConnMgr; - p3AuthMgr *mAuthMgr; pqipersongrp *pqih; diff --git a/libretroshare/src/rsserver/p3msgs.h b/libretroshare/src/rsserver/p3msgs.h index 2fb60903a..bc81fec34 100644 --- a/libretroshare/src/rsserver/p3msgs.h +++ b/libretroshare/src/rsserver/p3msgs.h @@ -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; }; diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 8dbf93205..662f765c9 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -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 &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 &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; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 5859489c3..e9938f20f 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -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; diff --git a/libretroshare/src/services/p3distrib.h b/libretroshare/src/services/p3distrib.h index 34a670ca8..388bca9f0 100644 --- a/libretroshare/src/services/p3distrib.h +++ b/libretroshare/src/services/p3distrib.h @@ -390,7 +390,6 @@ bool groupsChanged(std::list &groupIds); RsMutex distribMtx; /* Protects All Data Below */ std::string mOwnId; - p3AuthMgr *mAuthMgr; private: diff --git a/libretroshare/src/turtle/p3turtle.h b/libretroshare/src/turtle/p3turtle.h index 5c2d9f452..341f1777c 100644 --- a/libretroshare/src/turtle/p3turtle.h +++ b/libretroshare/src/turtle/p3turtle.h @@ -153,7 +153,6 @@ #include "rsturtleitem.h" class ftServer ; -class p3AuthMgr; class p3ConnectMgr; class ftDataMultiplex; class RsSerialiser;