ENGINE-348 - made the same change as in sync.
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 29 Mar 2019 16:43:47 +0100
changeset 342370b418f53ed6
parent 3418 f39664cf37ff
child 3424 ba7efe8cfa2e
ENGINE-348 - made the same change as in sync.
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Fri Mar 29 08:38:26 2019 +0100
     1.2 +++ b/src/keymanagement.c	Fri Mar 29 16:43:47 2019 +0100
     1.3 @@ -1088,36 +1088,41 @@
     1.4      }
     1.5  
     1.6      // check stored identity
     1.7 -    if (stored_identity && !EMPTYSTR(stored_identity->fpr)) {
     1.8 -        // Fall back / retrieve
     1.9 -        status = validate_fpr(session, stored_identity, false, true);
    1.10 -        if (status == PEP_OUT_OF_MEMORY)
    1.11 -            goto pep_free;
    1.12 -        if (status == PEP_STATUS_OK) {
    1.13 -            if (stored_identity->comm_type >= PEP_ct_strong_but_unconfirmed) {
    1.14 -                identity->fpr = strdup(stored_identity->fpr);
    1.15 -                assert(identity->fpr);
    1.16 -                if (!identity->fpr) {
    1.17 -                    status = PEP_OUT_OF_MEMORY;
    1.18 -                    goto pep_free;
    1.19 -                }
    1.20 -                valid_key_found = true;            
    1.21 -            }
    1.22 -            else {
    1.23 -                bool revoked = false;
    1.24 -                status = key_revoked(session, stored_identity->fpr, &revoked);
    1.25 -                if (status)
    1.26 -                    goto pep_free;
    1.27 -                if (revoked) {
    1.28 -                    revoked_fpr = strdup(stored_identity->fpr);
    1.29 -                    assert(revoked_fpr);
    1.30 -                    if (!revoked_fpr) {
    1.31 +    if (stored_identity) { 
    1.32 +        if(!EMPTYSTR(stored_identity->fpr)) {
    1.33 +        
    1.34 +            // Fall back / retrieve
    1.35 +            status = validate_fpr(session, stored_identity, false, true);
    1.36 +            if (status == PEP_OUT_OF_MEMORY)
    1.37 +                goto pep_free;
    1.38 +            if (status == PEP_STATUS_OK) {
    1.39 +                if (stored_identity->comm_type >= PEP_ct_strong_but_unconfirmed) {
    1.40 +                    identity->fpr = strdup(stored_identity->fpr);
    1.41 +                    assert(identity->fpr);
    1.42 +                    if (!identity->fpr) {
    1.43                          status = PEP_OUT_OF_MEMORY;
    1.44                          goto pep_free;
    1.45                      }
    1.46 +                    valid_key_found = true;            
    1.47 +                }
    1.48 +                else {
    1.49 +                    bool revoked = false;
    1.50 +                    status = key_revoked(session, stored_identity->fpr, &revoked);
    1.51 +                    if (status)
    1.52 +                        goto pep_free;
    1.53 +                    if (revoked) {
    1.54 +                        revoked_fpr = strdup(stored_identity->fpr);
    1.55 +                        assert(revoked_fpr);
    1.56 +                        if (!revoked_fpr) {
    1.57 +                            status = PEP_OUT_OF_MEMORY;
    1.58 +                            goto pep_free;
    1.59 +                        }
    1.60 +                    }
    1.61                  }
    1.62              }
    1.63          }
    1.64 +        // reconcile language, flags
    1.65 +        transfer_ident_lang_and_flags(identity, stored_identity);
    1.66      }
    1.67      
    1.68      // Nothing left to do but generate a key