Browse Source

ENGINE-254: ENGINE-266: undo function now in pEpEngine for last mistrust action

doc_update_sequoia
Krista Bennett 5 years ago
parent
commit
c550cdb776
4 changed files with 50 additions and 2 deletions
  1. +26
    -0
      src/keymanagement.c
  2. +20
    -2
      src/keymanagement.h
  3. +1
    -0
      src/pEpEngine.h
  4. +3
    -0
      src/pEp_internal.h

+ 26
- 0
src/keymanagement.c View File

@ -723,12 +723,38 @@ DYNAMIC_API PEP_STATUS key_mistrusted(
}
else
{
// for undo
if (session->cached_mistrusted)
free(session->cached_mistrusted);
session->cached_mistrusted = identity_dup(ident);
status = mark_as_compromized(session, ident->fpr);
}
return status;
}
DYNAMIC_API PEP_STATUS undo_last_mistrust(PEP_SESSION session) {
assert(session);
if (!session)
return PEP_ILLEGAL_VALUE;
PEP_STATUS status = PEP_STATUS_OK;
pEp_identity* cached_ident = session->cached_mistrusted;
if (!cached_ident)
status = PEP_CANNOT_FIND_IDENTITY;
else {
status = set_identity(session, cached_ident);
free_identity(session->cached_mistrusted);
}
session->cached_mistrusted = NULL;
return status;
}
DYNAMIC_API PEP_STATUS key_reset_trust(
PEP_SESSION session,
pEp_identity *ident


+ 20
- 2
src/keymanagement.h View File

@ -125,17 +125,35 @@ DYNAMIC_API PEP_STATUS do_keymanagement(
);
// key_mistrusted() - mark key as being compromized
// key_mistrusted() - mark key as being compromised
//
// parameters:
// session (in) session to use
// ident (in) person and key which was compromized
// ident (in) person and key which was compromised
DYNAMIC_API PEP_STATUS key_mistrusted(
PEP_SESSION session,
pEp_identity *ident
);
// undo_last_mistrust() - reset identity and trust status for the last
// identity in this session marked as mistrusted
// to their cached values from the time of mistrust
// parameters:
// session (in) session to use
//
// return value:
// PEP_STATUS_OK if identity and trust were successfully restored.
// Otherwise, error status from attempts to set.
//
// caveat:
// only works for this session, and only once. cache is invalidated
// upon use.
//
//  WILL NOT WORK ON MISTRUSTED OWN KEY
DYNAMIC_API PEP_STATUS undo_last_mistrust(PEP_SESSION session);
// trust_personal_key() - mark a key as trusted with a person
//


+ 1
- 0
src/pEpEngine.h View File

@ -862,6 +862,7 @@ DYNAMIC_API void pEp_free(void *p);
DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity);
PEP_STATUS set_trust(PEP_SESSION session,
const char* user_id,
const char* fpr,


+ 3
- 0
src/pEp_internal.h View File

@ -173,6 +173,9 @@ struct _pEpSession {
bool unencrypted_subject;
bool keep_sync_msg;
bool service_log;
// mistrust undo cache
pEp_identity* cached_mistrusted;
#ifdef DEBUG_ERRORSTACK
stringlist_t* errorstack;


Loading…
Cancel
Save