Quick fix for blank Outlook message IDs for inner messages. Will have to be fixed in adapter later.
authorKrista Bennett <krista@pep-project.org>
Wed, 25 Oct 2017 12:16:27 +0200
changeset 2204765c6ff31183
parent 2201 24b1ef4ba5fe
child 2205 1cb06c1241bd
child 2207 5a57a595349e
child 2209 b81b671adac1
Quick fix for blank Outlook message IDs for inner messages. Will have to be fixed in adapter later.
src/message_api.c
     1.1 --- a/src/message_api.c	Wed Oct 25 11:17:01 2017 +0200
     1.2 +++ b/src/message_api.c	Wed Oct 25 12:16:27 2017 +0200
     1.3 @@ -775,10 +775,8 @@
     1.4          _envelope = extract_minimal_envelope(attachment, PEP_dir_outgoing);
     1.5          status = generate_message_id(_envelope);
     1.6          
     1.7 -        if (status != PEP_STATUS_OK) {
     1.8 -            free(_envelope);
     1.9 -            return NULL;
    1.10 -        }
    1.11 +        if (status != PEP_STATUS_OK)
    1.12 +            goto enomem;
    1.13          
    1.14          attachment->longmsg = encapsulate_message_wrap_info("INNER", attachment->longmsg);
    1.15          _envelope->longmsg = encapsulate_message_wrap_info("OUTER", _envelope->longmsg);
    1.16 @@ -786,6 +784,19 @@
    1.17      else {
    1.18          _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    1.19      }
    1.20 +    
    1.21 +    if (!attachment->id || attachment->id[0] == "\0") {
    1.22 +        free(attachment->id);
    1.23 +        if (!_envelope->id) {
    1.24 +            status = generate_message_id(_envelope);
    1.25 +        
    1.26 +            if (status != PEP_STATUS_OK)
    1.27 +                goto enomem;
    1.28 +        }
    1.29 +            
    1.30 +        attachment->id = strdup(_envelope->id);
    1.31 +    }
    1.32 +    
    1.33      char* message_text = NULL;
    1.34  
    1.35      /* prevent introduction of pEp in inner message */
    1.36 @@ -814,7 +825,7 @@
    1.37      
    1.38  enomem:
    1.39      if (!envelope) {
    1.40 -        free(_envelope);
    1.41 +        free_message(_envelope);
    1.42      }
    1.43      return NULL;    
    1.44  }