Merged in default ENGINE-9
authorKrista Bennett <krista@pep-project.org>
Thu, 08 Jun 2017 10:58:52 +0200
branchENGINE-9
changeset 1833d6eaa3ebdf42
parent 1831 7f36a1b2ba63
parent 1832 93c627c7f709
child 1834 e7f79c9b64fd
Merged in default
src/message_api.c
test/encrypt_for_identity_test.cc
     1.1 --- a/src/message_api.c	Wed Jun 07 14:43:07 2017 +0200
     1.2 +++ b/src/message_api.c	Thu Jun 08 10:58:52 2017 +0200
     1.3 @@ -2094,7 +2094,7 @@
     1.4      *dst = msg;
     1.5      *keylist = _keylist;
     1.6  
     1.7 -    return ERROR(status);
     1.8 +    return PEP_STATUS_OK;
     1.9  
    1.10  enomem:
    1.11      status = PEP_OUT_OF_MEMORY;
    1.12 @@ -2727,6 +2727,7 @@
    1.13      PEP_STATUS status = PEP_STATUS_OK;
    1.14      stringlist_t *_keylist = x_keylist;
    1.15      bool must_free_keylist = false;
    1.16 +    PEP_rating _rating;
    1.17  
    1.18      assert(session);
    1.19      assert(msg);
    1.20 @@ -2741,13 +2742,15 @@
    1.21          for (stringpair_list_t *i = msg->opt_fields; i && i->value ; i=i->next) {
    1.22              if (strcasecmp(i->value->key, "X-EncStatus") == 0){
    1.23                  x_enc_status = string_to_rating(i->value->value);
    1.24 -                break;
    1.25 +                goto got_rating;
    1.26              }
    1.27          }
    1.28 +        return ERROR(PEP_ILLEGAL_VALUE);
    1.29      }
    1.30 -    if (x_enc_status == PEP_rating_undefined)
    1.31 -        return ERROR(PEP_ILLEGAL_VALUE);
    1.32 -
    1.33 +
    1.34 +got_rating:
    1.35 +
    1.36 +    _rating = x_enc_status;
    1.37  
    1.38      if (_keylist == NULL){
    1.39          for (stringpair_list_t *i = msg->opt_fields; i && i->value ; i=i->next) {
    1.40 @@ -2756,14 +2759,12 @@
    1.41                  if (status != PEP_STATUS_OK)
    1.42                      GOTO(pep_error);
    1.43                  must_free_keylist = true;
    1.44 -                break;
    1.45 +                goto got_keylist;
    1.46              }
    1.47          }
    1.48 +        return ERROR(PEP_ILLEGAL_VALUE);
    1.49      }
    1.50 -    if (_keylist == NULL)
    1.51 -        return ERROR(PEP_ILLEGAL_VALUE);
    1.52 -
    1.53 -    PEP_rating _rating = x_enc_status;
    1.54 +got_keylist:
    1.55  
    1.56      status = amend_rating_according_to_sender_and_recipients(session,
    1.57                                                               &_rating,
     2.1 --- a/test/encrypt_for_identity_test.cc	Wed Jun 07 14:43:07 2017 +0200
     2.2 +++ b/test/encrypt_for_identity_test.cc	Thu Jun 08 10:58:52 2017 +0200
     2.3 @@ -94,7 +94,7 @@
     2.4      assert(decrypted_msg);
     2.5      assert(keylist_used);
     2.6      assert(rating);
     2.7 -    assert(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
     2.8 +    assert(status == PEP_STATUS_OK && rating == PEP_rating_unreliable);
     2.9      PEP_comm_type ct = encrypted_msg->from->comm_type;
    2.10      assert(ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed );
    2.11  
    2.12 @@ -164,7 +164,7 @@
    2.13      assert(keylist_used);
    2.14      assert(mimerating);
    2.15                               
    2.16 -    assert(status == PEP_DECRYPTED && mimerating == PEP_rating_unreliable);
    2.17 +    assert(status == PEP_STATUS_OK && mimerating == PEP_rating_unreliable);
    2.18  
    2.19      cout << "Decrypted message:" << endl;
    2.20      cout << decrypted_mimetext << endl;