mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed bug potentially causing keyring corruption.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6394 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
554234d385
commit
4b21232beb
@ -1617,9 +1617,9 @@ bool PGPHandler::removeKeysFromPGPKeyring(const std::list<PGPIdType>& keys_to_re
|
||||
// Erase the info from the keyring map.
|
||||
//
|
||||
_public_keyring_map.erase(res) ;
|
||||
}
|
||||
|
||||
// now update all indices back
|
||||
// now update all indices back. This internal look is very costly, but it avoids deleting the wrong keys, since the keyring structure is
|
||||
// changed by ops_keyring_remove_key and therefore indices don't point to the correct location anymore.
|
||||
|
||||
int i=0 ;
|
||||
const ops_keydata_t *keydata ;
|
||||
@ -1629,6 +1629,14 @@ bool PGPHandler::removeKeysFromPGPKeyring(const std::list<PGPIdType>& keys_to_re
|
||||
cert._key_index = i ;
|
||||
++i ;
|
||||
}
|
||||
}
|
||||
|
||||
if(_public_keyring_map.size() != _pubring->nkeys)
|
||||
{
|
||||
std::cerr << "Error after removing keys. Operation cancelled." << std::endl;
|
||||
|
||||
// todo
|
||||
}
|
||||
|
||||
// Everything went well, sync back the keyring on disk
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user