src/keymanagement.c
changeset 3216 f7a5d25e60d5
parent 3182 32e3b6f20291
child 3221 47b815c5ba76
     1.1 --- a/src/keymanagement.c	Tue Dec 18 08:58:51 2018 +0100
     1.2 +++ b/src/keymanagement.c	Thu Jan 10 18:57:53 2019 +0100
     1.3 @@ -1104,9 +1104,13 @@
     1.4          identity->comm_type = PEP_ct_unknown;
     1.5      }
     1.6      
     1.7 -    status = set_identity(session, identity);
     1.8 -    if (status == PEP_STATUS_OK)
     1.9 -        status = set_as_pep_user(session, identity);
    1.10 +    // We want to set an identity in the DB even if a key isn't found, but we have to preserve the status if
    1.11 +    // it's NOT ok
    1.12 +    PEP_STATUS set_id_status = set_identity(session, identity);
    1.13 +    if (set_id_status == PEP_STATUS_OK)
    1.14 +        set_id_status = set_as_pep_user(session, identity);
    1.15 +
    1.16 +    status = (status == PEP_STATUS_OK ? set_id_status : status);
    1.17  
    1.18  pep_free:    
    1.19      free(default_own_id);