summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Ahern <william@25thandclement.com>2016-12-08 16:42:49 -0800
committerWilliam Ahern <william@25thandclement.com>2016-12-08 16:42:49 -0800
commit3d740aca7a31747525a2e67f4d699fd75cf8c6f0 (patch)
treea42f45710c23f52e6bde58e2f39eb9e1d7a44929
parentdb1240b586261e3404975fa0a00a90a5cffe7363 (diff)
parent33ac392bf9b18789382af635c97d58742ab0bce3 (diff)
downloadluaossl-3d740aca7a31747525a2e67f4d699fd75cf8c6f0.tar.gz
luaossl-3d740aca7a31747525a2e67f4d699fd75cf8c6f0.tar.bz2
luaossl-3d740aca7a31747525a2e67f4d699fd75cf8c6f0.zip
Merge branch 'SSL_new' of https://github.com/daurnimator/luaossl into daurnimator-SSL_new
-rw-r--r--src/openssl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 38c9888..a92df1a 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -7903,7 +7903,13 @@ static SSL *ssl_push(lua_State *L, SSL *ssl) {
7903} /* ssl_push() */ 7903} /* ssl_push() */
7904 7904
7905static int ssl_new(lua_State *L) { 7905static int ssl_new(lua_State *L) {
7906 lua_pushnil(L); 7906 SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS);
7907 SSL **ud = prepsimple(L, SSL_CLASS);
7908
7909 *ud = SSL_new(ctx);
7910
7911 if (!*ud)
7912 return auxL_error(L, auxL_EOPENSSL, "ssl.new");
7907 7913
7908 return 1; 7914 return 1;
7909} /* ssl_new() */ 7915} /* ssl_new() */
@@ -8008,7 +8014,7 @@ static int ssl_getHostName(lua_State *L) {
8008 8014
8009static int ssl_setHostName(lua_State *L) { 8015static int ssl_setHostName(lua_State *L) {
8010 SSL *ssl = checksimple(L, 1, SSL_CLASS); 8016 SSL *ssl = checksimple(L, 1, SSL_CLASS);
8011 const char *host = luaL_checkstring(L, 2); 8017 const char *host = luaL_optstring(L, 2, NULL);
8012 8018
8013 if (!SSL_set_tlsext_host_name(ssl, host)) 8019 if (!SSL_set_tlsext_host_name(ssl, host))
8014 return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName"); 8020 return auxL_error(L, auxL_EOPENSSL, "ssl:setHostName");