aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-07-20 13:04:11 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-07-20 13:44:20 +1000
commitd19dc1efbab219a1ccd673c7c1da4702332ea3a7 (patch)
tree85a35268e5a8a37893713c084957fffdb79f2428
parent162c872aecab9068e752805d36aae63ec4ae24ce (diff)
downloadluaossl-d19dc1efbab219a1ccd673c7c1da4702332ea3a7.tar.gz
luaossl-d19dc1efbab219a1ccd673c7c1da4702332ea3a7.tar.bz2
luaossl-d19dc1efbab219a1ccd673c7c1da4702332ea3a7.zip
src/openssl.c: Bind SSL_get_SSL_CTX as ssl:getContext()
-rw-r--r--doc/luaossl.tex4
-rw-r--r--src/openssl.c13
2 files changed, 17 insertions, 0 deletions
diff --git a/doc/luaossl.tex b/doc/luaossl.tex
index 60af781..8695949 100644
--- a/doc/luaossl.tex
+++ b/doc/luaossl.tex
@@ -1029,6 +1029,10 @@ Add or interpose an ssl class method. Returns the previous method, if any.
Replaces the \module{openssl.ssl.context} used by $ssl$ with $context$.
+\subsubsection[\fn{ssl:getContext}]{\fn{ssl:getContext()}}
+
+Returns the \module{openssl.ssl.context} used by $ssl$.
+
\subsubsection[\fn{ssl:setOptions}]{\fn{ssl:setOptions($flags$)}}
Adds the option flags of the SSL connection instance. See \fn{openssl.ssl.context:setOptions}.
diff --git a/src/openssl.c b/src/openssl.c
index f1feebf..102408e 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -9262,6 +9262,18 @@ static int ssl_setContext(lua_State *L) {
return 1;
} /* ssl_setContext() */
+
+static int ssl_getContext(lua_State *L) {
+ SSL *ssl = checksimple(L, 1, SSL_CLASS);
+
+ SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
+
+ sx_push(L, ctx);
+
+ return 1;
+} /* ssl_getContext() */
+
+
static int ssl_setOptions(lua_State *L) {
SSL *ssl = checksimple(L, 1, SSL_CLASS);
auxL_Integer options = auxL_checkinteger(L, 2);
@@ -9768,6 +9780,7 @@ static int ssl__gc(lua_State *L) {
static const auxL_Reg ssl_methods[] = {
{ "setContext", &ssl_setContext },
+ { "getContext", &ssl_getContext },
{ "setOptions", &ssl_setOptions },
{ "getOptions", &ssl_getOptions },
{ "clearOptions", &ssl_clearOptions },