improve the recieving of bad gpg keys

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2556 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-03-15 19:13:43 +00:00
parent 928a06c17e
commit e9d42e1965
2 changed files with 16 additions and 3 deletions

View File

@ -1179,17 +1179,25 @@ bool AuthGPG::LoadCertificateFromString(std::string str, std::string &gpg_id)
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
if (str == "") {
#ifdef GPG_DEBUG
std::cerr << "AuthGPG::LoadCertificateFromString() cert is empty string, returning false." << std::endl;
#endif
return false;
}
//std::string cleancert = cleanUpCertificate(str); disable for p3disc message on windows system. Move the clean cert in p3peers
std::string cleancert = str;
#ifdef GPG_DEBUG
#ifdef GPG_DEBUG
std::cerr << "AuthGPG::LoadCertificateFromString() cleancert : " << cleancert;
#endif
#endif
gpgme_data_t gpgmeData;
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, cleancert.c_str(), cleancert.length(), 1))
{
std::cerr << "Error create Data" << std::endl;
return false;
}
/* move string data to gpgmeData */

View File

@ -506,7 +506,12 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId() << " About " << item->aboutId << std::endl;
#endif
std::string certGpgId;
AuthGPG::getAuthGPG()->LoadCertificateFromString(item->certGPG, certGpgId);
if (!AuthGPG::getAuthGPG()->LoadCertificateFromString(item->certGPG, certGpgId)) {
#ifdef P3DISC_DEBUG
std::cerr << "p3disc::recvPeerFriendMsg() gpg cert is not good, aborting" << std::endl;
#endif
return;
}
if (item->aboutId != certGpgId) {
#ifdef P3DISC_DEBUG
std::cerr << "p3disc::recvPeerFriendMsg() Error : about id is not the same as gpg id." << std::endl;