Browse Source

ENGINE-409: fixed key_reset_trust

doc_update_sequoia
Krista Bennett 4 years ago
parent
commit
6fe4ffb5e9
2 changed files with 21 additions and 10 deletions
  1. +13
    -6
      src/keymanagement.c
  2. +8
    -4
      src/pEpEngine.c

+ 13
- 6
src/keymanagement.c View File

@ -1253,12 +1253,19 @@ DYNAMIC_API PEP_STATUS key_reset_trust(
goto pep_free;
PEP_comm_type new_trust = PEP_ct_unknown;
status = get_key_rating(session, ident->fpr, &new_trust);
if (status != PEP_STATUS_OK)
goto pep_free;
if (input_copy->comm_type != PEP_ct_mistrusted)
new_trust = input_copy->comm_type & ~PEP_ct_confirmed;
// We'll return the status from the input_copy cache afterward
input_copy->comm_type = new_trust;
bool pep_user = false;
status = is_pep_user(session, ident, &pep_user);
if (pep_user && new_trust >= PEP_ct_unconfirmed_encryption)
input_copy->comm_type = PEP_ct_pEp_unconfirmed;
else
input_copy->comm_type = new_trust;
status = set_trust(session, input_copy);
if (status != PEP_STATUS_OK)
@ -1298,7 +1305,7 @@ DYNAMIC_API PEP_STATUS key_reset_trust(
}
char* user_default = NULL;
status = get_main_user_fpr(session, tmp_ident->user_id, &user_default);
get_main_user_fpr(session, tmp_ident->user_id, &user_default);
if (!EMPTYSTR(user_default)) {
if (strcmp(user_default, ident->fpr) == 0)


+ 8
- 4
src/pEpEngine.c View File

@ -418,7 +418,7 @@ static const char *sql_add_mistrusted_key =
" values (upper(replace(?1,' ',''))) ;";
static const char *sql_delete_mistrusted_key =
"delete from blacklist_keys where fpr = upper(replace(?1,' ','')) ;";
"delete from mistrusted_keys where fpr = upper(replace(?1,' ','')) ;";
static const char *sql_is_mistrusted_key =
"select count(*) from mistrusted_keys where fpr = upper(replace(?1,' ','')) ;";
@ -2908,10 +2908,14 @@ PEP_STATUS get_main_user_fpr(PEP_SESSION session,
case SQLITE_ROW: {
const char* _fpr =
(const char *) sqlite3_column_text(session->get_main_user_fpr, 0);
if (_fpr)
if (_fpr) {
*main_fpr = strdup(_fpr);
if (!(*main_fpr))
status = PEP_OUT_OF_MEMORY;
if (!(*main_fpr))
status = PEP_OUT_OF_MEMORY;
}
else {
status = PEP_KEY_NOT_FOUND;
}
break;
}
default:


Loading…
Cancel
Save