Skip to content

Commit

Permalink
Always apply all configuration settings from the ssl section
Browse files Browse the repository at this point in the history
Even if some configuration entry is incorrect, do not
skip the remaining ones.

Fixes openssl#20789

Reviewed-by: Neil Horman <[email protected]>
Reviewed-by: Dmitry Belyavskiy <[email protected]>
(Merged from openssl#23048)

(cherry picked from commit 69c067f)
  • Loading branch information
t8m committed Dec 19, 2023
1 parent 733daf9 commit a438e52
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ssl/ssl_mcnf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static int ssl_do_config(SSL *s, SSL_CTX *ctx, const char *name, int system)
{
SSL_CONF_CTX *cctx = NULL;
size_t i, idx, cmd_count;
int rv = 0;
int err = 1;
unsigned int flags;
const SSL_METHOD *meth;
const SSL_CONF_CMD *cmds;
Expand Down Expand Up @@ -66,8 +66,10 @@ static int ssl_do_config(SSL *s, SSL_CTX *ctx, const char *name, int system)
flags |= SSL_CONF_FLAG_CLIENT;
SSL_CONF_CTX_set_flags(cctx, flags);
prev_libctx = OSSL_LIB_CTX_set0_default(libctx);
err = 0;
for (i = 0; i < cmd_count; i++) {
char *cmdstr, *arg;
int rv;

conf_ssl_get_cmd(cmds, i, &cmdstr, &arg);
rv = SSL_CONF_cmd(cctx, cmdstr, arg);
Expand All @@ -76,14 +78,15 @@ static int ssl_do_config(SSL *s, SSL_CTX *ctx, const char *name, int system)

ERR_raise_data(ERR_LIB_SSL, errcode,
"section=%s, cmd=%s, arg=%s", name, cmdstr, arg);
goto err;
++err;
}
}
rv = SSL_CONF_CTX_finish(cctx);
if (!SSL_CONF_CTX_finish(cctx))
++err;
err:
OSSL_LIB_CTX_set0_default(prev_libctx);
SSL_CONF_CTX_free(cctx);
return rv <= 0 ? 0 : 1;
return err == 0;
}

int SSL_config(SSL *s, const char *name)
Expand Down

0 comments on commit a438e52

Please sign in to comment.