mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-20 12:21:37 -05:00
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:
parent
928a06c17e
commit
e9d42e1965
@ -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 */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user