merged default in ENGINE-179 ENGINE-179
authorEdouard Tisserant <edouard@pep-project.org>
Tue, 06 Jun 2017 09:59:41 +0200
branchENGINE-179
changeset 1820167f2913e770
parent 1815 2ce849e5ca78
parent 1819 b3e57d741b15
child 1821 dc8d47e6a02c
merged default in ENGINE-179
     1.1 --- a/src/pEpEngine.c	Thu Jun 01 22:44:16 2017 +0200
     1.2 +++ b/src/pEpEngine.c	Tue Jun 06 09:59:41 2017 +0200
     1.3 @@ -843,6 +843,12 @@
     1.4      session->keep_sync_msg = enable;
     1.5  }
     1.6  
     1.7 +DYNAMIC_API void config_service_log(PEP_SESSION session, bool enable)
     1.8 +{
     1.9 +    assert(session);
    1.10 +    session->service_log = enable;
    1.11 +}
    1.12 +
    1.13  DYNAMIC_API PEP_STATUS log_event(
    1.14          PEP_SESSION session,
    1.15          const char *title,
    1.16 @@ -883,6 +889,24 @@
    1.17      return ERROR(status);
    1.18  }
    1.19  
    1.20 +DYNAMIC_API PEP_STATUS log_service(
    1.21 +        PEP_SESSION session,
    1.22 +        const char *title,
    1.23 +        const char *entity,
    1.24 +        const char *description,
    1.25 +        const char *comment
    1.26 +    )
    1.27 +{
    1.28 +    assert(session);
    1.29 +    if (!session)
    1.30 +        return PEP_ILLEGAL_VALUE;
    1.31 +
    1.32 +    if (session->service_log)
    1.33 +        return log_event(session, title, entity, description, comment);
    1.34 +    else
    1.35 +        return PEP_STATUS_OK;
    1.36 +}
    1.37 +
    1.38  DYNAMIC_API PEP_STATUS trustword(
    1.39              PEP_SESSION session, uint16_t value, const char *lang,
    1.40              char **word, size_t *wsize
    1.41 @@ -1283,8 +1307,6 @@
    1.42                                   const char* old_fpr, 
    1.43                                   const char* new_fpr) 
    1.44  {
    1.45 -    PEP_STATUS status = PEP_STATUS_OK;
    1.46 -    
    1.47      assert(old_fpr);
    1.48      assert(new_fpr);
    1.49      
     2.1 --- a/src/pEpEngine.h	Thu Jun 01 22:44:16 2017 +0200
     2.2 +++ b/src/pEpEngine.h	Tue Jun 06 09:59:41 2017 +0200
     2.3 @@ -202,6 +202,14 @@
     2.4  DYNAMIC_API void config_keep_sync_msg(PEP_SESSION session, bool enable);
     2.5  
     2.6  
     2.7 +// config_service_log() - log more for service purposes
     2.8 +//
     2.9 +//      session (in)    session handle
    2.10 +//      enable (in)     flag if enabled or disabled
    2.11 +
    2.12 +DYNAMIC_API void config_service_log(PEP_SESSION session, bool enable);
    2.13 +
    2.14 +
    2.15  // decrypt_and_verify() - decrypt and/or verify a message
    2.16  //
    2.17  //    parameters:
    2.18 @@ -316,6 +324,17 @@
    2.19      );
    2.20  
    2.21  
    2.22 +DYNAMIC_API PEP_STATUS log_service(PEP_SESSION session, const char *title,
    2.23 +        const char *entity, const char *description, const char *comment);
    2.24 +
    2.25 +#define _STR_(x) #x
    2.26 +#define _D_STR_(x) _STR_(x)
    2.27 +#define S_LINE _D_STR_(__LINE__)
    2.28 +
    2.29 +#define SERVICE_LOG(session, title, entity, desc) \
    2.30 +    log_service((session), (title), (entity), (desc), "service " __FILE__ ":" S_LINE)
    2.31 +
    2.32 +
    2.33  // trustword() - get the corresponding trustword for a 16 bit value
    2.34  //
    2.35  //    parameters:
     3.1 --- a/src/pEp_internal.h	Thu Jun 01 22:44:16 2017 +0200
     3.2 +++ b/src/pEp_internal.h	Tue Jun 06 09:59:41 2017 +0200
     3.3 @@ -162,6 +162,7 @@
     3.4      bool passive_mode;
     3.5      bool unencrypted_subject;
     3.6      bool keep_sync_msg;
     3.7 +    bool service_log;
     3.8      
     3.9  #ifdef DEBUG_ERRORSTACK
    3.10      stringlist_t* errorstack;
    3.11 @@ -183,14 +184,14 @@
    3.12  #else
    3.13  #ifdef ANDROID
    3.14  #include <android/log.h>
    3.15 -#define  LOG_MORE(...)  __android_log_print(ANDROID_LOG_DEBUG, "pEpEngine", " %s :: %s :: %s ", __VA_ARGS__);
    3.16 +#define  LOG_MORE(...)  __android_log_print(ANDROID_LOG_DEBUG, "pEpEngine", " %s :: %s :: %s :: %s ", __VA_ARGS__);
    3.17  #else
    3.18  #include <stdio.h>
    3.19 -#define  LOG_MORE(...)  printf("pEpEngine DEBUG_LOG('%s','%s','%s')\n", __VA_ARGS__);
    3.20 +#define  LOG_MORE(...)  fprintf(stderr, "pEpEngine DEBUG_LOG('%s','%s','%s','%s')\n", __VA_ARGS__);
    3.21  #endif
    3.22  #define DEBUG_LOG(TITLE, ENTITY, DESC) {\
    3.23 -    log_event(session, (TITLE), (ENTITY), (DESC), "debug");\
    3.24 -    LOG_MORE((TITLE), (ENTITY), (DESC))\
    3.25 +    log_event(session, (TITLE), (ENTITY), (DESC), "debug " __FILE__ ":" S_LINE);\
    3.26 +    LOG_MORE((TITLE), (ENTITY), (DESC), __FILE__ ":" S_LINE)\
    3.27  }
    3.28  #endif
    3.29  
     4.1 --- a/test/external_revoke_test.cc	Thu Jun 01 22:44:16 2017 +0200
     4.2 +++ b/test/external_revoke_test.cc	Tue Jun 06 09:59:41 2017 +0200
     4.3 @@ -27,10 +27,18 @@
     4.4  
     4.5  #ifndef NETPGP
     4.6      char* fprs[2];
     4.7 -    
     4.8 +
     4.9 +    const string fenris_pub_key = slurp("test_keys/pub/pep.test.fenris-0x6DBA13DA_pub.asc");
    4.10 +    const string fenris_priv_key = slurp("test_keys/priv/pep.test.fenris-0x6DBA13DA_priv.asc");
    4.11 +
    4.12 +    PEP_STATUS statuspub = import_key(session, fenris_pub_key.c_str(), fenris_pub_key.length(), NULL);
    4.13 +    PEP_STATUS statuspriv = import_key(session, fenris_priv_key.c_str(), fenris_priv_key.length(), NULL);
    4.14 +    assert(statuspub == PEP_STATUS_OK);
    4.15 +    assert(statuspriv == PEP_STATUS_OK);
    4.16 +
    4.17      // Create sender ID
    4.18      
    4.19 -    pEp_identity * me = new_identity("pep.test.apple@pep-project.org", NULL, PEP_OWN_USERID, "Alice Cooper");
    4.20 +    pEp_identity * me = new_identity("pep.test.fenris@notrealemail.eu", NULL, PEP_OWN_USERID, "Fenris Hawke");
    4.21      status = update_identity(session, me);
    4.22      status = trust_personal_key(session, me);
    4.23      status = update_identity(session, me);
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/test_keys/priv/pep.test.fenris-0x6DBA13DA_priv.asc	Tue Jun 06 09:59:41 2017 +0200
     5.3 @@ -0,0 +1,57 @@
     5.4 +-----BEGIN PGP PRIVATE KEY BLOCK-----
     5.5 +
     5.6 +lQOYBFkxkeMBCADJZK47Qcy/vek7kFa8IdXuyveM9LUKNbQpRm2fllhXdCNm7oL1
     5.7 +09WHZVjGHBX8DJk+I0v7YyYuMgILNNnipGUYfUsYHub33p7Sg0kNzNp0PK9hiKWN
     5.8 +lel4PgWYTQzm0eijXfaWIVL6LX+YeT6/OxeJbuXwmdyf/LsMiLOpaKD/4T1aRxeX
     5.9 ++RyiSFG7t42DTN1Xt82vR306IN+rx2Ucwnlh/THPn3TJk3Gw+f/13GZKJL6efe/u
    5.10 +9uhc91KVJYPGCcuIKsQ2Px69wq6odV80MvGfrkgxlrbMPDFRd6DXFbd4W8SXrOHa
    5.11 +M/5vCeKOgByIxG6Q/CtSWFaJD2AlYGlHGeGjABEBAAEAB/wIcQLokvJ9Gv26tGse
    5.12 +SaDI+JL1wpAQFH4vuLcBmHCtgb22I8szeKSbn0DgVO8K+JA3zYzyxY4lI414YMe9
    5.13 +OzzNkPrj0O/HdfpcQop+XJbPhnenc+3UiHMXyim734bp6eSBbH/YfR8YQ230uyhJ
    5.14 +JbXv2ckjk59uyU4h0V0Ofcc50mkM2ia8CCAx/g+q8wVYqRJ+A/f55xuZdgpxmv3l
    5.15 +EcuzgEfZK0oZRlG6UybnXxiDzCba7cbxt84yH9KeLr2KQwQ5KvoOd84zDiDJoe89
    5.16 +1DB3mrKOuCHZ5+s0KwlGSZYPD7nh3j+SBBgwaqV4/FcW7r367shbPZqMJQfNhhh8
    5.17 +PKWxBADY3qAXWZWUzk1d5fRluyXDa8oiTnMq1QMWOsUFQ3iTXAZ6m5ZGIT129PZk
    5.18 +KC72F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G9dMt3h90wHYIaJkNdEQl0UWdA5gEWTGR4wEIANPQKAZeaH6iHgZU6rQCcDbA
    5.34 +uCFWUynmd6W16iiwxz6PJL2ACqvgbdQ8wBWb3UGGl4uhI9Ksar9nz+L6mOPOTvEd
    5.35 +XThRCaVzIZNz5Znos9ao+DRcAibguPE14QNiBgxe1RhRz32Q3jdEcG6Sg2SZNMvA
    5.36 +mKNZKlkL2ERvFyFfdiexfesB4E/zh6lea2up87XwlMefSTPn2yOgi+fVl3bwCoyn
    5.37 +UlX51zF+OAGBdobihDTUuU8bPibJ2uN2ilqqVGziMU4SitDqulbXtH2AcUVoaCbe
    5.38 +NPdfnEGnWXTnG8s7s9IerScH8HUL8BgoDZqQl9b5bJphRq+Jq6NmVqHPft9VpsMA
    5.39 +EQEAAQAH/RIuBpFtXvinf345oZ9rqif46JTr7N1my5QshfmSGrfS32toZwITlDmo
    5.40 +MTBpnVb3b2Brp0B4zfy5s00fBypeVcY6J/sicXqC5Dncs7M/FthwzkToNMMTfKwv
    5.41 +XK3GpxA+v3mD5BQ57+i8dg33g1GKGM74K+GxUIIuExTkmA6kO+byHAbyxYcqF6/M
    5.42 +fezKPete0R11W5NnTKZO4WOX9oGCh/jUuyTQ+bbSzxx/ds61BYG7Hitgn82WW3d4
    5.43 +cskd6llYHLTANRk41yAUn7BWUaUUmPk2HIHUCh3nyjEVrOSO0PYwWyGSaQxJG1+W
    5.44 +9TG0728IDfNMKyq7c4/X1kvRI893jwkEAOFQaNBC8vChwZ3iM8oZBVOEPraPUrJE
    5.45 +ord3mrPEfqxD6Yc/ju4YdzLe3QPo27mCBW2e9/6u5GguhaZ5QA5Z8KGgYBrKZnLK
    5.46 +3A2ZM+jIto3zCfPZAPXl6zxKbZLq/0b0toBhVpNJiVHSqagBWKmg5CJYRHaadgCM
    5.47 +ozlpHScVNNPfBADwqQi5rHHrXeS5FvKxtXYh/Aow8QBhpCrDWaP4Vmrt5pZhv/yR
    5.48 +RT2Lm0/IfSzf9qNtb0syzn8i+qr5MxNfLy9c8Jov4Xk0WD+Qo32j9SbQPoU24aIN
    5.49 +5gweN+gVCh6XgjAugUPWBAuH/B1ghDtiCd6hzjxgW2ircImU7nK8QB8pnQP/SH2n
    5.50 +VaXIYg/p4Wi0tTSuV8KYiBvOuFkXcKR6uglLrrVf5s/+8H4PeKCU2h8yNOL5iiGK
    5.51 +RJBEIrdW2qiO6sAtrxKzQ1J7WktRdpUVIHmAd+Rba8/XRW1YuXuWAS6yOTx0xdOz
    5.52 +vBtMCku+OoHdO5qXzO5ubrkDhbOAY+T5sGK419hFyIkBHwQYAQgACQUCWTGR4wIb
    5.53 +DAAKCRA4BiH8bboT2liHB/0fZSrsLuKzfHkFhE8/qF7SxgWPH0vCi1N8BnbwnTDe
    5.54 +FzoSTjSGO9//NYMJlrPk4fUExasGLr+XBNBv8zHt+Ri5ws2XtkVwfP9HPcxh6iX7
    5.55 +aqvrVZbpiE90GQSNeDBzCRPOXWqg6vIJqRX8j++yLc+9VlFcYoMT/AmOUFsiF+ZP
    5.56 +Pt4+U27SmDn0WfbpvqFDXTqkzYF+r8Y+yBieHACJ7p/gvFchnNQjYU+d5qPMPoCP
    5.57 +P4Xqq9fnfBK5N7cxgM6dgJO7HZGzbkzjdeOwNFsX9NSyfYaUhiUDkO6t4jKKswWm
    5.58 +RlF/bzjhv+z0PM9qVKZzIOlH5inYGgFAJh8CbleKxYs6
    5.59 +=f8cO
    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/pep.test.fenris-0x6DBA13DA_pub.asc	Tue Jun 06 09:59:41 2017 +0200
     6.3 @@ -0,0 +1,30 @@
     6.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
     6.5 +
     6.6 +mQENBFkxkeMBCADJZK47Qcy/vek7kFa8IdXuyveM9LUKNbQpRm2fllhXdCNm7oL1
     6.7 +09WHZVjGHBX8DJk+I0v7YyYuMgILNNn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vAmKNZKlkL2ERvFyFfdiexfesB4E/zh6lea2up
    6.23 +87XwlMefSTPn2yOgi+fVl3bwCoynUlX51zF+OAGBdobihDTUuU8bPibJ2uN2ilqq
    6.24 +VGziMU4SitDqulbXtH2AcUVoaCbeNPdfnEGnWXTnG8s7s9IerScH8HUL8BgoDZqQ
    6.25 +l9b5bJphRq+Jq6NmVqHPft9VpsMAEQEAAYkBHwQYAQgACQUCWTGR4wIbDAAKCRA4
    6.26 +BiH8bboT2liHB/0fZSrsLuKzfHkFhE8/qF7SxgWPH0vCi1N8BnbwnTDeFzoSTjSG
    6.27 +O9//NYMJlrPk4fUExasGLr+XBNBv8zHt+Ri5ws2XtkVwfP9HPcxh6iX7aqvrVZbp
    6.28 +iE90GQSNeDBzCRPOXWqg6vIJqRX8j++yLc+9VlFcYoMT/AmOUFsiF+ZPPt4+U27S
    6.29 +mDn0WfbpvqFDXTqkzYF+r8Y+yBieHACJ7p/gvFchnNQjYU+d5qPMPoCPP4Xqq9fn
    6.30 +fBK5N7cxgM6dgJO7HZGzbkzjdeOwNFsX9NSyfYaUhiUDkO6t4jKKswWmRlF/bzjh
    6.31 +v+z0PM9qVKZzIOlH5inYGgFAJh8CbleKxYs6
    6.32 +=LcZA
    6.33 +-----END PGP PUBLIC KEY BLOCK-----