diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-28 15:35:05 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-28 15:35:44 +0900 |
commit | e76f076f093efb93dabf2cb042c527500f956061 (patch) | |
tree | fa77e3ae93108f518ac70a2f274ee7b3e9da5432 /ext/openssl/ossl_x509ext.c | |
parent | ef3b30ddb6cff80c1ead60cb63940e80d0fb9ec5 (diff) | |
download | ruby-openssl-e76f076f093efb93dabf2cb042c527500f956061.tar.gz |
x509ext: fix X509::ExtensionFactory#create_ext with config
The assumption in commit 1b1d520818e0 ("x509ext: fix memory leak in
X509::ExtensionFactory#config=") was wrong. The uninitialized
X509V3_CTX::db can be referred through "r2i" functions when creating
certain types of extension that use them.
Diffstat (limited to 'ext/openssl/ossl_x509ext.c')
-rw-r--r-- | ext/openssl/ossl_x509ext.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index 46df9042..b92b0786 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -231,7 +231,9 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self) obj = NewX509Ext(cX509Ext); rconf = rb_iv_get(self, "@config"); conf = NIL_P(rconf) ? NULL : DupConfigPtr(rconf); + X509V3_set_nconf(ctx, conf); ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr)); + X509V3_set_ctx_nodb(ctx); NCONF_free(conf); if (!ext){ ossl_raise(eX509ExtError, "%"PRIsVALUE" = %"PRIsVALUE, oid, valstr); |