src/keymanagement.c
changeset 2586 9749e509f3ec
parent 2575 b9697c489261
child 2593 0876c1a73ae1
     1.1 --- a/src/keymanagement.c	Fri Mar 23 16:39:45 2018 +0100
     1.2 +++ b/src/keymanagement.c	Tue Mar 27 11:57:37 2018 +0200
     1.3 @@ -1253,12 +1253,19 @@
     1.4          goto pep_free;
     1.5          
     1.6      PEP_comm_type new_trust = PEP_ct_unknown;
     1.7 +    status = get_key_rating(session, ident->fpr, &new_trust);
     1.8 +    if (status != PEP_STATUS_OK)
     1.9 +        goto pep_free;
    1.10  
    1.11 -    if (input_copy->comm_type != PEP_ct_mistrusted)
    1.12 -        new_trust = input_copy->comm_type & ~PEP_ct_confirmed;
    1.13 -
    1.14 -    // We'll return the status from the input_copy cache afterward
    1.15 -    input_copy->comm_type = new_trust;
    1.16 +    bool pep_user = false;
    1.17 +    
    1.18 +    status = is_pep_user(session, ident, &pep_user);
    1.19 +    
    1.20 +    if (pep_user && new_trust >= PEP_ct_unconfirmed_encryption)
    1.21 +        input_copy->comm_type = PEP_ct_pEp_unconfirmed;
    1.22 +    else
    1.23 +        input_copy->comm_type = new_trust;
    1.24 +        
    1.25      status = set_trust(session, input_copy);
    1.26      
    1.27      if (status != PEP_STATUS_OK)
    1.28 @@ -1298,7 +1305,7 @@
    1.29      }
    1.30      
    1.31      char* user_default = NULL;
    1.32 -    status = get_main_user_fpr(session, tmp_ident->user_id, &user_default);
    1.33 +    get_main_user_fpr(session, tmp_ident->user_id, &user_default);
    1.34      
    1.35      if (!EMPTYSTR(user_default)) {
    1.36          if (strcmp(user_default, ident->fpr) == 0)