ENGINE-166 copy source message ID to destination message ID in encrypt_message(), encrypt_message_for_self() and decrypt_message()
authorEdouard Tisserant <edouard@pep-project.org>
Tue, 17 Jan 2017 15:27:16 +0100
changeset 15420717f7ac7b24
parent 1541 5f4d0eb0140d
child 1544 59ebfba16240
child 1548 a525079dc92e
ENGINE-166 copy source message ID to destination message ID in encrypt_message(), encrypt_message_for_self() and decrypt_message()
src/message_api.c
     1.1 --- a/src/message_api.c	Tue Jan 17 10:30:10 2017 +0100
     1.2 +++ b/src/message_api.c	Tue Jan 17 15:27:16 2017 +0100
     1.3 @@ -1214,8 +1214,15 @@
     1.4              goto enomem;
     1.5      }
     1.6  
     1.7 -    if (msg)
     1.8 +    if (msg) {
     1.9          decorate_message(msg, PEP_rating_undefined, NULL);
    1.10 +        if (src->id) {
    1.11 +            msg->id = strdup(src->id);
    1.12 +            assert(msg->id);
    1.13 +            if (msg->id == NULL)
    1.14 +                goto enomem;
    1.15 +        }
    1.16 +    }
    1.17  
    1.18      *dst = msg;
    1.19      return status;
    1.20 @@ -1314,6 +1321,15 @@
    1.21               goto enomem;
    1.22       }
    1.23  
    1.24 +     if (msg) {
    1.25 +         if (src->id) {
    1.26 +             msg->id = strdup(src->id);
    1.27 +             assert(msg->id);
    1.28 +             if (msg->id == NULL)
    1.29 +                 goto enomem;
    1.30 +         }
    1.31 +     }
    1.32 +
    1.33      *dst = msg;
    1.34      return status;
    1.35  
    1.36 @@ -1949,6 +1965,12 @@
    1.37                  goto pep_error;
    1.38              }
    1.39          }
    1.40 +        if (src->id) {
    1.41 +            msg->id = strdup(src->id);
    1.42 +            assert(msg->id);
    1.43 +            if (msg->id == NULL)
    1.44 +                goto enomem;
    1.45 +        }
    1.46      }
    1.47  
    1.48      *dst = msg;