merged in default ENGINE-214
authorKrista Bennett <krista@pep-project.org>
Fri, 01 Sep 2017 10:32:30 +0200
branchENGINE-214
changeset 20292099e8070d96
parent 2025 d8ed439646a9
parent 2028 fa5a0fb170ba
child 2030 4df2470d9eb2
merged in default
build-mac/README.txt
doc/build-ios.md
     1.1 --- a/build-mac/README.txt	Wed Aug 30 14:42:51 2017 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,3 +0,0 @@
     1.4 -# all files in this directory are under GNU General Public License 3.0
     1.5 -# see LICENSE.txt
     1.6 -
     2.1 --- a/doc/build-ios.md	Wed Aug 30 14:42:51 2017 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,35 +0,0 @@
     2.4 -# Using NetPGP instead of GnuPG
     2.5 -## Prepare
     2.6 -
     2.7 -Get OpenSSL and build/install it as shared library.
     2.8 -
     2.9 -```
    2.10 -wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
    2.11 -tar xvfz openssl-1.0.1u.tar.gz
    2.12 -cd openssl-1.0.1u
    2.13 -./Configure darwin64-x86_64-cc --prefix=$HOME shared
    2.14 -make install
    2.15 -```
    2.16 -
    2.17 -Get and autoconf NetPGP
    2.18 -
    2.19 -```
    2.20 -cd $SRC
    2.21 -hg clone https://cacert.pep.foundation/dev/repos/netpgp-et/
    2.22 -cd netpgp-et
    2.23 -autoreconf -i
    2.24 -```
    2.25 -
    2.26 -## Build
    2.27 -
    2.28 -Important : LDFLAGS is set to help finding OpenSSL shared lib. If not set,
    2.29 -system's default libcrypto may silently be used instead, causing memory
    2.30 -corruption or crash at runtime.
    2.31 -
    2.32 -```
    2.33 -mkdir netpgp_debug
    2.34 -cd netpgp_debug
    2.35 -$SRC/netpgp-et/configure --with-openssl=$HOME --prefix=$HOME CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" LDFLAGS="-L${HOME}/lib"
    2.36 -make
    2.37 -make install
    2.38 -```
     3.1 --- a/doc/build-macos.md	Wed Aug 30 14:42:51 2017 +0200
     3.2 +++ b/doc/build-macos.md	Fri Sep 01 10:32:30 2017 +0200
     3.3 @@ -26,9 +26,6 @@
     3.4  sudo port install gpgme
     3.5  ~~~
     3.6  
     3.7 -FIXME Are `zlib openssl cyrus-sasl2` needed?
     3.8 -They were present in an older revision of the build instructions.
     3.9 -
    3.10  Ensure that `python` is Python 2.7:
    3.11  
    3.12  ~~~
    3.13 @@ -110,6 +107,18 @@
    3.14  make db
    3.15  ~~~
    3.16  
    3.17 +If your build fails with an error message similar to the following:
    3.18 +
    3.19 +~~~
    3.20 +  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 477, in _parse_localename
    3.21 +    raise ValueError, 'unknown locale: %s' % localename
    3.22 +ValueError: unknown locale: UTF-8
    3.23 +~~~
    3.24 +
    3.25 +or any other locale-related Python error, make sure Python does not have any locale-related environment variables set.
    3.26 +Usually, `unset LC_CTYPE` is sufficient to take care of the problem, but it depends on your macOS's regional and language settings and which terminal emulator you use.
    3.27 +This is a bug in Python, see [https://bugs.python.org/issue18378#msg215215](https://bugs.python.org/issue18378#msg215215).
    3.28 +
    3.29  The unit tests can be run without the engine library being installed, however `system.db` must be installed:
    3.30  
    3.31  ~~~
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/doc/build-netpgp.md	Fri Sep 01 10:32:30 2017 +0200
     4.3 @@ -0,0 +1,35 @@
     4.4 +# Using NetPGP instead of GnuPG
     4.5 +## Prepare
     4.6 +
     4.7 +Get OpenSSL and build/install it as shared library.
     4.8 +
     4.9 +```
    4.10 +wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
    4.11 +tar xvfz openssl-1.0.1u.tar.gz
    4.12 +cd openssl-1.0.1u
    4.13 +./Configure darwin64-x86_64-cc --prefix=$HOME shared
    4.14 +make install
    4.15 +```
    4.16 +
    4.17 +Get and autoconf NetPGP
    4.18 +
    4.19 +```
    4.20 +cd $SRC
    4.21 +hg clone https://cacert.pep.foundation/dev/repos/netpgp-et/
    4.22 +cd netpgp-et
    4.23 +autoreconf -i
    4.24 +```
    4.25 +
    4.26 +## Build
    4.27 +
    4.28 +Important : LDFLAGS is set to help finding OpenSSL shared lib. If not set,
    4.29 +system's default libcrypto may silently be used instead, causing memory
    4.30 +corruption or crash at runtime.
    4.31 +
    4.32 +```
    4.33 +mkdir netpgp_debug
    4.34 +cd netpgp_debug
    4.35 +$SRC/netpgp-et/configure --with-openssl=$HOME --prefix=$HOME CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" LDFLAGS="-L${HOME}/lib"
    4.36 +make
    4.37 +make install
    4.38 +```
     5.1 --- a/doc/readme.md	Wed Aug 30 14:42:51 2017 +0200
     5.2 +++ b/doc/readme.md	Fri Sep 01 10:32:30 2017 +0200
     5.3 @@ -13,10 +13,8 @@
     5.4      - GnuPG (version 2.0.30 or 2.1.16 or newer) by way of GPGME (version 1.6.0 or newer) [https://gnupg.org/](https://gnupg.org/)
     5.5      - a fork of NetPGP, [https://cacert.pep.foundation/dev/repos/netpgp-et/](https://cacert.pep.foundation/dev/repos/netpgp-et/)
     5.6    - a fork of libetpan, [https://github.com/fdik/libetpan](https://github.com/fdik/libetpan)
     5.7 -  - zlib (Oh yeah, where?), [http://zlib.net/](http://zlib.net/)
     5.8 -  - OpenSSL (Oh yeah, where?), [https://www.openssl.org](https://www.openssl.org)
     5.9 -  - Cyrus SASL (Oh yeah, where?), [https://www.cyrusimap.org](https://www.cyrusimap.org)
    5.10 -  - libcurl (Oh yeah, where?), [https://curl.haxx.se/libcurl/](https://curl.haxx.se/libcurl/)
    5.11 +  - zlib, [http://zlib.net/](http://zlib.net/)
    5.12 +  - libcurl (Only with NetPGP), [https://curl.haxx.se/libcurl/](https://curl.haxx.se/libcurl/)
    5.13    - libuuid, [https://www.kernel.org/pub/linux/utils/util-linux/](https://www.kernel.org/pub/linux/utils/util-linux/)
    5.14    - SQLite, [https://sqlite.org](https://sqlite.org)
    5.15  - compile-time dependencies
     6.1 --- a/src/mime.c	Wed Aug 30 14:42:51 2017 +0200
     6.2 +++ b/src/mime.c	Fri Sep 01 10:32:30 2017 +0200
     6.3 @@ -696,6 +696,13 @@
     6.4      assert(msg);
     6.5      assert(result);
     6.6  
     6.7 +    message* duped_msg = message_dup(msg);
     6.8 +
     6.9 +    if (!duped_msg) {
    6.10 +        status = PEP_OUT_OF_MEMORY;
    6.11 +        goto pep_error;
    6.12 +    }
    6.13 +
    6.14      //subject = (msg->shortmsg) ? msg->shortmsg : "pEp";  // not used, yet.
    6.15      plaintext = (msg->longmsg) ? msg->longmsg : "";
    6.16      htmltext = msg->longmsg_formatted;
    6.17 @@ -706,10 +713,11 @@
    6.18          
    6.19          bloblist_t* inlined_attachments = NULL;
    6.20          /* Noooooo... dirk, why do you do this to me? */
    6.21 -        split_inlined_and_attached(&inlined_attachments, &msg->attachments);
    6.22 +                
    6.23 +        split_inlined_and_attached(&inlined_attachments, &duped_msg->attachments);
    6.24  
    6.25 -        
    6.26          status = mime_html_text(plaintext, htmltext, inlined_attachments, &mime);
    6.27 +                
    6.28          if (status != PEP_STATUS_OK)
    6.29              goto pep_error;
    6.30      }
    6.31 @@ -732,7 +740,7 @@
    6.32              goto enomem;
    6.33      }
    6.34  
    6.35 -    if (msg->attachments) {
    6.36 +    if (duped_msg->attachments) {
    6.37          submime = mime;
    6.38          mime = part_multiple_new("multipart/mixed");
    6.39          assert(mime);
    6.40 @@ -750,7 +758,7 @@
    6.41          }
    6.42  
    6.43          bloblist_t *_a;
    6.44 -        for (_a = msg->attachments; _a != NULL; _a = _a->next) {
    6.45 +        for (_a = duped_msg->attachments; _a != NULL; _a = _a->next) {
    6.46  
    6.47              status = mime_attachment(_a, &submime);
    6.48              if (status != PEP_STATUS_OK)
    6.49 @@ -768,6 +776,10 @@
    6.50          }
    6.51      }
    6.52  
    6.53 +
    6.54 +
    6.55 +    if (duped_msg)
    6.56 +        free_message(duped_msg);
    6.57      *result = mime;
    6.58      return PEP_STATUS_OK;
    6.59  
    6.60 @@ -781,6 +793,9 @@
    6.61      if (submime)
    6.62          mailmime_free(submime);
    6.63  
    6.64 +    if (duped_msg)
    6.65 +        free_message(duped_msg);
    6.66 +
    6.67      return status;
    6.68  }
    6.69