ENGINE-463: reconcile trust and the shell for merge_records ENGINE-463
authorKrista Bennett <krista@pep-project.org>
Tue, 02 Oct 2018 15:37:59 +0200
branchENGINE-463
changeset 2969b927bb5f437c
parent 2968 ef444e5152b3
child 2970 7c0ad677fbca
ENGINE-463: reconcile trust and the shell for merge_records
src/pEpEngine.c
     1.1 --- a/src/pEpEngine.c	Tue Oct 02 15:24:47 2018 +0200
     1.2 +++ b/src/pEpEngine.c	Tue Oct 02 15:37:59 2018 +0200
     1.3 @@ -2941,6 +2941,42 @@
     1.4      return PEP_STATUS_OK;
     1.5  }
     1.6  
     1.7 +PEP_comm_type reconcile_trust(PEP_comm_type t_old, PEP_comm_type t_new) {
     1.8 +    switch (t_new) {
     1.9 +        case PEP_ct_mistrusted:
    1.10 +        case PEP_ct_key_revoked:
    1.11 +        case PEP_ct_compromised:
    1.12 +        case PEP_ct_key_b0rken:
    1.13 +            return t_new;
    1.14 +        default:
    1.15 +            break;
    1.16 +    }
    1.17 +    switch (t_old) {
    1.18 +        case PEP_ct_mistrusted:
    1.19 +        case PEP_ct_key_revoked:
    1.20 +        case PEP_ct_compromised:
    1.21 +        case PEP_ct_key_b0rken:
    1.22 +            return t_old;
    1.23 +        default:
    1.24 +            break;
    1.25 +    }
    1.26 +    if (t_old < PEP_ct_strong_but_unconfirmed && t_new >= PEP_ct_strong_but_unconfirmed)
    1.27 +        return t_new;
    1.28 +    
    1.29 +    bool confirmed = (t_old & PEP_ct_confirmed) || (t_new & PEP_ct_confirmed);
    1.30 +    PEP_comm_type result = _MAX(t_old, t_new);
    1.31 +    if (confirmed)
    1.32 +        result |= PEP_ct_confirmed;
    1.33 +    return result;
    1.34 +}
    1.35 +
    1.36 +PEP_STATUS merge_records(PEP_SESSION session, const char* old_uid,
    1.37 +                         const char* new_uid) {
    1.38 +    PEP_STATUS status = PEP_STATUS_OK;
    1.39 +    
    1.40 +pEp_free:
    1.41 +    return status;
    1.42 +}
    1.43  
    1.44  PEP_STATUS replace_userid(PEP_SESSION session, const char* old_uid,
    1.45                                const char* new_uid) {