diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-07-28 22:15:26 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-07-28 22:15:26 +0900 |
commit | bf120798efa43c9db6c68e75037fc0a0c4735703 (patch) | |
tree | d14e13da8bfae8bf7ae0249565c28175ad775abc /ext/openssl/ossl_x509store.c | |
parent | 1c244fa916f274b715594492a85fcfa57c987c2e (diff) | |
parent | 028e495734e9e6aa5dba1a2e130b08f66cf31a21 (diff) | |
download | ruby-openssl-bf120798efa43c9db6c68e75037fc0a0c4735703.tar.gz |
Merge branch 'topic/ssl-verify-hostname'
* topic/ssl-verify-hostname:
ssl: add verify_hostname option to SSLContext
test/test_ssl: avoid SSLContext#set_params where not required
Refactor common verify callback code
Diffstat (limited to 'ext/openssl/ossl_x509store.c')
-rw-r--r-- | ext/openssl/ossl_x509store.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index f3d6bf3b..ba34a056 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -106,6 +106,20 @@ DupX509StorePtr(VALUE obj) /* * Private functions */ +static int +x509store_verify_cb(int ok, X509_STORE_CTX *ctx) +{ + VALUE proc; + + proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx); + if (!proc) + proc = (VALUE)X509_STORE_get_ex_data(X509_STORE_CTX_get0_store(ctx), ossl_store_ex_verify_cb_idx); + if (!proc) + return ok; + + return ossl_verify_cb_call(proc, ok, ctx); +} + static VALUE ossl_x509store_alloc(VALUE klass) { @@ -153,7 +167,7 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self) /* [Bug #405] [Bug #1678] [Bug #3000]; already fixed? */ store->ex_data.sk = NULL; #endif - X509_STORE_set_verify_cb(store, ossl_verify_cb); + X509_STORE_set_verify_cb(store, x509store_verify_cb); ossl_x509store_set_vfy_cb(self, Qnil); /* last verification status */ |