Don't call finish function if it isn't set.
Fix OID module.
This commit is contained in:
parent
adcc235ef6
commit
834d37ed86
@ -1011,6 +1011,7 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_I2D_PUBLICKEY 164
|
||||
#define ASN1_F_I2D_RSA_PUBKEY 165
|
||||
#define ASN1_F_LONG_C2I 166
|
||||
#define ASN1_F_OID_MODULE_INIT 174
|
||||
#define ASN1_F_PKCS5_PBE2_SET 167
|
||||
#define ASN1_F_X509_CINF_NEW 168
|
||||
#define ASN1_F_X509_CRL_ADD0_REVOKED 169
|
||||
@ -1020,6 +1021,7 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_F_X509_PKEY_NEW 173
|
||||
|
||||
/* Reason codes. */
|
||||
#define ASN1_R_ADDING_OBJECT 171
|
||||
#define ASN1_R_AUX_ERROR 100
|
||||
#define ASN1_R_BAD_CLASS 101
|
||||
#define ASN1_R_BAD_OBJECT_HEADER 102
|
||||
@ -1033,6 +1035,7 @@ void ERR_load_ASN1_strings(void);
|
||||
#define ASN1_R_DECODE_ERROR 110
|
||||
#define ASN1_R_DECODING_ERROR 111
|
||||
#define ASN1_R_ENCODE_ERROR 112
|
||||
#define ASN1_R_ERROR_LOADING_SECTION 172
|
||||
#define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
|
||||
#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||
#define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||
|
@ -133,6 +133,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
{ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"},
|
||||
{ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"},
|
||||
{ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"},
|
||||
{ERR_PACK(0,ASN1_F_OID_MODULE_INIT,0), "OID_MODULE_INIT"},
|
||||
{ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"},
|
||||
{ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"},
|
||||
{ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"},
|
||||
@ -145,6 +146,7 @@ static ERR_STRING_DATA ASN1_str_functs[]=
|
||||
|
||||
static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||
{
|
||||
{ASN1_R_ADDING_OBJECT ,"adding object"},
|
||||
{ASN1_R_AUX_ERROR ,"aux error"},
|
||||
{ASN1_R_BAD_CLASS ,"bad class"},
|
||||
{ASN1_R_BAD_OBJECT_HEADER ,"bad object header"},
|
||||
@ -158,6 +160,7 @@ static ERR_STRING_DATA ASN1_str_reasons[]=
|
||||
{ASN1_R_DECODE_ERROR ,"decode error"},
|
||||
{ASN1_R_DECODING_ERROR ,"decoding error"},
|
||||
{ASN1_R_ENCODE_ERROR ,"encode error"},
|
||||
{ASN1_R_ERROR_LOADING_SECTION ,"error loading section"},
|
||||
{ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"},
|
||||
{ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"},
|
||||
{ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"},
|
||||
|
@ -68,18 +68,29 @@
|
||||
/* NOTE: doesn't do anything other than print debug messages yet... */
|
||||
static int oid_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
{
|
||||
fprintf(stderr, "Called oid_module_init: name %s, value %s\n",
|
||||
CONF_imodule_get_name(md), CONF_imodule_get_value(md));
|
||||
int i;
|
||||
const char *oid_section;
|
||||
STACK_OF(CONF_VALUE) *sktmp;
|
||||
CONF_VALUE *oval;
|
||||
oid_section = CONF_imodule_get_value(md);
|
||||
if(!(sktmp = NCONF_get_section(cnf, oid_section)))
|
||||
{
|
||||
ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ERROR_LOADING_SECTION);
|
||||
return 0;
|
||||
}
|
||||
for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++)
|
||||
{
|
||||
oval = sk_CONF_VALUE_value(sktmp, i);
|
||||
if(OBJ_create(oval->value, oval->name, oval->name) == NID_undef)
|
||||
{
|
||||
ASN1err(ASN1_F_OID_MODULE_INIT, ASN1_R_ADDING_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void oid_module_finish(CONF_IMODULE *md)
|
||||
{
|
||||
fprintf(stderr, "Called oid_module_finish: name %s, value %s\n",
|
||||
CONF_imodule_get_name(md), CONF_imodule_get_value(md));
|
||||
}
|
||||
}
|
||||
|
||||
void ASN1_add_oid_module(void)
|
||||
{
|
||||
CONF_module_add("oid_section", oid_module_init, oid_module_finish);
|
||||
CONF_module_add("oid_section", oid_module_init, 0);
|
||||
}
|
||||
|
@ -256,11 +256,6 @@ static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value,
|
||||
goto err;
|
||||
}
|
||||
ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name);
|
||||
if (!ffunc)
|
||||
{
|
||||
errcode = CONF_R_MISSING_FINISH_FUNCTION;
|
||||
goto err;
|
||||
}
|
||||
/* All OK, add module */
|
||||
md = module_add(dso, name, ifunc, ffunc);
|
||||
|
||||
@ -458,7 +453,8 @@ void CONF_modules_finish(void)
|
||||
|
||||
static void module_finish(CONF_IMODULE *imod)
|
||||
{
|
||||
imod->pmod->finish(imod);
|
||||
if (imod->pmod->finish)
|
||||
imod->pmod->finish(imod);
|
||||
imod->pmod->links--;
|
||||
OPENSSL_free(imod->name);
|
||||
OPENSSL_free(imod->value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user