Merged in ENGINE-430
authorKrista Bennett <krista@pep-project.org>
Wed, 09 May 2018 09:51:05 +0200
changeset 2665574f882fe6a0
parent 2659 5d0dcfb29de6
parent 2663 5bcf7e1d9025
child 2667 a8f77b25bed2
child 2672 41b8d284de9f
Merged in ENGINE-430
     1.1 --- a/src/message_api.c	Tue May 08 10:50:10 2018 +0200
     1.2 +++ b/src/message_api.c	Wed May 09 09:51:05 2018 +0200
     1.3 @@ -3002,7 +3002,9 @@
     1.4      PEP_STATUS status = PEP_STATUS_OK;
     1.5      PEP_STATUS decrypt_status = PEP_CANNOT_DECRYPT_UNKNOWN;
     1.6      PEP_STATUS _decrypt_in_pieces_status = PEP_CANNOT_DECRYPT_UNKNOWN;
     1.7 -    message *msg = NULL;
     1.8 +    message* msg = NULL;
     1.9 +    message* calculated_src = src;
    1.10 +    
    1.11      char *ctext;
    1.12      size_t csize;
    1.13      char *ptext = NULL;
    1.14 @@ -3260,7 +3262,8 @@
    1.15                                              reconcile_src_and_inner_messages(src, inner_message);
    1.16                                              
    1.17                                              // FIXME: free msg, but check references
    1.18 -                                            src = msg = inner_message;
    1.19 +                                            //src = msg = inner_message;
    1.20 +                                            calculated_src = msg = inner_message;
    1.21                                              
    1.22                                              if (src->from) {
    1.23                                                  if (!is_me(session, src->from))
    1.24 @@ -3299,13 +3302,13 @@
    1.25          // Ok, so if it was signed and it's all verified, we can update
    1.26          // eligible signer comm_types to PEP_ct_pEp_*
    1.27          if (decrypt_status == PEP_DECRYPTED_AND_VERIFIED && is_pep_msg)
    1.28 -            status = update_sender_to_pep_trust(session, src->from, _keylist);
    1.29 +            status = update_sender_to_pep_trust(session, calculated_src->from, _keylist);
    1.30  
    1.31          /* Ok, now we have a keylist used for decryption/verification.
    1.32             now we need to update the message rating with the 
    1.33             sender and recipients in mind */
    1.34          status = amend_rating_according_to_sender_and_recipients(session,
    1.35 -                 rating, src->from, _keylist);
    1.36 +                 rating, calculated_src->from, _keylist);
    1.37  
    1.38          if (status != PEP_STATUS_OK)
    1.39              goto pep_error;
    1.40 @@ -3352,8 +3355,8 @@
    1.41          if (imported_keys)
    1.42              remove_attached_keys(msg);
    1.43                      
    1.44 -        if (src->id && src != msg) {
    1.45 -            msg->id = strdup(src->id);
    1.46 +        if (calculated_src->id && calculated_src != msg) {
    1.47 +            msg->id = strdup(calculated_src->id);
    1.48              assert(msg->id);
    1.49              if (msg->id == NULL)
    1.50                  goto enomem;