improve the recieving of bad gpg keys

Conflicts:

	libretroshare/src/services/p3disc.cc

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2555 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-03-15 19:11:33 +00:00
parent f5a616519c
commit 0fd8b4d4ee
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 ******/ 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 = cleanUpCertificate(str); disable for p3disc message on windows system. Move the clean cert in p3peers
std::string cleancert = str; std::string cleancert = str;
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "AuthGPG::LoadCertificateFromString() cleancert : " << cleancert; std::cerr << "AuthGPG::LoadCertificateFromString() cleancert : " << cleancert;
#endif #endif
gpgme_data_t gpgmeData; gpgme_data_t gpgmeData;
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, cleancert.c_str(), cleancert.length(), 1)) if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, cleancert.c_str(), cleancert.length(), 1))
{ {
std::cerr << "Error create Data" << std::endl; std::cerr << "Error create Data" << std::endl;
return false;
} }
/* move string data to gpgmeData */ /* move string data to gpgmeData */

View File

@ -509,7 +509,12 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId() << " About " << item->aboutId << std::endl; std::cerr << "p3disc::recvPeerFriendMsg() From: " << item->PeerId() << " About " << item->aboutId << std::endl;
#endif #endif
std::string certGpgId; 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 == "" || item->aboutId != certGpgId) { if (item->aboutId == "" || item->aboutId != certGpgId) {
#ifdef P3DISC_DEBUG #ifdef P3DISC_DEBUG
std::cerr << "p3disc::recvPeerFriendMsg() Error : about id is not the same as gpg id." << std::endl; std::cerr << "p3disc::recvPeerFriendMsg() Error : about id is not the same as gpg id." << std::endl;