attach own key to inline sync
authorVolker Birk <vb@pep-project.org>
Wed, 15 May 2019 22:29:19 +0200
branchsync
changeset 369336e22e151d99
parent 3692 120e550260c3
child 3694 b52e11631ffa
attach own key to inline
src/message_api.c
     1.1 --- a/src/message_api.c	Wed May 15 19:31:25 2019 +0200
     1.2 +++ b/src/message_api.c	Wed May 15 22:29:19 2019 +0200
     1.3 @@ -975,7 +975,8 @@
     1.4          PEP_SESSION session,
     1.5          const message *src,
     1.6          stringlist_t *keys,
     1.7 -        message *dst
     1.8 +        message *dst,
     1.9 +        PEP_encrypt_flags_t flags
    1.10      )
    1.11  {
    1.12      char *ctext = NULL;
    1.13 @@ -1000,8 +1001,19 @@
    1.14      _ctext[csize] = 0;
    1.15  
    1.16      dst->longmsg = _ctext;
    1.17 +
    1.18 +    // attachments are going unencrypted
    1.19 +    bloblist_t *bl = bloblist_dup(src->attachments);
    1.20 +    if (!bl)
    1.21 +        return PEP_OUT_OF_MEMORY;
    1.22 +    dst->attachments = bl;
    1.23 +
    1.24 +    if ((!session->passive_mode) && 
    1.25 +        !(flags & PEP_encrypt_flag_force_no_attached_key)) {
    1.26 +        attach_own_key(session, dst);
    1.27 +    }
    1.28 +
    1.29      dst->enc_format = PEP_enc_inline;
    1.30 -
    1.31      return PEP_STATUS_OK;
    1.32  }
    1.33  
    1.34 @@ -1949,7 +1961,7 @@
    1.35                  break;
    1.36  
    1.37              case PEP_enc_inline:
    1.38 -                status = encrypt_PGP_inline(session, _src, keys, msg);
    1.39 +                status = encrypt_PGP_inline(session, _src, keys, msg, flags);
    1.40                  break;
    1.41  
    1.42              default:
    1.43 @@ -2284,7 +2296,7 @@
    1.44              break;
    1.45  
    1.46          case PEP_enc_inline:
    1.47 -            status = encrypt_PGP_inline(session, _src, keys, msg);
    1.48 +            status = encrypt_PGP_inline(session, _src, keys, msg, flags);
    1.49              break;
    1.50  
    1.51          default: