static int openssl_xext_dup(lua_State* L) { X509_EXTENSION *x = CHECK_OBJECT(1, X509_EXTENSION, "openssl.x509_extension"); X509_EXTENSION *d = X509_EXTENSION_dup(x); PUSH_OBJECT(d, "openssl.x509_extension"); return 1; };
static int openssl_crl_extensions(lua_State* L) { X509_CRL *crl = CHECK_OBJECT(1, X509_CRL, "openssl.x509_crl"); if (lua_isnone(L, 2)) { STACK_OF(X509_EXTENSION) *exts = crl->crl->extensions; if (exts) { openssl_sk_x509_extension_totable(L, exts); } else lua_pushnil(L); return 1; } else { STACK_OF(X509_EXTENSION) *exts = openssl_sk_x509_extension_fromtable(L, 2); int i, n; n = sk_X509_EXTENSION_num(exts); for (i = 0; i < n; i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); X509_CRL_add_ext(crl, X509_EXTENSION_dup(ext), i); }; sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free); return openssl_pushresult(L, 1); } }
inline extension extension::clone() const { return extension(X509_EXTENSION_dup(ptr().get())); }