From 4c7339cace7a4b328ad5a27c0c1dc57338df7e8b Mon Sep 17 00:00:00 2001 From: Lluixhi Scura Date: Fri, 16 Jan 2015 08:55:22 -0800 Subject: [PATCH 1/2] Fix for LibreSSL/OPENSSL_NO_COMP --- src/ssl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 884edc7..c39ae3f 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -400,24 +400,29 @@ static int meth_want(lua_State *L) } return 1; } - + /** * Return the compression method used. */ static int meth_compression(lua_State *L) { - const COMP_METHOD *comp; p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); if (ssl->state != LSEC_STATE_CONNECTED) { lua_pushnil(L); lua_pushstring(L, "closed"); return 2; } + +#if !defined(OPENSSL_NO_COMP) + const COMP_METHOD *comp; comp = SSL_get_current_compression(ssl->ssl); if (comp) lua_pushstring(L, SSL_COMP_get_name(comp)); else lua_pushnil(L); +#else + lua_pushnil(L); +#endif return 1; } From 5240c02f3da38be9ad13c6d1b1aa58d67fc3d245 Mon Sep 17 00:00:00 2001 From: Lluixhi Scura Date: Fri, 16 Jan 2015 09:12:14 -0800 Subject: [PATCH 2/2] Changed for strict compiles. --- src/ssl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index c39ae3f..63d3a97 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -406,15 +406,16 @@ static int meth_want(lua_State *L) */ static int meth_compression(lua_State *L) { +#if !defined(OPENSSL_NO_COMP) + const COMP_METHOD *comp; +#endif p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); if (ssl->state != LSEC_STATE_CONNECTED) { lua_pushnil(L); lua_pushstring(L, "closed"); return 2; } - #if !defined(OPENSSL_NO_COMP) - const COMP_METHOD *comp; comp = SSL_get_current_compression(ssl->ssl); if (comp) lua_pushstring(L, SSL_COMP_get_name(comp));