Merged in default. sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 18 Mar 2019 15:57:57 +0100
branchsync
changeset 3343df02ace61c84
parent 3336 bea05d3b250e
parent 3342 3e11f68497d4
child 3344 1f1e81725e53
Merged in default.
.hgignore
src/mime.c
test/src/SuiteMaker.cc
     1.1 --- a/.hgignore	Fri Mar 15 12:48:33 2019 +0100
     1.2 +++ b/.hgignore	Mon Mar 18 15:57:57 2019 +0100
     1.3 @@ -60,6 +60,8 @@
     1.4  test/pEp_test_home
     1.5  test/TestDriver
     1.6  test/local
     1.7 +test/include/LocalPlayground.h
     1.8 +test/src/engine_test/LocalPlayground.cc
     1.9  .tags
    1.10  */.tags
    1.11  */*/.tags
     2.1 --- a/src/mime.c	Fri Mar 15 12:48:33 2019 +0100
     2.2 +++ b/src/mime.c	Mon Mar 18 15:57:57 2019 +0100
     2.3 @@ -13,6 +13,10 @@
     2.4  #include "etpan_mime.h"
     2.5  #include "wrappers.h"
     2.6  
     2.7 +static PEP_STATUS interpret_MIME(struct mailmime *mime,
     2.8 +                                 message *msg);
     2.9 +
    2.10 +
    2.11  static bool is_whitespace(char c)
    2.12  {
    2.13      switch (c) {
    2.14 @@ -1470,6 +1474,63 @@
    2.15      return PEP_STATUS_OK;
    2.16  }
    2.17  
    2.18 +// ONLY for main part!!!
    2.19 +static PEP_STATUS process_multipart_related(struct mailmime *mime,
    2.20 +                                            message *msg) {
    2.21 +    PEP_STATUS status = PEP_STATUS_OK;
    2.22 +
    2.23 +    assert(mime);
    2.24 +    assert(msg);
    2.25 +
    2.26 +    clist *partlist = mime->mm_data.mm_multipart.mm_mp_list;                                                
    2.27 +
    2.28 +    if (partlist == NULL)
    2.29 +        return PEP_ILLEGAL_VALUE;
    2.30 +
    2.31 +    clistiter *cur = clist_begin(partlist);
    2.32 +    struct mailmime *part = clist_content(cur);
    2.33 +    
    2.34 +    if (part == NULL)
    2.35 +        return PEP_ILLEGAL_VALUE;
    2.36 +
    2.37 +    struct mailmime_content *content = part->mm_content_type;    
    2.38 +    assert(content);
    2.39 +    
    2.40 +    if (content == NULL)
    2.41 +        return PEP_ILLEGAL_VALUE;
    2.42 +
    2.43 +    if (_is_text_part(content, "html")) {
    2.44 +        status = interpret_body(part, &msg->longmsg_formatted,
    2.45 +                NULL);
    2.46 +        if (status)
    2.47 +            return status;
    2.48 +    }
    2.49 +    else {
    2.50 +        // ???
    2.51 +        // This is what we would have done before, so... no
    2.52 +        // worse than the status quo. But FIXME!
    2.53 +        status = interpret_MIME(part, msg);
    2.54 +        if (status)
    2.55 +            return status;
    2.56 +    }
    2.57 +    
    2.58 +    for (cur = clist_next(cur); cur; cur = clist_next(cur)) {
    2.59 +        part = clist_content(cur);
    2.60 +        if (part == NULL)
    2.61 +            return PEP_ILLEGAL_VALUE;
    2.62 +
    2.63 +        content = part->mm_content_type;
    2.64 +        assert(content);
    2.65 +        if (content == NULL)
    2.66 +            return PEP_ILLEGAL_VALUE;
    2.67 +
    2.68 +        status = interpret_MIME(part, msg);
    2.69 +        if (status)
    2.70 +            return status;
    2.71 +    }
    2.72 +    return status;
    2.73 +}
    2.74 +
    2.75  static PEP_STATUS interpret_MIME(
    2.76          struct mailmime *mime,
    2.77          message *msg
    2.78 @@ -1515,6 +1576,12 @@
    2.79                      if (status)
    2.80                          return status;
    2.81                  }
    2.82 +                else if (_is_multipart(content, "related") && 
    2.83 +                    msg->longmsg_formatted == NULL) {
    2.84 +                    status = process_multipart_related(part, msg);
    2.85 +                    if (status)
    2.86 +                        return status;
    2.87 +                }
    2.88                  else /* add as attachment */ {
    2.89                      status = interpret_MIME(part, msg);
    2.90                      if (status)
     3.1 --- a/test/src/SuiteMaker.cc	Fri Mar 15 12:48:33 2019 +0100
     3.2 +++ b/test/src/SuiteMaker.cc	Mon Mar 18 15:57:57 2019 +0100
     3.3 @@ -35,7 +35,6 @@
     3.4  #include "Engine358Tests.h"
     3.5  #include "BlacklistAcceptNewKeyTests.h"
     3.6  #include "DecryptAttachPrivateKeyUntrustedTests.h"
     3.7 -#include "ReturnMistrustFprTests.h"
     3.8  #include "BlacklistTests.h"
     3.9  #include "RevokeRegenAttachTests.h"
    3.10  #include "PepSubjectReceivedTests.h"
    3.11 @@ -87,7 +86,6 @@
    3.12      "Engine358Tests",
    3.13      "BlacklistAcceptNewKeyTests",
    3.14      "DecryptAttachPrivateKeyUntrustedTests",
    3.15 -    "ReturnMistrustFprTests",
    3.16      "BlacklistTests",
    3.17      "RevokeRegenAttachTests",
    3.18      "PepSubjectReceivedTests",
    3.19 @@ -116,7 +114,7 @@
    3.20  };
    3.21  
    3.22  // This file is generated, so magic constants are ok.
    3.23 -int SuiteMaker::num_suites = 49;
    3.24 +int SuiteMaker::num_suites = 48;
    3.25  
    3.26  void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
    3.27      if (strcmp(test_class_name, "MimeTests") == 0)
    3.28 @@ -165,8 +163,6 @@
    3.29          *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
    3.30      else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
    3.31          *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
    3.32 -    else if (strcmp(test_class_name, "ReturnMistrustFprTests") == 0)
    3.33 -        *test_suite = new ReturnMistrustFprTests(test_class_name, test_home);
    3.34      else if (strcmp(test_class_name, "BlacklistTests") == 0)
    3.35          *test_suite = new BlacklistTests(test_class_name, test_home);
    3.36      else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)