ENGINE-311: Only PRESERVE X-pEp-Version on decrypt -- do not add it where it wasn't before!!! 0.9.0 release
authorKrista Bennett <krista@pep-project.org>
Thu, 09 Nov 2017 17:57:29 +0100
changeset 2284fa00137505b8
parent 2283 b474e41e685b
child 2285 367fefec18ea
child 2290 1cc3770407e0
ENGINE-311: Only PRESERVE X-pEp-Version on decrypt -- do not add it where it wasn't before!!!
src/message_api.c
     1.1 --- a/src/message_api.c	Thu Nov 09 12:01:22 2017 +0100
     1.2 +++ b/src/message_api.c	Thu Nov 09 17:57:29 2017 +0100
     1.3 @@ -190,12 +190,14 @@
     1.4  static void decorate_message(
     1.5      message *msg,
     1.6      PEP_rating rating,
     1.7 -    stringlist_t *keylist
     1.8 +    stringlist_t *keylist,
     1.9 +    bool add_version
    1.10      )
    1.11  {
    1.12      assert(msg);
    1.13  
    1.14 -    replace_opt_field(msg, "X-pEp-Version", PEP_VERSION);
    1.15 +    if (add_version)
    1.16 +        replace_opt_field(msg, "X-pEp-Version", PEP_VERSION);
    1.17  
    1.18      if (rating != PEP_rating_undefined)
    1.19          replace_opt_field(msg, "X-EncStatus", rating_to_string(rating));
    1.20 @@ -1531,7 +1533,7 @@
    1.21          if (!session->passive_mode && 
    1.22              !(flags & PEP_encrypt_flag_force_no_attached_key)) {
    1.23              attach_own_key(session, src);
    1.24 -            decorate_message(src, PEP_rating_undefined, NULL);
    1.25 +            decorate_message(src, PEP_rating_undefined, NULL, true);
    1.26          }
    1.27          return ADD_TO_LOG(PEP_UNENCRYPTED);
    1.28      }
    1.29 @@ -1594,7 +1596,7 @@
    1.30      }
    1.31  
    1.32      if (msg) {
    1.33 -        decorate_message(msg, PEP_rating_undefined, NULL);
    1.34 +        decorate_message(msg, PEP_rating_undefined, NULL, true);
    1.35          if (_src->id) {
    1.36              msg->id = strdup(_src->id);
    1.37              assert(msg->id);
    1.38 @@ -2452,6 +2454,7 @@
    1.39  
    1.40          if (decrypt_status == PEP_DECRYPTED || decrypt_status == PEP_DECRYPTED_AND_VERIFIED) {
    1.41              char* wrap_info = NULL;
    1.42 +            
    1.43              status = unencapsulate_hidden_fields(src, msg, &wrap_info);
    1.44  
    1.45  //            bool is_transport_wrapper = false;
    1.46 @@ -2571,7 +2574,7 @@
    1.47      if (msg) {
    1.48          
    1.49          /* add pEp-related status flags to header */
    1.50 -        decorate_message(msg, *rating, _keylist);
    1.51 +        decorate_message(msg, *rating, _keylist, false);
    1.52          
    1.53          if (imported_keys)
    1.54              remove_attached_keys(msg);