implement the remove friend for gpg key, and improve the tranfer of ip address from a dummy peer to a normal peer

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2024 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-13 21:32:05 +00:00
parent 018b84a1e1
commit 54c7f8b81a
6 changed files with 40 additions and 15 deletions

View file

@ -2186,13 +2186,9 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
std::string certId;
getX509id(X509_STORE_CTX_get_current_cert(ctx), certId);
if (!mConnMgr->isFriend(certId)) {
//we've got a new ssl id, let's add it as a friend
mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer));
//we've got a new ssl id
preverify_ok = false;
}
//set location
mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject));
//is the connection was initiated by us, then it was for a specific peer id wich is stored is in the context
//check that the peerid in the context is the same as the cert one
@ -2207,12 +2203,20 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx)
//tranfer the ip address to the new peer
peerConnectState detail;
if (mConnMgr->getFriendNetStatus(peer_id_in_context, detail)) {
mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer));
mConnMgr->setAddressList(certId, detail.getIpAddressList());
}
} else {
fprintf(stderr, "AuthSSL::VerifyX509Callback peer id in context is the same as cert, continung connection.");
}
}
//just to be sure
mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer));
//set location
mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject));
}
if (preverify_ok) {

View file

@ -621,8 +621,13 @@ bool p3Peers::removeFriend(std::string id)
std::cerr << "p3Peers::removeFriend() " << id;
std::cerr << std::endl;
#endif
//will remove if it's a gpg id
AuthGPG::getAuthGPG()->setAcceptToConnectGPGCertificate(id, false);
//will remove if it's a ssl id
mConnMgr->removeFriend(id);
return true;
return mConnMgr->removeFriend(id);
}
/* Network Stuff */