diff options
author | William Ahern <william@25thandclement.com> | 2016-11-23 18:04:05 -0800 |
---|---|---|
committer | William Ahern <william@25thandclement.com> | 2016-11-23 18:04:05 -0800 |
commit | 8644acae6e60a6f410dfdbd77bda5d1d96696155 (patch) | |
tree | 7edd9bb92d43e0adddab8097fb8dcc1d24e09033 /src | |
parent | d755ec421ba146603a5b36320ddc1bfe82f9cd49 (diff) | |
parent | f343f2dd6ed3637d9eebf6b88ff752774c005674 (diff) | |
download | luaossl-8644acae6e60a6f410dfdbd77bda5d1d96696155.tar.gz luaossl-8644acae6e60a6f410dfdbd77bda5d1d96696155.tar.bz2 luaossl-8644acae6e60a6f410dfdbd77bda5d1d96696155.zip |
Merge branch '68-bind-X509_STORE_add_crl' of https://github.com/daurnimator/luaossl into daurnimator-68-bind-X509_STORE_add_crl
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/openssl.c b/src/openssl.c index a8829ab..8af1d3d 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -6834,17 +6834,24 @@ static int xs_interpose(lua_State *L) { static int xs_add(lua_State *L) { X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); int i, top = lua_gettop(L); + X509 *crt, *crt_dup; + X509_CRL *crl, *crl_dup; for (i = 2; i <= top; i++) { - if (lua_isuserdata(L, i)) { - X509 *crt = checksimple(L, i, X509_CERT_CLASS); - X509 *dup; + if ((crt = testsimple(L, i, X509_CERT_CLASS))) { + if (!(crt_dup = X509_dup(crt))) + return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); - if (!(dup = X509_dup(crt))) + if (!X509_STORE_add_cert(store, crt_dup)) { + X509_free(crt_dup); + return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); + } + } else if ((crl = testsimple(L, i, X509_CRL_CLASS))) { + if (!(crl_dup = X509_CRL_dup(crl))) return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); - if (!X509_STORE_add_cert(store, dup)) { - X509_free(dup); + if (!X509_STORE_add_crl(store, crl_dup)) { + X509_CRL_free(crl_dup); return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); } } else { |