1.1 --- a/src/message.h Tue Nov 20 13:14:29 2018 +0100
1.2 +++ b/src/message.h Tue Nov 20 13:18:15 2018 +0100
1.3 @@ -30,7 +30,6 @@
1.4
1.5 typedef enum _PEP_enc_format {
1.6 PEP_enc_none = 0, // message is not encrypted
1.7 - PEP_enc_signed_only, // message is not encrypted, only signed
1.8 PEP_enc_pieces, // inline PGP + PGP extensions
1.9 PEP_enc_S_MIME, // RFC5751
1.10 PEP_enc_PGP_MIME, // RFC3156
2.1 --- a/src/message_api.c Tue Nov 20 13:14:29 2018 +0100
2.2 +++ b/src/message_api.c Tue Nov 20 13:18:15 2018 +0100
2.3 @@ -1003,76 +1003,6 @@
2.4 return PEP_STATUS_OK;
2.5 }
2.6
2.7 -
2.8 -static PEP_STATUS sign_PGP_MIME(
2.9 - PEP_SESSION session,
2.10 - const message *src,
2.11 - const char* fpr,
2.12 - message *dst
2.13 - )
2.14 -{
2.15 - PEP_STATUS status = PEP_STATUS_OK;
2.16 -
2.17 - char *stext = NULL;
2.18 - char *mimetext = NULL;
2.19 -
2.20 - size_t ssize = 0;
2.21 - assert(dst->longmsg == NULL);
2.22 -
2.23 - if (src->shortmsg)
2.24 - dst->shortmsg = strdup(src->shortmsg);
2.25 -
2.26 - dst->enc_format = PEP_enc_signed_only;
2.27 -
2.28 - // _src is an object that will hold the relevant message parts (sans headers)
2.29 - // for MIME-encoding. It does not duplicate the message parts, nor does
2.30 - // it take ownership of them, and should thus NOT be freed via free_message
2.31 - message *_src = calloc(1, sizeof(message));
2.32 - assert(_src);
2.33 - if (_src == NULL)
2.34 - goto enomem;
2.35 -
2.36 - _src->longmsg = src->longmsg;
2.37 - _src->longmsg_formatted = src->longmsg_formatted;
2.38 - _src->attachments = src->attachments;
2.39 - _src->enc_format = PEP_enc_none;
2.40 -
2.41 - // Get mime-encoded string of message
2.42 - status = _mime_encode_message_internal(_src, true, &mimetext, true);
2.43 - assert(status == PEP_STATUS_OK);
2.44 - if (status != PEP_STATUS_OK)
2.45 - goto pep_error;
2.46 -
2.47 - free(_src);
2.48 - _src = NULL;
2.49 - assert(mimetext);
2.50 - if (mimetext == NULL)
2.51 - goto pep_error;
2.52 -
2.53 - dst->longmsg = strdup(mimetext);
2.54 - status = sign_only(session, fpr, mimetext, strlen(mimetext),
2.55 - &stext, &ssize);
2.56 -
2.57 -
2.58 -
2.59 - if (stext == NULL)
2.60 - goto pep_error;
2.61 -
2.62 - dst->longmsg = stext;
2.63 -
2.64 - return PEP_STATUS_OK;
2.65 -
2.66 -enomem:
2.67 - status = PEP_OUT_OF_MEMORY;
2.68 -
2.69 -pep_error:
2.70 - free(mimetext);
2.71 - free(_src);
2.72 - free(stext);
2.73 - return status;
2.74 -}
2.75 -
2.76 -
2.77 static PEP_STATUS encrypt_PGP_MIME(
2.78 PEP_SESSION session,
2.79 const message *src,
2.80 @@ -1670,97 +1600,6 @@
2.81 }
2.82 }
2.83
2.84 -DYNAMIC_API PEP_STATUS sign_message(
2.85 - PEP_SESSION session,
2.86 - message *src,
2.87 - message **dst,
2.88 - char** fpr_used
2.89 - )
2.90 -{
2.91 - assert(session);
2.92 - assert(src);
2.93 - assert(dst);
2.94 - assert(fpr_used);
2.95 -
2.96 - if (!(session && src && dst && fpr_used))
2.97 - return PEP_ILLEGAL_VALUE;
2.98 -
2.99 - if (src->dir == PEP_dir_incoming)
2.100 - return PEP_ILLEGAL_VALUE;
2.101 -
2.102 - PEP_STATUS status = PEP_STATUS_OK;
2.103 - *fpr_used = NULL;
2.104 - message * msg = NULL;
2.105 - const char* fpr = NULL;
2.106 -
2.107 - if (src->from && (!src->from->user_id || src->from->user_id[0] == '\0')) {
2.108 - char* own_id = NULL;
2.109 - status = get_default_own_userid(session, &own_id);
2.110 - if (own_id) {
2.111 - free(src->from->user_id);
2.112 - src->from->user_id = own_id; // ownership transfer
2.113 - }
2.114 - }
2.115 -
2.116 - status = myself(session, src->from);
2.117 - if (status != PEP_STATUS_OK)
2.118 - goto pep_error;
2.119 -
2.120 - fpr = src->from->fpr;
2.121 - if (EMPTYSTR(fpr)) {
2.122 - status = PEP_KEY_NOT_FOUND;
2.123 - goto pep_error;
2.124 - }
2.125 -
2.126 - // FIXME: Find out what happens when this is empty.
2.127 - msg = clone_to_empty_message(src);
2.128 - if (msg == NULL)
2.129 - goto enomem;
2.130 -
2.131 - attach_own_key(session, msg);
2.132 - status = sign_PGP_MIME(session, src, fpr, msg);
2.133 -
2.134 - if (status != PEP_STATUS_OK)
2.135 - goto pep_error;
2.136 -
2.137 - if (msg && msg->shortmsg == NULL) {
2.138 - msg->shortmsg = strdup("");
2.139 - assert(msg->shortmsg);
2.140 - if (msg->shortmsg == NULL)
2.141 - goto enomem;
2.142 - }
2.143 -
2.144 - if (msg) {
2.145 - decorate_message(msg, PEP_rating_undefined, NULL, true, true);
2.146 - if (_src->id) {
2.147 - msg->id = strdup(_src->id);
2.148 - assert(msg->id);
2.149 - if (msg->id == NULL)
2.150 - goto enomem;
2.151 - }
2.152 - }
2.153 -
2.154 - *dst = msg;
2.155 -
2.156 - // ??? FIXME: Check to be sure we don't have references btw _src and msg.
2.157 - // I don't think we do.
2.158 - if (_src && _src != src)
2.159 - free_message(_src);
2.160 -
2.161 - _cleanup_src(src, added_key_to_real_src);
2.162 -
2.163 - return status;
2.164 -
2.165 -enomem:
2.166 - status = PEP_OUT_OF_MEMORY;
2.167 -
2.168 -pep_error:
2.169 - free_stringlist(keys);
2.170 - free_message(msg);
2.171 -
2.172 - return status;
2.173 -}
2.174 -
2.175 DYNAMIC_API PEP_STATUS encrypt_message(
2.176 PEP_SESSION session,
2.177 message *src,
3.1 --- a/src/message_api.h Tue Nov 20 13:14:29 2018 +0100
3.2 +++ b/src/message_api.h Tue Nov 20 13:18:15 2018 +0100
3.3 @@ -79,6 +79,7 @@
3.4 PEP_encrypt_flags_t flags
3.5 );
3.6
3.7 +
3.8 // encrypt_message_and_add_priv_key() - encrypt message in memory, adding an encrypted private
3.9 // key (encrypted separately and sent within the inner message)
3.10 //
3.11 @@ -149,6 +150,7 @@
3.12 PEP_encrypt_flags_t flags
3.13 );
3.14
3.15 +
3.16 // MIME_encrypt_message() - encrypt a MIME message, with MIME output
3.17 //
3.18 // parameters:
3.19 @@ -326,6 +328,7 @@
3.20 PEP_decrypt_flags_t *flags
3.21 );
3.22
3.23 +
3.24 // MIME_decrypt_message() - decrypt a MIME message, with MIME output
3.25 //
3.26 // parameters:
3.27 @@ -575,7 +578,6 @@
3.28 PEP_rating x_enc_status,
3.29 PEP_rating *rating
3.30 );
3.31 -
3.32 #ifdef __cplusplus
3.33 }
3.34 #endif
4.1 --- a/src/mime.c Tue Nov 20 13:14:29 2018 +0100
4.2 +++ b/src/mime.c Tue Nov 20 13:18:15 2018 +0100
4.3 @@ -920,86 +920,6 @@
4.4 return status;
4.5 }
4.6
4.7 -static PEP_STATUS mime_encode_message_signed_only(
4.8 - const message * msg,
4.9 - bool omit_fields,
4.10 - struct mailmime **result
4.11 - )
4.12 -{
4.13 - struct mailmime * mime = NULL;
4.14 - struct mailmime * submime = NULL;
4.15 - struct mailmime * subsubmime = NULL;
4.16 - struct mailmime_parameter * param;
4.17 - int r;
4.18 - PEP_STATUS status;
4.19 - char *plaintext;
4.20 - size_t plaintext_size;
4.21 -
4.22 - assert(msg->attachments && msg->attachments->next &&
4.23 - msg->attachments->next->value);
4.24 -
4.25 - plaintext = msg->attachments->next->value;
4.26 - plaintext_size = msg->attachments->next->size;
4.27 -
4.28 - mime = part_multiple_new("multipart/signed");
4.29 - assert(mime);
4.30 - if (mime == NULL)
4.31 - goto enomem;
4.32 -
4.33 - // FIXME: get the right algorithm here
4.34 - // FIXME: param failure?
4.35 - param = mailmime_parameter_new_with_data("micalg", "pgp-sha256");
4.36 - clist_append(mime->mm_content_type->ct_parameters, param);
4.37 -
4.38 - param = mailmime_param_new_with_data("protocol", "application/pgp-signature");
4.39 - clist_append(mime->mm_content_type->ct_parameters, param);
4.40 -
4.41 - submime = part_multiple_new("multipart/mixed");
4.42 - assert(submime);
4.43 - if (submime == NULL)
4.44 - goto enomem;
4.45 - r = mailmime_smart_add_part(mime, submime);
4.46 - assert(r == MAILIMF_NO_ERROR);
4.47 - if (r == MAILIMF_ERROR_MEMORY) {
4.48 - goto enomem;
4.49 - }
4.50 -
4.51 - pEp_rid_list_t* resource = new_rid_node(PEP_RID_FILENAME, "msg.asc");
4.52 - submime = get_text_part(resource, "application/octet-stream", plaintext,
4.53 - plaintext_size, MAILMIME_MECHANISM_7BIT);
4.54 -
4.55 - free_rid_list(resource);
4.56 -
4.57 - assert(submime);
4.58 - if (submime == NULL)
4.59 - goto enomem;
4.60 -
4.61 - r = mailmime_smart_add_part(mime, submime);
4.62 - assert(r == MAILIMF_NO_ERROR);
4.63 - if (r == MAILIMF_ERROR_MEMORY) {
4.64 - goto enomem;
4.65 - }
4.66 - else {
4.67 - // mailmime_smart_add_part() takes ownership of submime
4.68 - submime = NULL;
4.69 - }
4.70 -
4.71 - *result = mime;
4.72 - return PEP_STATUS_OK;
4.73 -
4.74 -enomem:
4.75 - status = PEP_OUT_OF_MEMORY;
4.76 -
4.77 - if (mime)
4.78 - mailmime_free(mime);
4.79 -
4.80 - if (submime)
4.81 - mailmime_free(submime);
4.82 -
4.83 - return status;
4.84 -}
4.85 -
4.86 -
4.87 DYNAMIC_API PEP_STATUS mime_encode_message(
4.88 const message * msg,
4.89 bool omit_fields,
5.1 --- a/test/src/SuiteMaker.cc Tue Nov 20 13:14:29 2018 +0100
5.2 +++ b/test/src/SuiteMaker.cc Tue Nov 20 13:18:15 2018 +0100
5.3 @@ -32,7 +32,6 @@
5.4 #include "HeaderKeyImportTests.h"
5.5 #include "StringpairListTests.h"
5.6 #include "TrustManipulationTests.h"
5.7 -#include "SignOnlyTests.h"
5.8 #include "EncryptAttachPrivateKeyTests.h"
5.9 #include "BloblistTests.h"
5.10 #include "SequenceTests.h"
5.11 @@ -79,7 +78,6 @@
5.12 "HeaderKeyImportTests",
5.13 "StringpairListTests",
5.14 "TrustManipulationTests",
5.15 - "SignOnlyTests",
5.16 "EncryptAttachPrivateKeyTests",
5.17 "BloblistTests",
5.18 "SequenceTests",
5.19 @@ -106,7 +104,7 @@
5.20 };
5.21
5.22 // This file is generated, so magic constants are ok.
5.23 -int SuiteMaker::num_suites = 44;
5.24 +int SuiteMaker::num_suites = 43;
5.25
5.26 void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
5.27 if (strcmp(test_class_name, "DecorateTests") == 0)
5.28 @@ -149,8 +147,6 @@
5.29 *test_suite = new StringpairListTests(test_class_name, test_home);
5.30 else if (strcmp(test_class_name, "TrustManipulationTests") == 0)
5.31 *test_suite = new TrustManipulationTests(test_class_name, test_home);
5.32 - else if (strcmp(test_class_name, "SignOnlyTests") == 0)
5.33 - *test_suite = new SignOnlyTests(test_class_name, test_home);
5.34 else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
5.35 *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
5.36 else if (strcmp(test_class_name, "BloblistTests") == 0)
6.1 --- a/test/src/engine_tests/MessageTwoPointOhTests.cc Tue Nov 20 13:14:29 2018 +0100
6.2 +++ b/test/src/engine_tests/MessageTwoPointOhTests.cc Tue Nov 20 13:18:15 2018 +0100
6.3 @@ -71,7 +71,7 @@
6.4 outgoing_message->shortmsg = strdup("Greetings, humans!");
6.5 outgoing_message->longmsg = strdup("This is a test of the emergency message system. This is only a test. BEEP.");
6.6 outgoing_message->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
6.7 - outgoing_message->id = strdup("blahblahyourmama@pep-project.org");
6.8 +// outgoing_message->id = strdup("blahblahyourmama@pep-project.org");
6.9 outgoing_message->references = new_stringlist("one-839274982347239847@pep-project.org");
6.10 stringlist_add(outgoing_message->references, "two-dfddffd839274982347239847@pep-project.org");
6.11 stringlist_add(outgoing_message->references, "three-OMGWTFBBQ.edfddffd839274982347239847@pep-project.org");