ENGINE-118: together with libetpan push, enigmail memoryhole subj replacement works with signed, unencrypted texts now. Stowing changes to switch branches. ENGINE-118
authorKrista Grothoff <krista@pep-project.org>
Fri, 04 Nov 2016 12:41:03 +0100
branchENGINE-118
changeset 1349772e22d5dedc
parent 1348 8e86ccd0804c
child 1437 d3a494cbe649
ENGINE-118: together with libetpan push, enigmail memoryhole subj replacement works with signed, unencrypted texts now. Stowing changes to switch branches.
src/mime.c
test/test_mails/memoryhole_enigmail_signed.eml
     1.1 --- a/src/mime.c	Fri Oct 28 14:28:25 2016 +0200
     1.2 +++ b/src/mime.c	Fri Nov 04 12:41:03 2016 +0100
     1.3 @@ -1229,6 +1229,21 @@
     1.4      if (!part || !msg) 
     1.5          return PEP_UNKNOWN_ERROR;
     1.6      
     1.7 +    if (part->mm_imf_fields) {
     1.8 +        clist* fieldlist = part->mm_imf_fields->fld_list;
     1.9 +    
    1.10 +        if (fieldlist) {
    1.11 +            clistiter *cur;
    1.12 +            for (cur = clist_begin(fieldlist); cur; cur = clist_next(cur)) {
    1.13 +                struct mailimf_field *field = clist_content(cur);
    1.14 +                if (strcmp(field->fld_data.fld_optional_field->fld_name, "Subject") == 0 
    1.15 +                    && field->fld_data.fld_optional_field->fld_value) {
    1.16 +                    free(msg->shortmsg);
    1.17 +                    msg->shortmsg = strdup(field->fld_data.fld_optional_field->fld_value);
    1.18 +                }
    1.19 +            }
    1.20 +        }
    1.21 +    }
    1.22      return status;
    1.23  }
    1.24  
    1.25 @@ -1283,7 +1298,9 @@
    1.26              clist *partlist = mime->mm_data.mm_multipart.mm_mp_list;
    1.27              if (partlist == NULL)
    1.28                  return PEP_ILLEGAL_VALUE;
    1.29 -            
    1.30 +
    1.31 +            replace_select_headers(mime,msg);
    1.32 +
    1.33              clistiter *cur;
    1.34              for (cur = clist_begin(partlist); cur; cur = clist_next(cur)) {
    1.35                  struct mailmime *part = clist_content(cur);
    1.36 @@ -1302,14 +1319,14 @@
    1.37  //                 From: Winston 
    1.38  //                 To: Julia 
    1.39  //                 Message-ID: B@memoryhole.example
    1.40 -                if (_is_text_part(content, "rfc822-headers")) {
    1.41 -                    replace_select_headers(part, msg);
    1.42 -                }
    1.43 -                else {
    1.44 +//                 if (_is_text_part(content, "rfc822-headers")) {
    1.45 +//                     replace_select_headers(part, msg);
    1.46 +//                 }
    1.47 +//                else {
    1.48                      status = interpret_MIME(part, msg);
    1.49                      if (status)
    1.50                          return status;
    1.51 -                }
    1.52 +//                }
    1.53              }
    1.54          }
    1.55          else if (_is_multipart(content, "encrypted")) {
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/test_mails/memoryhole_enigmail_signed.eml	Fri Nov 04 12:41:03 2016 +0100
     2.3 @@ -0,0 +1,115 @@
     2.4 +Return-Path: <pep.test.alice@pep-project.org>
     2.5 +X-Original-To: krista@gnunet.org
     2.6 +Delivered-To: krista@gnunet.org
     2.7 +Received: from vmmailrelay1.informatik.tu-muenchen.de (mailrelay1.informatik.tu-muenchen.de [131.159.254.14])
     2.8 +	by sam.net.in.tum.de (Postfix) with ESMTP id 9BE901C00B5
     2.9 +	for <krista@gnunet.org>; Wed,  2 Nov 2016 20:20:36 +0100 (CET)
    2.10 +Received: from vmmailrelay1.informatik.tu-muenchen.de (localhost [127.0.0.1])
    2.11 +	by vmmailrelay1.informatik.tu-muenchen.de (Postfix) with ESMTP id 4E1701C0382
    2.12 +	for <krista@gnunet.org>; Wed,  2 Nov 2016 20:20:36 +0100 (CET)
    2.13 +Received: from vmmaildmz2.informatik.tu-muenchen.de (vmmaildmz2.informatik.tu-muenchen.de [131.159.0.88])
    2.14 +	by vmmailrelay1.informatik.tu-muenchen.de (Postfix) with ESMTP id 393B01C0381
    2.15 +	for <krista@gnunet.org>; Wed,  2 Nov 2016 20:20:36 +0100 (CET)
    2.16 +Received: by vmmaildmz2.informatik.tu-muenchen.de (Postfix, from userid 109)
    2.17 +	id 36E491C2A2C; Wed,  2 Nov 2016 20:20:36 +0100 (CET)
    2.18 +X-Spam-Checker-Version: SpamAssassin 3.4.0-tuminfo_1 (2014-02-07) on
    2.19 +	vmmaildmz2.informatik.tu-muenchen.de
    2.20 +X-Spam-Level: 
    2.21 +X-Spam-Status: No, score=-2.6 required=7.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,
    2.22 +	RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,TVD_RCVD_SPACE_BRACKET,UNPARSEABLE_RELAY
    2.23 +	autolearn=no autolearn_force=no version=3.4.0-tuminfo_1
    2.24 +Received: from vmmaildmz2.informatik.tu-muenchen.de (localhost [127.0.0.1])
    2.25 +	by vmmaildmz2.informatik.tu-muenchen.de (Postfix) with ESMTP id 797A71C2A66
    2.26 +	for <krista@gnunet.org>; Wed,  2 Nov 2016 20:20:34 +0100 (CET)
    2.27 +Received: from mi4-p00-ob.smtp.rzone.de (mi4-p00-ob.smtp.rzone.de [81.169.146.146])
    2.28 +	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
    2.29 +	(No client certificate requested)
    2.30 +	by vmmaildmz2.informatik.tu-muenchen.de (Postfix) with ESMTPS id 68A321C02CC
    2.31 +	for <krista@gnunet.org>; Wed,  2 Nov 2016 20:20:33 +0100 (CET)
    2.32 +X-RZG-FWD-BY: test@angryshark.eu
    2.33 +Received: from mailin.rzone.de ([unix socket])
    2.34 +	by mailin.rzone.de (RZmta 39.7) with LMTPA;
    2.35 +	Wed, 2 Nov 2016 20:20:28 +0100 (CET)
    2.36 +Authentication-Results: strato.com 1;
    2.37 +	spf=none
    2.38 +		smtp.mailfrom="pep.test.alice@pep-project.org";
    2.39 +	dkim=none;
    2.40 +	domainkeys=none;
    2.41 +	dkim-adsp=none
    2.42 +		header.from="pep.test.alice@pep-project.org"
    2.43 +X-Strato-MessageType: email
    2.44 +X-RZG-CLASS-ID: mi
    2.45 +Received-SPF: none
    2.46 +	client-ip=94.231.81.244;
    2.47 +	helo="dragon.pibit.ch";
    2.48 +	envelope-from="pep.test.alice@pep-project.org";
    2.49 +	receiver=smtpin.rzone.de;
    2.50 +	identity=mailfrom;
    2.51 +Received: from dragon.pibit.ch ([94.231.81.244])
    2.52 +	by smtpin.rzone.de (RZmta 39.7 OK)
    2.53 +	with ESMTPS id m04c20sA2JKSgNd
    2.54 +	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA))
    2.55 +	(Client did not present a certificate)
    2.56 +	for <test@angryshark.eu>;
    2.57 +	Wed, 2 Nov 2016 20:20:28 +0100 (CET)
    2.58 +Received: from localhost (localhost [127.0.0.1])
    2.59 +	by dragon.pibit.ch (Postfix) with ESMTP id 4C5BA171C05E
    2.60 +	for <test@angryshark.eu>; Wed,  2 Nov 2016 20:20:27 +0100 (CET)
    2.61 +Received: from dragon.pibit.ch ([127.0.0.1])
    2.62 +	by localhost (dragon.pibit.ch [127.0.0.1]) (amavisd-new, port 10024)
    2.63 +	with ESMTP id 9y_PjgIcEzyi for <test@angryshark.eu>;
    2.64 +	Wed,  2 Nov 2016 20:20:17 +0100 (CET)
    2.65 +Received: from [192.168.178.22] (ip5f58440e.dynamic.kabel-deutschland.de [95.88.68.14])
    2.66 +	by dragon.pibit.ch (Postfix) with ESMTPSA id 5F384171C055
    2.67 +	for <test@angryshark.eu>; Wed,  2 Nov 2016 20:20:17 +0100 (CET)
    2.68 +Reply-To: Krista Grothoff <krista@pep-project.org>
    2.69 +To: test@angryshark.eu
    2.70 +From: pEp Test Alice <pep.test.alice@pep-project.org>
    2.71 +Subject: CORRUPTED_SUBJECT
    2.72 +Organization: pEp
    2.73 +Message-ID: <399a4b78-c7ff-5059-84d1-6fbfdc58d8b0@pep-project.org>
    2.74 +Date: Wed, 2 Nov 2016 20:20:16 +0100
    2.75 +User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
    2.76 + Thunderbird/45.3.0
    2.77 +MIME-Version: 1.0
    2.78 +Content-Type: multipart/signed; micalg=pgp-sha256;
    2.79 + protocol="application/pgp-signature";
    2.80 + boundary="bNfBECNrQ83lRheD32COVbJMHia7nfALR"
    2.81 +
    2.82 +This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
    2.83 +--bNfBECNrQ83lRheD32COVbJMHia7nfALR
    2.84 +Content-Type: multipart/mixed; boundary="b9aeIUakheSa87dNo1giS9K16j8nN3xUc";
    2.85 + protected-headers="v1"
    2.86 +From: pEp Test Alice <pep.test.alice@pep-project.org>
    2.87 +Reply-To: Krista Grothoff <krista@pep-project.org>
    2.88 +To: test@angryshark.eu
    2.89 +Message-ID: <399a4b78-c7ff-5059-84d1-6fbfdc58d8b0@pep-project.org>
    2.90 +Subject: Testing
    2.91 +
    2.92 +--b9aeIUakheSa87dNo1giS9K16j8nN3xUc
    2.93 +Content-Type: text/plain; charset=utf-8
    2.94 +Content-Transfer-Encoding: quoted-printable
    2.95 +
    2.96 +Does Memoryhole even apply?
    2.97 +
    2.98 +
    2.99 +--b9aeIUakheSa87dNo1giS9K16j8nN3xUc--
   2.100 +
   2.101 +--bNfBECNrQ83lRheD32COVbJMHia7nfALR
   2.102 +Content-Type: application/pgp-signature; name="signature.asc"
   2.103 +Content-Description: OpenPGP digital signature
   2.104 +Content-Disposition: attachment; filename="signature.asc"
   2.105 +
   2.106 +-----BEGIN PGP SIGNATURE-----
   2.107 +
   2.108 +iQEcBAEBCAAGBQJYGjxwAAoJEKlBHRdv8A6XJOoIAJjAqT0qa0D9HkqpFGony1Cs
   2.109 +HXdd+1nI6uXERc1Wl8BIEF1W+wAb8bsRBqswwDs2tuk7tcxGQFWenIOk9whHuy4k
   2.110 +XF+BF0kjbeVziwcwSPx4+S7J6UM24XpOC3f3Zw86k5aepSixnjibEyKUDqLm7hR2
   2.111 +rF9v7JVwtf0ndHFMis3h6GV4JRt6JmNdyTd7t6NnTGQqTVlkeXNjus6rdWUGuBlO
   2.112 +wVty+UKRm2f776ygxvGtHnrrTXVMCdDktzFF4bZteOZNgBOBxgp3BCj2wjURQi3o
   2.113 +hkqN6LJkY+AytTSYA8AsGOC05XwQDj6/E63MCeVZzEmFCQdcfCbvRWVYoU6gwJg=
   2.114 +=tavx
   2.115 +-----END PGP SIGNATURE-----
   2.116 +
   2.117 +--bNfBECNrQ83lRheD32COVbJMHia7nfALR--
   2.118 +