ENGINE-530 ENGINE-535 - dedup keylists (except element 0) in encrypt and decrypt sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 07 Aug 2019 16:39:00 +0200
branchsync
changeset 39645bf62752336f
parent 3963 60b100beecb3
child 3965 9a59d1fa3d09
ENGINE-530 ENGINE-535 - dedup keylists (except element 0) in encrypt and decrypt
src/message_api.c
     1.1 --- a/src/message_api.c	Wed Aug 07 16:04:40 2019 +0200
     1.2 +++ b/src/message_api.c	Wed Aug 07 16:39:00 2019 +0200
     1.3 @@ -1928,6 +1928,10 @@
     1.4          return PEP_UNENCRYPTED;
     1.5      }
     1.6      else {
     1.7 +        // First, dedup the keylist
     1.8 +        if (keys && keys->next)
     1.9 +            dedup_stringlist(keys->next);
    1.10 +            
    1.11          // FIXME - we need to deal with transport types (via flag)
    1.12          message_wrap_type wrap_type = PEP_message_unwrapped;
    1.13          if ((enc_format != PEP_enc_inline) && (!force_v_1) && ((max_comm_type | PEP_ct_confirmed) == PEP_ct_pEp)) {
    1.14 @@ -3848,7 +3852,9 @@
    1.15  
    1.16      // 2. Clean up message and prepare for return 
    1.17      if (msg) {
    1.18 -        
    1.19 +        if (_keylist && _keylist->next)
    1.20 +            dedup_stringlist(_keylist->next);
    1.21 +            
    1.22          /* add pEp-related status flags to header */
    1.23          decorate_message(msg, *rating, _keylist, false, false);
    1.24