Don't fail if the CE key isn't loaded in destroy_user_key

Users don't have to be unlocked to be deleted, so don't worry if we
don't have their key to evict.

Bug: 26847403
Bug: 27441228
Change-Id: Ifd93f620926630aa102a3bb4a5d2d45d34f9b75d
gugelfrei
Paul Crowley 8 years ago
parent 0323afd69d
commit 71ee662ec3

@ -443,7 +443,10 @@ bool e4crypt_destroy_user_key(userid_t user_id) {
bool success = true;
s_ce_keys.erase(user_id);
std::string raw_ref;
success &= lookup_key_ref(s_ce_key_raw_refs, user_id, &raw_ref) && evict_key(raw_ref);
// If we haven't loaded the CE key, no need to evict it.
if (lookup_key_ref(s_ce_key_raw_refs, user_id, &raw_ref)) {
success &= evict_key(raw_ref);
}
s_ce_key_raw_refs.erase(user_id);
success &= lookup_key_ref(s_de_key_raw_refs, user_id, &raw_ref) && evict_key(raw_ref);
s_de_key_raw_refs.erase(user_id);

Loading…
Cancel
Save