diff options
| author | William Ahern <william@25thandclement.com> | 2016-12-08 16:43:48 -0800 |
|---|---|---|
| committer | William Ahern <william@25thandclement.com> | 2016-12-08 16:43:48 -0800 |
| commit | 31b9ba81a28151f39efd8958092d70c51817f81e (patch) | |
| tree | a42f45710c23f52e6bde58e2f39eb9e1d7a44929 | |
| parent | db1240b586261e3404975fa0a00a90a5cffe7363 (diff) | |
| parent | 3d740aca7a31747525a2e67f4d699fd75cf8c6f0 (diff) | |
| download | luaossl-31b9ba81a28151f39efd8958092d70c51817f81e.tar.gz luaossl-31b9ba81a28151f39efd8958092d70c51817f81e.tar.bz2 luaossl-31b9ba81a28151f39efd8958092d70c51817f81e.zip | |
Merge branch 'daurnimator-SSL_new'
| -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 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 | ||
| 7905 | static int ssl_new(lua_State *L) { | 7905 | static 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 | ||
| 8009 | static int ssl_setHostName(lua_State *L) { | 8015 | static 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"); |
