moonbridge

changeset 244:832741713761

Process "verify_client" field in moonbridge_io.tlsconf{...}
author jbe
date Sun Aug 21 16:12:11 2016 +0200 (2016-08-21)
parents 1dbc5c27b279
children 29322b2a1af8
files moonbridge_io.c
line diff
     1.1 --- a/moonbridge_io.c	Sun Aug 21 15:31:34 2016 +0200
     1.2 +++ b/moonbridge_io.c	Sun Aug 21 16:12:11 2016 +0200
     1.3 @@ -1688,6 +1688,19 @@
     1.4    moonbr_io_tlsconf_binary("certificate",      "cert_mem",  tls_config_set_cert_mem);
     1.5    moonbr_io_tlsconf_string("key file",         "key_file",  tls_config_set_key_file);
     1.6    moonbr_io_tlsconf_binary("key",              "key_mem",   tls_config_set_key_mem);
     1.7 +  lua_getfield(L, 1, "verify_client");
     1.8 +  if (lua_toboolean(L, -1)) {
     1.9 +    if (lua_type(L, -1) == LUA_TSTRING) value = lua_tostring(L, -1);
    1.10 +    else value = "";
    1.11 +    if (!strcmp(value, "required")) {
    1.12 +      tls_config_verify_client(tlsconf);
    1.13 +    } else if (!strcmp(value, "optional")) {
    1.14 +      tls_config_verify_client_optional(tlsconf);
    1.15 +    } else {
    1.16 +      luaL_argcheck(L, 0, 1, "field \"verify_client\" must be set to \"required\", \"optional\", or be false or nil");
    1.17 +    }
    1.18 +  }
    1.19 +  lua_pop(L, 1);
    1.20    return 1;
    1.21  }
    1.22  

Impressum / About Us