openssl spkac: Fix reading SPKAC data from stdin

Fixes #15367

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15593)
This commit is contained in:
Tomas Mraz 2021-06-02 17:01:41 +02:00
parent 7d69c07ddf
commit 18d9c9bf96
1 changed files with 10 additions and 6 deletions

View File

@ -404,14 +404,18 @@ CONF *app_load_config_verbose(const char *filename, int verbose)
CONF *app_load_config_internal(const char *filename, int quiet)
{
BIO *in = NULL; /* leads to empty config in case filename == "" */
BIO *in;
CONF *conf;
if (*filename != '\0'
&& (in = bio_open_default_(filename, 'r', FORMAT_TEXT, quiet)) == NULL)
return NULL;
conf = app_load_config_bio(in, filename);
BIO_free(in);
if (filename == NULL || *filename != '\0') {
if ((in = bio_open_default_(filename, 'r', FORMAT_TEXT, quiet)) == NULL)
return NULL;
conf = app_load_config_bio(in, filename);
BIO_free(in);
} else {
/* Return empty config if filename is empty string. */
conf = NCONF_new_ex(app_libctx, NULL);
}
return conf;
}