src/keymanagement.c
branchENGINE-293
changeset 2219 99b05a2f117e
parent 2129 fd3108a623c5
child 2302 3fbe4956dd34
     1.1 --- a/src/keymanagement.c	Thu Oct 26 17:32:53 2017 +0200
     1.2 +++ b/src/keymanagement.c	Fri Oct 27 20:02:41 2017 +0200
     1.3 @@ -93,10 +93,14 @@
     1.4      if (!(session && identity && !EMPTYSTR(identity->address)))
     1.5          return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
     1.6  
     1.7 +    /* Ok, if I'm trying to indicate this is me in the identity struct, then
     1.8 +       call _myself */
     1.9      if (_identity_me(identity)) {
    1.10          return _myself(session, identity, false, true);
    1.11      }
    1.12  
    1.13 +    /* Otherwise, unless get_identity indicates that this is me, it's
    1.14 +       someone else as far as this syscall is concerned. */
    1.15      int _no_user_id = EMPTYSTR(identity->user_id);
    1.16      int _did_elect_new_key = 0;
    1.17  
    1.18 @@ -426,18 +430,23 @@
    1.19      assert(identity);
    1.20      assert(!EMPTYSTR(identity->address));
    1.21  
    1.22 -    assert(EMPTYSTR(identity->user_id) ||
    1.23 -           strcmp(identity->user_id, PEP_OWN_USERID) == 0);
    1.24 +    // assert(EMPTYSTR(identity->user_id) ||
    1.25 +    //        strcmp(identity->user_id, PEP_OWN_USERID) == 0);
    1.26  
    1.27 -    if (!(session && identity && !EMPTYSTR(identity->address) &&
    1.28 -            (EMPTYSTR(identity->user_id) ||
    1.29 -            strcmp(identity->user_id, PEP_OWN_USERID) == 0)))
    1.30 +    // if (!(session && identity && !EMPTYSTR(identity->address) &&
    1.31 +    //         (EMPTYSTR(identity->user_id) ||
    1.32 +    //         strcmp(identity->user_id, PEP_OWN_USERID) == 0)))
    1.33 +    //     return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
    1.34 +
    1.35 +    if (!(session && identity && !EMPTYSTR(identity->address)))
    1.36          return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
    1.37  
    1.38      identity->comm_type = PEP_ct_pEp;
    1.39      if(ignore_flags)
    1.40          identity->flags = 0;
    1.41      
    1.42 +    // FIXME: do we replace DB user_id and username if they WERE defaults?
    1.43 +
    1.44      if (EMPTYSTR(identity->user_id))
    1.45      {
    1.46          free(identity->user_id);
    1.47 @@ -450,7 +459,7 @@
    1.48      if (EMPTYSTR(identity->username))
    1.49      {
    1.50          free(identity->username);
    1.51 -        identity->username = strdup("anonymous");
    1.52 +        identity->username = strdup("Anonymous");
    1.53          assert(identity->username);
    1.54          if (identity->username == NULL)
    1.55              return PEP_OUT_OF_MEMORY;