diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/openssl.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c index 1307852..5835a0a 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
| @@ -5019,8 +5019,52 @@ static int xe_new(lua_State *L) { | |||
| 5019 | X509V3_set_nconf(ctx, conf); | 5019 | X509V3_set_nconf(ctx, conf); |
| 5020 | break; | 5020 | break; |
| 5021 | } | 5021 | } |
| 5022 | case LUA_TTABLE: { | ||
| 5023 | X509 *issuer = NULL; | ||
| 5024 | X509 *subject = NULL; | ||
| 5025 | X509_REQ *request = NULL; | ||
| 5026 | X509_CRL *crl = NULL; | ||
| 5027 | int flags = 0; | ||
| 5028 | |||
| 5029 | ctx = &cbuf; | ||
| 5030 | |||
| 5031 | if (lua_getfield(L, 3, "db") != LUA_TNIL) { | ||
| 5032 | if (!(conf = loadconf(L, -1))) | ||
| 5033 | goto error; | ||
| 5034 | X509V3_set_nconf(ctx, conf); | ||
| 5035 | } | ||
| 5036 | lua_pop(L, 1); | ||
| 5037 | |||
| 5038 | if (lua_getfield(L, 3, "issuer") != LUA_TNIL) { | ||
| 5039 | issuer = checksimple(L, -1, X509_CERT_CLASS); | ||
| 5040 | } | ||
| 5041 | lua_pop(L, 1); | ||
| 5042 | |||
| 5043 | if (lua_getfield(L, 3, "subject") != LUA_TNIL) { | ||
| 5044 | subject = checksimple(L, -1, X509_CERT_CLASS); | ||
| 5045 | } | ||
| 5046 | lua_pop(L, 1); | ||
| 5047 | |||
| 5048 | if (lua_getfield(L, 3, "request") != LUA_TNIL) { | ||
| 5049 | request = checksimple(L, -1, X509_CSR_CLASS); | ||
| 5050 | } | ||
| 5051 | lua_pop(L, 1); | ||
| 5052 | |||
| 5053 | if (lua_getfield(L, 3, "crl") != LUA_TNIL) { | ||
| 5054 | crl = checksimple(L, -1, X509_CRL_CLASS); | ||
| 5055 | } | ||
| 5056 | lua_pop(L, 1); | ||
| 5057 | |||
| 5058 | if (lua_getfield(L, 3, "flags") != LUA_TNIL) { | ||
| 5059 | flags = luaL_checkinteger(L, -1); | ||
| 5060 | } | ||
| 5061 | lua_pop(L, 1); | ||
| 5062 | |||
| 5063 | X509V3_set_ctx(ctx, issuer, subject, request, crl, flags); | ||
| 5064 | break; | ||
| 5065 | } | ||
| 5022 | default: | 5066 | default: |
| 5023 | return luaL_argerror(L, 3, "invalid extra parameter (expected string or nil)"); | 5067 | return luaL_argerror(L, 3, "invalid extra parameter (expected string, table or nil)"); |
| 5024 | } | 5068 | } |
| 5025 | 5069 | ||
| 5026 | /* | 5070 | /* |
