diff options
| author | daurnimator <quae@daurnimator.com> | 2017-04-03 19:49:34 +1000 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2017-04-03 19:49:34 +1000 |
| commit | e8e6bfa098bfe24fd5d6f021f030b64fffa453ff (patch) | |
| tree | 72db699ac74ddf357f030e529ccb7ab38f2010bf | |
| parent | c22a04c2d24665d5ee7615c1888ef41fdf44440f (diff) | |
| download | luaossl-e8e6bfa098bfe24fd5d6f021f030b64fffa453ff.tar.gz luaossl-e8e6bfa098bfe24fd5d6f021f030b64fffa453ff.tar.bz2 luaossl-e8e6bfa098bfe24fd5d6f021f030b64fffa453ff.zip | |
Bind SSL_set_SSL_CTX
For #84
| -rw-r--r-- | doc/luaossl.pdf | bin | 274644 -> 274840 bytes | |||
| -rw-r--r-- | doc/luaossl.tex | 4 | ||||
| -rw-r--r-- | src/openssl.c | 13 |
3 files changed, 17 insertions, 0 deletions
diff --git a/doc/luaossl.pdf b/doc/luaossl.pdf index 85c165e..106b4ea 100644 --- a/doc/luaossl.pdf +++ b/doc/luaossl.pdf | |||
| Binary files differ | |||
diff --git a/doc/luaossl.tex b/doc/luaossl.tex index bbdf055..e75a678 100644 --- a/doc/luaossl.tex +++ b/doc/luaossl.tex | |||
| @@ -981,6 +981,10 @@ A table mapping OpenSSL named constants. Includes all constants provided by \mod | |||
| 981 | \subsubsection[\fn{ssl.interpose}]{\fn{ssl.interpose($name$, $function$)}} | 981 | \subsubsection[\fn{ssl.interpose}]{\fn{ssl.interpose($name$, $function$)}} |
| 982 | Add or interpose an ssl class method. Returns the previous method, if any. | 982 | Add or interpose an ssl class method. Returns the previous method, if any. |
| 983 | 983 | ||
| 984 | \subsubsection[\fn{ssl:setContext}]{\fn{ssl:setContext($context$)}} | ||
| 985 | |||
| 986 | Replaces the \module{openssl.ssl.context} used by $ssl$ with $context$. | ||
| 987 | |||
| 984 | \subsubsection[\fn{ssl:setOptions}]{\fn{ssl:setOptions($flags$)}} | 988 | \subsubsection[\fn{ssl:setOptions}]{\fn{ssl:setOptions($flags$)}} |
| 985 | 989 | ||
| 986 | Adds the option flags of the SSL connection instance. See \fn{openssl.ssl.context:setOptions}. | 990 | 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 dc67d8a..890ca2c 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
| @@ -8316,6 +8316,18 @@ static int ssl_interpose(lua_State *L) { | |||
| 8316 | } /* ssl_interpose() */ | 8316 | } /* ssl_interpose() */ |
| 8317 | 8317 | ||
| 8318 | 8318 | ||
| 8319 | static int ssl_setContext(lua_State *L) { | ||
| 8320 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | ||
| 8321 | SSL_CTX *ctx = checksimple(L, 2, SSL_CTX_CLASS); | ||
| 8322 | |||
| 8323 | if (!SSL_set_SSL_CTX(ssl, ctx)) | ||
| 8324 | return auxL_error(L, auxL_EOPENSSL, "ssl.setContext"); | ||
| 8325 | |||
| 8326 | lua_pushboolean(L, 1); | ||
| 8327 | |||
| 8328 | return 1; | ||
| 8329 | } /* ssl_setContext() */ | ||
| 8330 | |||
| 8319 | static int ssl_setOptions(lua_State *L) { | 8331 | static int ssl_setOptions(lua_State *L) { |
| 8320 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | 8332 | SSL *ssl = checksimple(L, 1, SSL_CLASS); |
| 8321 | auxL_Integer options = auxL_checkinteger(L, 2); | 8333 | auxL_Integer options = auxL_checkinteger(L, 2); |
| @@ -8676,6 +8688,7 @@ static int ssl__gc(lua_State *L) { | |||
| 8676 | 8688 | ||
| 8677 | 8689 | ||
| 8678 | static const auxL_Reg ssl_methods[] = { | 8690 | static const auxL_Reg ssl_methods[] = { |
| 8691 | { "setContext", &ssl_setContext }, | ||
| 8679 | { "setOptions", &ssl_setOptions }, | 8692 | { "setOptions", &ssl_setOptions }, |
| 8680 | { "getOptions", &ssl_getOptions }, | 8693 | { "getOptions", &ssl_getOptions }, |
| 8681 | { "clearOptions", &ssl_clearOptions }, | 8694 | { "clearOptions", &ssl_clearOptions }, |
