openwrt: include LuCI nixio_tls_ctx_set_verify_locations method

This commit is contained in:
Bart Van Der Meerssche 2010-08-08 14:01:07 +02:00
parent 61851ad6b3
commit c8271f5fd0
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
--- /tmp/luci-0.9.0/libs/nixio/src/tls-context.c 2010-08-08 13:31:53.529481604 +0200
+++ luci-0.9.0/libs/nixio/src/tls-context.c 2010-08-08 13:38:59.501480201 +0200
@@ -65,10 +65,6 @@
return luaL_error(L, "unable to create TLS context");
}
-#ifdef WITH_CYASSL
- SSL_CTX_set_verify(*ctx, SSL_VERIFY_NONE, NULL);
-#endif
-
return 1;
}
@@ -131,6 +127,14 @@
SSL_CTX_use_certificate_file(ctx, cert, ktype));
}
+static int nixio_tls_ctx_set_verify_locations(lua_State *L) {
+ SSL_CTX *ctx = nixio__checktlsctx(L);
+ const char *CAfile = luaL_optstring(L, 2, NULL);
+ const char *CApath = luaL_optstring(L, 3, NULL);
+
+ return nixio__tls_pstatus(L, SSL_CTX_load_verify_locations(ctx, CAfile, CApath));
+}
+
static int nixio_tls_ctx_set_key(lua_State *L) {
SSL_CTX *ctx = nixio__checktlsctx(L);
const char *cert = luaL_checkstring(L, 2);
@@ -203,13 +207,14 @@
/* ctx function table */
static const luaL_reg CTX_M[] = {
{"set_cert", nixio_tls_ctx_set_cert},
- {"set_key", nixio_tls_ctx_set_key},
+ {"set_verify_locations", nixio_tls_ctx_set_verify_locations},
+ {"set_key", nixio_tls_ctx_set_key},
{"set_ciphers", nixio_tls_ctx_set_ciphers},
{"set_verify", nixio_tls_ctx_set_verify},
- {"create", nixio_tls_ctx_create},
- {"__gc", nixio_tls_ctx__gc},
+ {"create", nixio_tls_ctx_create},
+ {"__gc", nixio_tls_ctx__gc},
{"__tostring", nixio_tls_ctx__tostring},
- {NULL, NULL}
+ {NULL, NULL}
};