aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 },