# HG changeset patch # User jbe # Date 1471788731 -7200 # Node ID 832741713761622e4f96c86791f11a6c870a4056 # Parent 1dbc5c27b279708e92ee8bec4ffe1baf4c5d2a4a Process "verify_client" field in moonbridge_io.tlsconf{...} diff -r 1dbc5c27b279 -r 832741713761 moonbridge_io.c --- a/moonbridge_io.c Sun Aug 21 15:31:34 2016 +0200 +++ b/moonbridge_io.c Sun Aug 21 16:12:11 2016 +0200 @@ -1688,6 +1688,19 @@ moonbr_io_tlsconf_binary("certificate", "cert_mem", tls_config_set_cert_mem); moonbr_io_tlsconf_string("key file", "key_file", tls_config_set_key_file); moonbr_io_tlsconf_binary("key", "key_mem", tls_config_set_key_mem); + lua_getfield(L, 1, "verify_client"); + if (lua_toboolean(L, -1)) { + if (lua_type(L, -1) == LUA_TSTRING) value = lua_tostring(L, -1); + else value = ""; + if (!strcmp(value, "required")) { + tls_config_verify_client(tlsconf); + } else if (!strcmp(value, "optional")) { + tls_config_verify_client_optional(tlsconf); + } else { + luaL_argcheck(L, 0, 1, "field \"verify_client\" must be set to \"required\", \"optional\", or be false or nil"); + } + } + lua_pop(L, 1); return 1; }