aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar William Ahern <william@25thandclement.com> 2016-11-23 18:04:05 -0800
committerLibravatarLibravatar William Ahern <william@25thandclement.com> 2016-11-23 18:04:05 -0800
commit8644acae6e60a6f410dfdbd77bda5d1d96696155 (patch)
tree7edd9bb92d43e0adddab8097fb8dcc1d24e09033
parentd755ec421ba146603a5b36320ddc1bfe82f9cd49 (diff)
parentf343f2dd6ed3637d9eebf6b88ff752774c005674 (diff)
downloadluaossl-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
-rw-r--r--src/openssl.c19
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 {