src/keymanagement.c
branchkeysync
changeset 1043 f786ee22e281
parent 1015 3a533d848620
child 1044 10a56596be7d
     1.1 --- a/src/keymanagement.c	Tue Aug 16 19:20:20 2016 +0200
     1.2 +++ b/src/keymanagement.c	Sat Aug 20 14:45:19 2016 +0200
     1.3 @@ -356,31 +356,37 @@
     1.4  
     1.5      assert(session);
     1.6      assert(identity);
     1.7 -    assert(identity->address);
     1.8 -    assert(identity->username);
     1.9 +
    1.10      assert(EMPTYSTR(identity->user_id) ||
    1.11             strcmp(identity->user_id, PEP_OWN_USERID) == 0);
    1.12  
    1.13 -    if (!(session && identity && identity->address && identity->username &&
    1.14 -          (EMPTYSTR(identity->user_id) ||
    1.15 -           strcmp(identity->user_id, PEP_OWN_USERID) == 0)))
    1.16 +    if (!(session && identity &&
    1.17 +            (EMPTYSTR(identity->user_id) ||
    1.18 +            strcmp(identity->user_id, PEP_OWN_USERID) == 0)))
    1.19          return PEP_ILLEGAL_VALUE;
    1.20  
    1.21      identity->comm_type = PEP_ct_pEp;
    1.22      identity->me = true;
    1.23      
    1.24 -    if(EMPTYSTR(identity->user_id))
    1.25 +    if (EMPTYSTR(identity->user_id))
    1.26      {
    1.27          free(identity->user_id);
    1.28          identity->user_id = strdup(PEP_OWN_USERID);
    1.29          assert(identity->user_id);
    1.30          if (identity->user_id == NULL)
    1.31 -        {
    1.32              return PEP_OUT_OF_MEMORY;
    1.33 -        }
    1.34      }
    1.35  
    1.36 -    DEBUG_LOG("myself", "debug", identity->address);
    1.37 +    if (!identity->address)
    1.38 +    {
    1.39 +        identity->address = strdup("");
    1.40 +        assert(identity->address);
    1.41 +        if (!identity->address)
    1.42 +            return PEP_OUT_OF_MEMORY;
    1.43 +    }
    1.44 +
    1.45 +    DEBUG_LOG("myself", "debug", EMPTYSTR(identity->address) ?
    1.46 +            "<default address>" : identity->address);
    1.47      
    1.48      status = get_identity(session,
    1.49                            identity->address,