Myself was returning OK, even when it needed to and could not generate a key. Fixed.
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 10 Jan 2019 18:57:53 +0100
changeset 3216f7a5d25e60d5
parent 3192 8797e99f7ab2
child 3217 79720a7b9c49
Myself was returning OK, even when it needed to and could not generate a key. Fixed.
src/keymanagement.c
     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);