ENGINE-214: merged in default ENGINE-214
authorKrista Bennett <krista@pep-project.org>
Mon, 09 Oct 2017 16:54:00 +0200
branchENGINE-214
changeset 21484c114255f86d
parent 2147 22394e4b5047
parent 2146 ece6509ca285
child 2149 61bcd6a4a837
child 2151 9bc683c97475
ENGINE-214: merged in default
src/message_api.c
     1.1 --- a/Makefile	Mon Oct 09 16:34:08 2017 +0200
     1.2 +++ b/Makefile	Mon Oct 09 16:54:00 2017 +0200
     1.3 @@ -7,9 +7,6 @@
     1.4  
     1.5  include Makefile.conf
     1.6  
     1.7 -# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
     1.8 -export YML_PATH=$(YML2_PATH)
     1.9 -
    1.10  .PHONY: all
    1.11  all: _override_info
    1.12  	$(MAKE) -C asn.1 generate
     2.1 --- a/Makefile.conf	Mon Oct 09 16:34:08 2017 +0200
     2.2 +++ b/Makefile.conf	Mon Oct 09 16:54:00 2017 +0200
     2.3 @@ -45,12 +45,12 @@
     2.4  
     2.5  # If empty, create a release build.
     2.6  # Otherwise, create a debug build.
     2.7 -# This variable is ineffective in your override.conf file.
     2.8 +# This variable is ineffective in your local.conf file.
     2.9  DEBUG=YES
    2.10  
    2.11  # If empty, suppress compiler warnings.
    2.12  # Otherwise, print warnings.
    2.13 -# This variable is ineffective in your override.conf file.
    2.14 +# This variable is ineffective in your local.conf file.
    2.15  WARN=placeholder
    2.16  
    2.17  
    2.18 @@ -169,6 +169,8 @@
    2.19  
    2.20  YML2_OPTS=--encoding=utf8
    2.21  
    2.22 +# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
    2.23 +export YML_PATH=$(YML2_PATH)
    2.24  
    2.25  ######### asn1c #########
    2.26  # asn1c binary
     3.1 --- a/build-mac/pEpEngine.xcodeproj/project.pbxproj	Mon Oct 09 16:34:08 2017 +0200
     3.2 +++ b/build-mac/pEpEngine.xcodeproj/project.pbxproj	Mon Oct 09 16:54:00 2017 +0200
     3.3 @@ -931,7 +931,7 @@
     3.4  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
     3.5  				ENABLE_STRICT_OBJC_MSGSEND = YES;
     3.6  				ENABLE_TESTABILITY = YES;
     3.7 -				GCC_C_LANGUAGE_STANDARD = c11;
     3.8 +				GCC_C_LANGUAGE_STANDARD = gnu99;
     3.9  				GCC_DYNAMIC_NO_PIC = NO;
    3.10  				GCC_NO_COMMON_BLOCKS = YES;
    3.11  				GCC_OPTIMIZATION_LEVEL = 0;
    3.12 @@ -985,7 +985,7 @@
    3.13  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
    3.14  				ENABLE_NS_ASSERTIONS = NO;
    3.15  				ENABLE_STRICT_OBJC_MSGSEND = YES;
    3.16 -				GCC_C_LANGUAGE_STANDARD = c11;
    3.17 +				GCC_C_LANGUAGE_STANDARD = gnu99;
    3.18  				GCC_NO_COMMON_BLOCKS = YES;
    3.19  				GCC_PREPROCESSOR_DEFINITIONS = "USE_NETPGP=1";
    3.20  				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/mistrust_undo_test.cc	Mon Oct 09 16:54:00 2017 +0200
     4.3 @@ -0,0 +1,75 @@
     4.4 +// This file is under GNU General Public License 3.0
     4.5 +// see LICENSE.txt
     4.6 +
     4.7 +#include <stdlib.h>
     4.8 +#include <string.h>
     4.9 +#include <time.h>
    4.10 +#include "platform.h"
    4.11 +#include <iostream>
    4.12 +#include <fstream>
    4.13 +#include <assert.h>
    4.14 +#include "mime.h"
    4.15 +#include "message_api.h"
    4.16 +#include "test_util.h"
    4.17 +
    4.18 +using namespace std;
    4.19 +
    4.20 +int main() {
    4.21 +    cout << "\n*** mistrust_undo_test ***\n\n";
    4.22 +
    4.23 +    PEP_SESSION session;
    4.24 +    
    4.25 +    cout << "calling init()\n";
    4.26 +    PEP_STATUS status = init(&session);   
    4.27 +    assert(status == PEP_STATUS_OK);
    4.28 +    assert(session);
    4.29 +    cout << "init() completed.\n";
    4.30 +
    4.31 +    cout << "importing key 0x39E5DAB5." << endl;
    4.32 +    const string pub_key = slurp("test_keys/pub/mistrust.undo.test-0x39E5DAB5_pub.asc");
    4.33 +
    4.34 +    assert(pub_key.length() != 0);
    4.35 +    
    4.36 +    PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
    4.37 +    assert(statuspub == PEP_STATUS_OK);
    4.38 +    cout << "Key imported." << endl << endl;
    4.39 +    
    4.40 +    cout << "Setting up identity for mistrust.undo.test@pep-project.org and making comm_type PEP_ct_pEp."  << endl;
    4.41 +    pEp_identity* recip1 = new_identity("mistrust.undo.test@pep-project.org", NULL, "TOFU_mistrust.undo.test@pep-project.org", "Mistrust Undo");
    4.42 +    status = update_identity(session,recip1);
    4.43 +    assert(status == PEP_STATUS_OK);
    4.44 +    assert(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
    4.45 +    
    4.46 +    // This is not an external function. We use it to expedite the test since we don't do a sync exchange here.
    4.47 +    status = update_trust_for_fpr(session, recip1->fpr, PEP_ct_pEp);
    4.48 +    status = update_identity(session,recip1);
    4.49 +    assert(status == PEP_STATUS_OK);
    4.50 +    assert(recip1->comm_type == PEP_ct_pEp);
    4.51 +    assert(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
    4.52 +    cout << "mistrust.undo.test@pep-project.org set up and comm_type is PEP_ct_pEp."  << endl << endl;
    4.53 +
    4.54 +    // Ok, mistrust away
    4.55 +    cout << "Mistrusting mistrust.undo.test@pep-project.org (BACC7A60A88A39A25D99B4A545D7542F39E5DAB5)."  << endl;   
    4.56 +    status = key_mistrusted(session, recip1);
    4.57 +    assert(status == PEP_STATUS_OK);
    4.58 +    status = update_identity(session,recip1);
    4.59 +    assert(status == PEP_STATUS_OK);
    4.60 +    assert(recip1->comm_type == PEP_ct_mistrusted);
    4.61 +    cout << "Mistrusted mistrust.undo.test@pep-project.org (BACC7A60A88A39A25D99B4A545D7542F39E5DAB5) and comm_type set to PEP_ct_mistrusted)." << endl  << endl;    
    4.62 +    
    4.63 +    cout << "Undo mistrust (restore identity and trust in DB)" << endl;
    4.64 +    // Undo it
    4.65 +    status = undo_last_mistrust(session);
    4.66 +    assert(status == PEP_STATUS_OK);
    4.67 +    status = update_identity(session, recip1);
    4.68 +    assert(recip1->comm_type == PEP_ct_pEp);
    4.69 +    assert(strcmp(recip1->fpr, "BACC7A60A88A39A25D99B4A545D7542F39E5DAB5") == 0);
    4.70 +    cout << "Undo mistrust (restore identity and trust in DB) - trust is now PEP_ct_pEp." << endl << endl;
    4.71 +
    4.72 +    cout << "Success!!!" << endl << endl;
    4.73 +    
    4.74 +    free_identity(recip1);
    4.75 +    release(session);
    4.76 +
    4.77 +    return 0;
    4.78 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/test_keys/priv/mistrust.undo.test-0x39E5DAB5_priv.asc	Mon Oct 09 16:54:00 2017 +0200
     5.3 @@ -0,0 +1,57 @@
     5.4 +-----BEGIN PGP PRIVATE KEY BLOCK-----
     5.5 +
     5.6 +lQOYBFnTjWIBCAC78lI82/kYpsd/bQ7iUkQyKlOhT4e2MdnaaiTOSJf6N0liSjnt
     5.7 +Ah49e5+qus4Z3zAHgDWOZxSa7fOSPlVSAj35yM2X2Xn1nDJ5CxTYNCqluK5f811a
     5.8 +cUmvC166ZTsjdjmgNDAwzNpwmjbAEhKyibxnTd2vpJlW3+nVCCXg9JHMfuSj71t8
     5.9 +0OpZNZ3uqVqAekcY7SvMcaCQ41A44IkN/gAOK3Z/Cml62mRpsaKss85ZBJKXP7n+
    5.10 +61mKvT7EK1zc5dD2pdxROnjxDYaAGuJKtLwzoSm2/syvMY2VpTrh2rSQVI7gR+ep
    5.11 +WcGkT4kTFFP5mSrOYL5bKnUjfaybk/26G8TFABEBAAEAB/4lOJlGyj2rvyPVPZDs
    5.12 +C2TMFovXb3ut/nNpiQne/It0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gECF4AACgkQRddULznl2rUL3ggAlg6bnLr+Cw7e
    5.28 +/yYDk3Mdo0M5hN8cmeMC95CY4iwiiDjbCK2AsSCjhTGWM59hJ3pSA8x+GGBBeFCi
    5.29 +Gu0GLciEKuBPoJ1C4OFTUq5goDxvyysGHZ6OwRyfnHLl4mSEW86op0fkSHle25V9
    5.30 +lO/WjuWNwjoi9hLoW8IoN51dY0PZK69EeKuaX588nGJrOJeuZr3zLlziu9Km24Y5
    5.31 +El6M3GIZkaQcbiW2nbM/WkkRNDgRJbCp1wZIHledC6hgTjObaae1iXHzByM/62t1
    5.32 +u/GzixLaccfC5GAFGBtFI338pWaLarfSRVVbT6YBEMDJhrIcKtDWBi22yjRGxg/7
    5.33 +2Gz+mj0lLZ0DmARZ041iAQgAz34Vh5+c8qRa11f5nbWDssmC/2jxZdsX0cqSSozX
    5.34 +xuJ4l5lor/2dfqq2WCNWzdj+n8JGJrFVmpEL9rVTAARkUbNHzWv5pAe353JWkuTM
    5.35 +LIVFzdNIXymHyKck7S4QSohpoT/UA6gTtQD6kLbSFqycfkRlRWw0qYpPJEYiIdCz
    5.36 +lwEMffpu6ltzCXi3He6K7+S/XA5DXTIdArx3UMB/rJ69WCeEh77S7i5l223MmZLj
    5.37 +FIM9VRLP7SyIaOxnn1LlLCjbgT7gAX7S9aYeAWi8aZqtBcQ/wrSlvKPNYElEvFsG
    5.38 +kxrUCKYg6T1cWfU1ch4uCDqrrKdNQFpRF4NgUuFIOcnt8QARAQABAAf/YE0jjvO8
    5.39 +sz0m0EWLm+/P9R3jx8kcKOr77im3phQiXbNkxu+zj+MEwvJWeSfFtPpeiyVuy6yI
    5.40 +j5l8VP+pSxu+t9Cepa/UiJXwe+IsXjcEsDEWycWjFE/BLpas48v6Ua1oYSevrhbH
    5.41 +Nr4CjUHc1hs88rmpywPCmWGRA8PtOYaUo6NJMmTJYeDW4xqTvHu5R38iWUwAXwwP
    5.42 +JZIV7qm6ruzdfhLWYlRFGaiijPjSO6tkuP0Eu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Uz/2rr7Z5qwvRfV4aMtrz4aGh4
    5.58 +u/rtL+cuYZ38+YOc2vW35FVeMhU=
    5.59 +=pD3o
    5.60 +-----END PGP PRIVATE KEY BLOCK-----
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/test_keys/pub/mistrust.undo.test-0x39E5DAB5_pub.asc	Mon Oct 09 16:54:00 2017 +0200
     6.3 @@ -0,0 +1,30 @@
     6.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
     6.5 +
     6.6 +mQENBFnTjWIBCAC78lI82/kYpsd/bQ7iUkQyKlOhT4e2MdnaaiTOSJf6N0liSjnt
     6.7 +Ah49e5+qus4Z3zAHgDWOZxSa7fOSPlVSAj35yM2X2Xn1nDJ5CxTYNCqluK5f811a
     6.8 +cUmvC166ZTsjdjmgNDAwzNpwmjbAEhKyibxnTd2vpJlW3+nVCCXg9JHMfuSj71t8
     6.9 +0OpZNZ3uqVqAekcY7SvMcaCQ41A44IkN/gAOK3Z/Cml62mRpsaKss85ZBJKXP7n+
    6.10 +61mKvT7EK1zc5dD2pdxROnjxDYaAGuJKtLwzoSm2/syvMY2VpTrh2rSQVI7gR+ep
    6.11 +WcGkT4kTFFP5mSrOYL5bKnUjfaybk/26G8TFABEBAAG0P01pc3RydXN0IFVuZG8g
    6.12 +KERPIE5PVCBVU0UpIDxtaXN0cnVzdC51bmRvLnRlc3RAcGVwLXByb2plY3Qub3Jn
    6.13 +PokBOAQTAQgAIgUCWdONYgIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ
    6.14 +RddULznl2rUL3ggAlg6bnLr+Cw7e/yYDk3Mdo0M5hN8cmeMC95CY4iwiiDjbCK2A
    6.15 +sSCjhTGWM59hJ3pSA8x+GGBBeFCiGu0GLciEKuBPoJ1C4OFTUq5goDxvyysGHZ6O
    6.16 +wRyfnHLl4mSEW86op0fkSHle25V9lO/WjuWNwjoi9hLoW8IoN51dY0PZK69EeKua
    6.17 +X588nGJrOJeuZr3zLlziu9Km24Y5El6M3GIZkaQcbiW2nbM/WkkRNDgRJbCp1wZI
    6.18 +HledC6hgTjObaae1iXHzByM/62t1u/GzixLaccfC5GAFGBtFI338pWaLarfSRVVb
    6.19 +T6YBEMDJhrIcKtDWBi22yjRGxg/72Gz+mj0lLbkBDQRZ041iAQgAz34Vh5+c8qRa
    6.20 +11f5nbWDssmC/2jxZdsX0cqSSozXxuJ4l5lor/2dfqq2WCNWzdj+n8JGJrFVmpEL
    6.21 +9rVTAARkUbNHzWv5pAe353JWkuTMLIVFzdNIXymHyKck7S4QSohpoT/UA6gTtQD6
    6.22 +kLbSFqycfkRlRWw0qYpPJEYiIdCzlwEMffpu6ltzCXi3He6K7+S/XA5DXTIdArx3
    6.23 +UMB/rJ69WCeEh77S7i5l223MmZLjFIM9VRLP7SyIaOxnn1LlLCjbgT7gAX7S9aYe
    6.24 +AWi8aZqtBcQ/wrSlvKPNYElEvFsGkxrUCKYg6T1cWfU1ch4uCDqrrKdNQFpRF4Ng
    6.25 +UuFIOcnt8QARAQABiQEfBBgBCAAJBQJZ041iAhsMAAoJEEXXVC855dq1RHAH/iog
    6.26 +JhtuUKPaec9Mu+W9g3+lcfh+QAHvqeIuzo6ff0OJn1hQXkG8lfclhHhDw0dngLax
    6.27 +eTV3ZOYy08ScRWxWIz01BKeWXXM47MO2+qOpZsdZLwwpFb1FG7wOdsfrQWGWxfJ7
    6.28 +bew7HZOL8jG3xvWeCbXSt1BJGjA0hN1Oa9x02lwL5M/ALyYOGD0Z/F/8FG8gyQny
    6.29 +kuAnoT8zifzsv7keQDiJ+xQSrvWPAcsDsJ9XZxPd+jZ2b1q/xvMWD2WDUU4FB91u
    6.30 +KruSXnEOMo+/mr6NoSqKrkfvoQOep8Uz/2rr7Z5qwvRfV4aMtrz4aGh4u/rtL+cu
    6.31 +YZ38+YOc2vW35FVeMhU=
    6.32 +=cCkg
    6.33 +-----END PGP PUBLIC KEY BLOCK-----