diff options
| author | William Ahern <william@25thandclement.com> | 2016-11-23 18:07:03 -0800 |
|---|---|---|
| committer | William Ahern <william@25thandclement.com> | 2016-11-23 18:07:03 -0800 |
| commit | 7dbd5609c0866a101b3e0715e32ab704d91e416f (patch) | |
| tree | 7edd9bb92d43e0adddab8097fb8dcc1d24e09033 | |
| parent | d755ec421ba146603a5b36320ddc1bfe82f9cd49 (diff) | |
| parent | 8644acae6e60a6f410dfdbd77bda5d1d96696155 (diff) | |
| download | luaossl-7dbd5609c0866a101b3e0715e32ab704d91e416f.tar.gz luaossl-7dbd5609c0866a101b3e0715e32ab704d91e416f.tar.bz2 luaossl-7dbd5609c0866a101b3e0715e32ab704d91e416f.zip | |
Merge branch 'daurnimator-68-bind-X509_STORE_add_crl'
| -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) { | |||
| 6834 | static int xs_add(lua_State *L) { | 6834 | static int xs_add(lua_State *L) { |
| 6835 | X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); | 6835 | X509_STORE *store = checksimple(L, 1, X509_STORE_CLASS); |
| 6836 | int i, top = lua_gettop(L); | 6836 | int i, top = lua_gettop(L); |
| 6837 | X509 *crt, *crt_dup; | ||
| 6838 | X509_CRL *crl, *crl_dup; | ||
| 6837 | 6839 | ||
| 6838 | for (i = 2; i <= top; i++) { | 6840 | for (i = 2; i <= top; i++) { |
| 6839 | if (lua_isuserdata(L, i)) { | 6841 | if ((crt = testsimple(L, i, X509_CERT_CLASS))) { |
| 6840 | X509 *crt = checksimple(L, i, X509_CERT_CLASS); | 6842 | if (!(crt_dup = X509_dup(crt))) |
| 6841 | X509 *dup; | 6843 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); |
| 6842 | 6844 | ||
| 6843 | if (!(dup = X509_dup(crt))) | 6845 | if (!X509_STORE_add_cert(store, crt_dup)) { |
| 6846 | X509_free(crt_dup); | ||
| 6847 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); | ||
| 6848 | } | ||
| 6849 | } else if ((crl = testsimple(L, i, X509_CRL_CLASS))) { | ||
| 6850 | if (!(crl_dup = X509_CRL_dup(crl))) | ||
| 6844 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); | 6851 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); |
| 6845 | 6852 | ||
| 6846 | if (!X509_STORE_add_cert(store, dup)) { | 6853 | if (!X509_STORE_add_crl(store, crl_dup)) { |
| 6847 | X509_free(dup); | 6854 | X509_CRL_free(crl_dup); |
| 6848 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); | 6855 | return auxL_error(L, auxL_EOPENSSL, "x509.store:add"); |
| 6849 | } | 6856 | } |
| 6850 | } else { | 6857 | } else { |
