diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c index 3ac0c6d..ef0c6a6 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -8020,7 +8020,13 @@ static SSL *ssl_push(lua_State *L, SSL *ssl) { | |||
8020 | } /* ssl_push() */ | 8020 | } /* ssl_push() */ |
8021 | 8021 | ||
8022 | static int ssl_new(lua_State *L) { | 8022 | static int ssl_new(lua_State *L) { |
8023 | lua_pushnil(L); | 8023 | SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS); |
8024 | SSL **ud = prepsimple(L, SSL_CLASS); | ||
8025 | |||
8026 | *ud = SSL_new(ctx); | ||
8027 | |||
8028 | if (!*ud) | ||
8029 | return auxL_error(L, auxL_EOPENSSL, "ssl.new"); | ||
8024 | 8030 | ||
8025 | return 1; | 8031 | return 1; |
8026 | } /* ssl_new() */ | 8032 | } /* ssl_new() */ |
@@ -8157,7 +8163,7 @@ static int ssl_getHostName(lua_State *L) { | |||
8157 | 8163 | ||
8158 | static int ssl_setHostName(lua_State *L) { | 8164 | static int ssl_setHostName(lua_State *L) { |
8159 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | 8165 | SSL *ssl = checksimple(L, 1, SSL_CLASS); |
8160 | const char *host = luaL_checkstring(L, 2); | 8166 | const char *host = luaL_optstring(L, 2, NULL); |
8161 | 8167 | ||
8162 | if (!SSL_set_tlsext_host_name(ssl, host)) | 8168 | if (!SSL_set_tlsext_host_name(ssl, host)) |
8163 | return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName"); | 8169 | return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName"); |