Avoid coredumps for CONF_get_...(NULL, ...)

This commit is contained in:
Bodo Möller
2001-02-06 10:14:57 +00:00
parent 43a5e1409e
commit c7410f2693
2 changed files with 48 additions and 18 deletions

View File

@@ -4,6 +4,15 @@
Changes between 0.9.6 and 0.9.6a [xx XXX 2001] Changes between 0.9.6 and 0.9.6a [xx XXX 2001]
*) In the NCONF_...-based implementations for CONF_... queries
(crypto/conf/conf_lib.c), if the input LHASH is NULL, avoid using
a temporary CONF structure with the data component set to NULL
(which gives segmentation faults in lh_retrieve).
Instead, use NULL for the CONF pointer in CONF_get_string and
CONF_get_number (which may use environment variables) and directly
return NULL from CONF_get_section.
[Bodo Moeller]
*) Tolerate nonRepudiation as being valid for S/MIME signing and certSign *) Tolerate nonRepudiation as being valid for S/MIME signing and certSign
keyUsage if basicConstraints absent for a CA. keyUsage if basicConstraints absent for a CA.
[Steve Henson] [Steve Henson]

View File

@@ -130,6 +130,12 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline)
} }
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section)
{
if (conf == NULL)
{
return NULL;
}
else
{ {
CONF ctmp; CONF ctmp;
@@ -140,8 +146,15 @@ STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section)
ctmp.data = conf; ctmp.data = conf;
return NCONF_get_section(&ctmp, section); return NCONF_get_section(&ctmp, section);
} }
}
char *CONF_get_string(LHASH *conf,char *group,char *name) char *CONF_get_string(LHASH *conf,char *group,char *name)
{
if (conf == NULL)
{
return NCONF_get_string(NULL, group, name);
}
else
{ {
CONF ctmp; CONF ctmp;
@@ -152,8 +165,15 @@ char *CONF_get_string(LHASH *conf,char *group,char *name)
ctmp.data = conf; ctmp.data = conf;
return NCONF_get_string(&ctmp, group, name); return NCONF_get_string(&ctmp, group, name);
} }
}
long CONF_get_number(LHASH *conf,char *group,char *name) long CONF_get_number(LHASH *conf,char *group,char *name)
{
if (conf == NULL)
{
return NCONF_get_number(NULL, group, name);
}
else
{ {
CONF ctmp; CONF ctmp;
@@ -164,6 +184,7 @@ long CONF_get_number(LHASH *conf,char *group,char *name)
ctmp.data = conf; ctmp.data = conf;
return NCONF_get_number(&ctmp, group, name); return NCONF_get_number(&ctmp, group, name);
} }
}
void CONF_free(LHASH *conf) void CONF_free(LHASH *conf)
{ {