ENGINE-462: we now always copy the recv from the src struct on decrypt, and sent if an inner message doesn't have this value sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 13 Jun 2019 20:25:41 +0200
branchsync
changeset 38328860f25e9be9
parent 3831 44e274f79ec1
child 3833 97d3517be4a3
child 3834 2934fc35d7a3
child 3844 4f6876b03ec6
ENGINE-462: we now always copy the recv from the src struct on decrypt, and sent if an inner message doesn't have this value
src/message_api.c
src/timestamp.c
     1.1 --- a/src/message_api.c	Thu Jun 13 12:52:48 2019 +0200
     1.2 +++ b/src/message_api.c	Thu Jun 13 20:25:41 2019 +0200
     1.3 @@ -3125,6 +3125,20 @@
     1.4      return status;    
     1.5  }
     1.6  
     1.7 +static PEP_STATUS reconcile_sent_and_recv_info(message* src, message* inner_message) {
     1.8 +    PEP_STATUS status = PEP_STATUS_OK;
     1.9 +    if (!src || !inner_message)
    1.10 +        return PEP_ILLEGAL_VALUE;
    1.11 +        
    1.12 +    if (!inner_message->sent)
    1.13 +        inner_message->sent = timestamp_dup(src->sent);
    1.14 +        
    1.15 +    // This will never be set otherwise, since it's a transport header on the outside    
    1.16 +    inner_message->recv = timestamp_dup(src->recv);
    1.17 +    
    1.18 +    return PEP_STATUS_OK;
    1.19 +}
    1.20 +
    1.21  static PEP_STATUS reconcile_src_and_inner_messages(message* src, 
    1.22                                               message* inner_message) {
    1.23  
    1.24 @@ -3142,6 +3156,9 @@
    1.25      if (status == PEP_STATUS_OK && inner_message->bcc)
    1.26          status = reconcile_identity_lists(src->bcc, inner_message->bcc);
    1.27  
    1.28 +    if (status == PEP_STATUS_OK)
    1.29 +        status = reconcile_sent_and_recv_info(src, inner_message);
    1.30 +        
    1.31      return status;
    1.32      // FIXME - are there any flags or anything else we need to be sure are carried?
    1.33  }
     2.1 --- a/src/timestamp.c	Thu Jun 13 12:52:48 2019 +0200
     2.2 +++ b/src/timestamp.c	Thu Jun 13 20:25:41 2019 +0200
     2.3 @@ -30,7 +30,6 @@
     2.4  
     2.5  DYNAMIC_API timestamp * timestamp_dup(const timestamp *src)
     2.6  {
     2.7 -    assert(src);
     2.8      if (!src)
     2.9          return NULL;
    2.10  
    2.11 @@ -42,4 +41,3 @@
    2.12      memcpy(dst, src, sizeof(timestamp));
    2.13      return dst;
    2.14  }
    2.15 -