merged in sync ENGINE-551
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 20 May 2019 07:34:35 +0200
branchENGINE-551
changeset 3731ecd9059f224d
parent 3726 14f9e0f35945
parent 3722 0f31947b826d
child 3732 fb7371ca6f90
child 3749 aa25e3e32641
merged in sync
src/pEpEngine.h
test/src/SuiteMaker.cc
     1.1 --- a/src/keymanagement.c	Fri May 17 16:35:36 2019 +0200
     1.2 +++ b/src/keymanagement.c	Mon May 20 07:34:35 2019 +0200
     1.3 @@ -1060,6 +1060,9 @@
     1.4          if (read_only) {
     1.5              free(identity->user_id);
     1.6              identity->user_id = strdup(default_own_id);
     1.7 +            assert(identity->user_id);
     1.8 +            if (!identity->user_id)
     1.9 +                return PEP_OUT_OF_MEMORY;
    1.10          }
    1.11          else {
    1.12              status = set_userid_alias(session, default_own_id, identity->user_id);
    1.13 @@ -1069,6 +1072,7 @@
    1.14                  
    1.15              free(identity->user_id);
    1.16              identity->user_id = strdup(default_own_id);
    1.17 +            assert(identity->user_id);
    1.18              if (identity->user_id == NULL) {
    1.19                  status = PEP_OUT_OF_MEMORY;
    1.20                  goto pEp_free;
    1.21 @@ -1108,11 +1112,14 @@
    1.22      if (EMPTYSTR(identity->username) || read_only) {
    1.23          bool stored_uname = (stored_identity && !EMPTYSTR(stored_identity->username));
    1.24          char* uname = (stored_uname ? stored_identity->username : identity->address);
    1.25 -        free(identity->username);
    1.26 -        identity->username = strdup(uname);
    1.27 -        if (identity->username == NULL) {
    1.28 -            status = PEP_OUT_OF_MEMORY;
    1.29 -            goto pEp_free;
    1.30 +        if (uname) {
    1.31 +            free(identity->username);
    1.32 +            identity->username = strdup(uname);
    1.33 +            assert(identity->username);
    1.34 +            if (identity->username == NULL) {
    1.35 +                status = PEP_OUT_OF_MEMORY;
    1.36 +                goto pEp_free;
    1.37 +            }
    1.38          }
    1.39      }
    1.40  
     2.1 --- a/src/pEpEngine.c	Fri May 17 16:35:36 2019 +0200
     2.2 +++ b/src/pEpEngine.c	Mon May 20 07:34:35 2019 +0200
     2.3 @@ -4997,6 +4997,9 @@
     2.4      return PEP_ENGINE_VERSION;
     2.5  }
     2.6  
     2.7 +DYNAMIC_API const char* get_protocol_version() {
     2.8 +    return PEP_VERSION;
     2.9 +}
    2.10  
    2.11  DYNAMIC_API PEP_STATUS reset_pEptest_hack(PEP_SESSION session)
    2.12  {
     3.1 --- a/src/pEpEngine.h	Fri May 17 16:35:36 2019 +0200
     3.2 +++ b/src/pEpEngine.h	Mon May 20 07:34:35 2019 +0200
     3.3 @@ -1300,6 +1300,10 @@
     3.4  //
     3.5  DYNAMIC_API const char* get_engine_version();
     3.6  
     3.7 +// get_protocol_version() - returns the pEp protocol version
     3.8 +
     3.9 +DYNAMIC_API const char *get_protocol_version();
    3.10 +
    3.11  // is_pEp_user() - returns true if the USER corresponding to this identity 
    3.12  //                 has been listed in the *person* table as a pEp user. 
    3.13  //
     4.1 --- a/sync/cond_act_sync.yml2	Fri May 17 16:35:36 2019 +0200
     4.2 +++ b/sync/cond_act_sync.yml2	Mon May 20 07:34:35 2019 +0200
     4.3 @@ -273,6 +273,15 @@
     4.4              }
     4.5          }
     4.6  
     4.7 +        free(partner->user_id);
     4.8 +        partner->user_id = strdup("#NV");
     4.9 +        assert(partner->user_id);
    4.10 +        if (!partner->user_id) {
    4.11 +            free_identity(me);
    4.12 +            free_identity(partner);
    4.13 +            return PEP_OUT_OF_MEMORY;
    4.14 +        }
    4.15 +
    4.16          status = session->notifyHandshake(me, partner, «$type»);
    4.17          if (status)
    4.18              return status;