Skip to content

Commit

Permalink
Only update parms->cert on success CID 456402
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrojnar committed Feb 19, 2025
1 parent 6b37385 commit dbc9441
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/eng_back.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ static int ENGINE_CTX_ctrl_load_cert(ENGINE_CTX *ctx, void *p)
const char *s_slot_cert_id;
X509 *cert;
} *parms = p;
X509 *cert;
PKCS11_CTX *pkcs11_ctx;

if (!parms) {
Expand All @@ -363,15 +364,16 @@ static int ENGINE_CTX_ctrl_load_cert(ENGINE_CTX *ctx, void *p)

PKCS11_set_ui_method(pkcs11_ctx, ctx->ui_method, ctx->callback_data);

parms->cert = UTIL_CTX_get_cert_from_uri(ctx->util_ctx, parms->s_slot_cert_id);
cert = UTIL_CTX_get_cert_from_uri(ctx->util_ctx, parms->s_slot_cert_id);

pthread_mutex_unlock(&ctx->lock);

if (!parms->cert) {
if (!cert) {
if (!ERR_peek_last_error())
ENGerr(ENG_F_CTX_CTRL_LOAD_CERT, ENG_R_OBJECT_NOT_FOUND);
return 0;
}
parms->cert = cert;
return 1;
}

Expand Down

0 comments on commit dbc9441

Please sign in to comment.