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

@ -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;