ENGINE-402: this is the real ENGINE-402 fix. ENGINE-402
authorKrista Bennett <krista@pep-project.org>
Fri, 23 Mar 2018 01:01:45 +0100
branchENGINE-402
changeset 25821de69fc95e5e
parent 2581 752b9b14e0bc
child 2583 170f1497ed67
child 2584 fce06819c377
ENGINE-402: this is the real ENGINE-402 fix.
src/message_api.c
     1.1 --- a/src/message_api.c	Fri Mar 23 00:08:43 2018 +0100
     1.2 +++ b/src/message_api.c	Fri Mar 23 01:01:45 2018 +0100
     1.3 @@ -2944,12 +2944,22 @@
     1.4      */
     1.5      
     1.6      // 1. Check to see if this message is to us and contains an own key imported 
     1.7 -    // from own trusted message 
     1.8 -    if (msg && *rating >= PEP_rating_trusted && imported_private_key_address &&
     1.9 -        msg->to && msg->to->ident && msg->to->ident->me) {
    1.10 -
    1.11 -        // flag it as such
    1.12 -        *flags |= PEP_decrypt_flag_own_private_key;
    1.13 +    // from own trusted message
    1.14 +    if (*rating >= PEP_rating_trusted && imported_private_key_address) {
    1.15 +
    1.16 +        if (msg && msg->to && msg->to->ident) {            
    1.17 +            // This will only happen rarely, so we can do this.
    1.18 +            PEP_STATUS _tmp_status = PEP_STATUS_OK;
    1.19 +            
    1.20 +            if (!is_me(session, msg->to->ident))
    1.21 +                _tmp_status = update_identity(session, msg->to->ident);
    1.22 +            
    1.23 +            if (_tmp_status == PEP_STATUS_OK && msg->to->ident->me) {
    1.24 +                // flag it as such
    1.25 +                *flags |= PEP_decrypt_flag_own_private_key;
    1.26 +            }
    1.27 +        }
    1.28 +        
    1.29      }
    1.30  
    1.31      // 2. Clean up message and prepare for return