flm01/mote/v2/openwrt/package/luci/patches/100-nixio_tls_ctx_set_verif...

48 lines
1.4 KiB
Diff

--- /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}
};