Myself was returning OK, even when it needed to and could not generate a key. Fixed. sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 10 Jan 2019 18:57:53 +0100
branchsync
changeset 321479dacdb24a4b
parent 3213 e56efa502f08
child 3215 724e09e831f1
child 3218 03a18842da11
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	Fri Dec 28 12:47:31 2018 +0100
     1.2 +++ b/src/keymanagement.c	Thu Jan 10 18:57:53 2019 +0100
     1.3 @@ -1140,9 +1140,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);