|
|
@ -1172,33 +1172,41 @@ PEP_STATUS _myself(PEP_SESSION session, |
|
|
|
if (!EMPTYSTR(stored_identity->fpr)) { |
|
|
|
// Fall back / retrieve |
|
|
|
status = validate_fpr(session, stored_identity, false, true); |
|
|
|
if (status == PEP_OUT_OF_MEMORY) |
|
|
|
goto pEp_free; |
|
|
|
if (status == PEP_STATUS_OK) { |
|
|
|
if (stored_identity->comm_type >= PEP_ct_strong_but_unconfirmed) { |
|
|
|
identity->fpr = strdup(stored_identity->fpr); |
|
|
|
assert(identity->fpr); |
|
|
|
if (!identity->fpr) { |
|
|
|
status = PEP_OUT_OF_MEMORY; |
|
|
|
goto pEp_free; |
|
|
|
} |
|
|
|
valid_key_found = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
bool revoked = false; |
|
|
|
status = key_revoked(session, stored_identity->fpr, &revoked); |
|
|
|
if (status) |
|
|
|
goto pEp_free; |
|
|
|
if (revoked) { |
|
|
|
revoked_fpr = strdup(stored_identity->fpr); |
|
|
|
assert(revoked_fpr); |
|
|
|
if (!revoked_fpr) { |
|
|
|
|
|
|
|
switch (status) { |
|
|
|
case PEP_OUT_OF_MEMORY: |
|
|
|
case PEP_PASSPHRASE_REQUIRED: |
|
|
|
case PEP_WRONG_PASSPHRASE: |
|
|
|
goto pEp_free; |
|
|
|
|
|
|
|
case PEP_STATUS_OK: |
|
|
|
if (stored_identity->comm_type >= PEP_ct_strong_but_unconfirmed) { |
|
|
|
identity->fpr = strdup(stored_identity->fpr); |
|
|
|
assert(identity->fpr); |
|
|
|
if (!identity->fpr) { |
|
|
|
status = PEP_OUT_OF_MEMORY; |
|
|
|
goto pEp_free; |
|
|
|
} |
|
|
|
valid_key_found = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
bool revoked = false; |
|
|
|
status = key_revoked(session, stored_identity->fpr, &revoked); |
|
|
|
if (status) |
|
|
|
goto pEp_free; |
|
|
|
if (revoked) { |
|
|
|
revoked_fpr = strdup(stored_identity->fpr); |
|
|
|
assert(revoked_fpr); |
|
|
|
if (!revoked_fpr) { |
|
|
|
status = PEP_OUT_OF_MEMORY; |
|
|
|
goto pEp_free; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
// reconcile language, flags |
|
|
|
transfer_ident_lang_and_flags(identity, stored_identity); |
|
|
@ -1216,6 +1224,9 @@ PEP_STATUS _myself(PEP_SESSION session, |
|
|
|
status = generate_keypair(session, identity); |
|
|
|
assert(status != PEP_OUT_OF_MEMORY); |
|
|
|
|
|
|
|
if (status == PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED) |
|
|
|
goto pEp_free; |
|
|
|
|
|
|
|
if (status != PEP_STATUS_OK) { |
|
|
|
char buf[11]; |
|
|
|
snprintf(buf, 11, "%d", status); // uh, this is kludgey. FIXME |
|
|
|