reverted df0ef2b26196 : 'Attach own key on unencrypted message with encrypt_message() when given enc_format is PEP_enc_none'. Kept code enforcing src->dir != PEP_dir_incoming in encrypt_message, though.
authorEdouard Tisserant
Thu, 28 Apr 2016 22:07:10 +0200
changeset 55871a650d71006
parent 557 3d868ef571cc
child 559 32811e6a231c
reverted df0ef2b26196 : 'Attach own key on unencrypted message with encrypt_message() when given enc_format is PEP_enc_none'. Kept code enforcing src->dir != PEP_dir_incoming in encrypt_message, though.
src/message_api.c
     1.1 --- a/src/message_api.c	Thu Apr 28 09:13:23 2016 +0200
     1.2 +++ b/src/message_api.c	Thu Apr 28 22:07:10 2016 +0200
     1.3 @@ -877,6 +877,9 @@
     1.4      assert(session);
     1.5      assert(msg);
     1.6  
     1.7 +    if (msg->dir == PEP_dir_incoming)
     1.8 +        return;
     1.9 +
    1.10      assert(msg->from && msg->from->fpr);
    1.11      if (msg->from == NULL || msg->from->fpr == NULL)
    1.12          return;
    1.13 @@ -929,8 +932,9 @@
    1.14      assert(session);
    1.15      assert(src);
    1.16      assert(dst);
    1.17 +    assert(enc_format != PEP_enc_none);
    1.18  
    1.19 -    if (!(session && src && dst))
    1.20 +    if (!(session && src && dst && enc_format != PEP_enc_none))
    1.21          return PEP_ILLEGAL_VALUE;
    1.22  
    1.23      if (src->dir == PEP_dir_incoming)
    1.24 @@ -945,13 +949,7 @@
    1.25      status = myself(session, src->from);
    1.26      if (status != PEP_STATUS_OK)
    1.27          goto pep_error;
    1.28 -    
    1.29 -    if (enc_format == PEP_enc_none)
    1.30 -    {
    1.31 -        attach_own_key(session, src);
    1.32 -        return PEP_UNENCRYPTED;
    1.33 -    }
    1.34 -    
    1.35 +
    1.36      keys = new_stringlist(src->from->fpr);
    1.37      if (keys == NULL)
    1.38          goto enomem;