From 1a75704ff07e4ccd426c6c63841bb846a3e273eb Mon Sep 17 00:00:00 2001 From: Thijs Alkemade Date: Fri, 6 Sep 2013 13:52:34 +0200 Subject: [PATCH] Report the actual TLS version used, not the version the cipher belongs to. --- src/ssl.c | 3 ++- src/ssl.lua | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index dd9f6c7..4809add 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -645,7 +645,8 @@ static int meth_info(lua_State *L) lua_pushstring(L, buf); lua_pushnumber(L, bits); lua_pushnumber(L, algbits); - return 3; + lua_pushstring(L, SSL_get_version(ssl->ssl)); + return 4; } static int meth_copyright(lua_State *L) diff --git a/src/ssl.lua b/src/ssl.lua index 1b062f6..a2e8ad6 100644 --- a/src/ssl.lua +++ b/src/ssl.lua @@ -128,7 +128,7 @@ end -- Extract connection information. -- local function info(ssl, field) - local str, comp, err + local str, comp, err, protocol comp, err = core.compression(ssl) if err then return comp, err @@ -138,7 +138,7 @@ local function info(ssl, field) return comp end local info = {compression = comp} - str, info.bits, info.algbits = core.info(ssl) + str, info.bits, info.algbits, protocol = core.info(ssl) if str then info.cipher, info.protocol, info.key, info.authentication, info.encryption, info.mac = @@ -146,6 +146,9 @@ local function info(ssl, field) "^(%S+)%s+(%S+)%s+Kx=(%S+)%s+Au=(%S+)%s+Enc=(%S+)%s+Mac=(%S+)") info.export = (string.match(str, "%sexport%s*$") ~= nil) end + if protocol then + info.protocol = protocol + end if field then return info[field] end