mod_c2s, mod_s2s: Log a message that stream encryption has been enabled with some...
authorKim Alvefur <zash@zash.se>
Fri, 2 Aug 2013 13:12:24 +0000 (15:12 +0200)
committerKim Alvefur <zash@zash.se>
Fri, 2 Aug 2013 13:12:24 +0000 (15:12 +0200)
plugins/mod_c2s.lua
plugins/mod_s2s/mod_s2s.lua

index 3eb9e975df3535e850e9c27c2cc5ff165960cc90..c26c5510a14e81cee0d84b498255df7b3657efd8 100644 (file)
@@ -68,12 +68,15 @@ function stream_callbacks.streamopened(session, attr)
        if session.secure == false then
                session.secure = true;
 
-               -- Check if TLS compression is used
                local sock = session.conn:socket();
                if sock.info then
-                       session.compressed = sock:info"compression";
-               elseif sock.compression then
-                       session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+                       local info = sock:info();
+                       (session.log or log)("info", "Stream encrypted (%s) with %s, authenticated with %s and exchanged keys with %s",
+                               info.protocol, info.encryption, info.authentication, info.key);
+                       session.compressed = info.compression;
+               else
+                       (session.log or log)("info", "Stream encrypted");
+                       session.compressed = sock.compression and sock:compression(); --COMPAT mw/luasec-hg
                end
        end
 
index 01fac4d2c93b03a6279be2b6ea26cd01624cf7fa..b6614d2fccb18df97dea6df01f3432a300aa0b09 100644 (file)
@@ -283,12 +283,15 @@ function stream_callbacks.streamopened(session, attr)
        if session.secure == false then
                session.secure = true;
 
-               -- Check if TLS compression is used
                local sock = session.conn:socket();
                if sock.info then
-                       session.compressed = sock:info"compression";
-               elseif sock.compression then
-                       session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+                       local info = sock:info();
+                       (session.log or log)("info", "Stream encrypted (%s) with %s, authenticated with %s and exchanged keys with %s",
+                               info.protocol, info.encryption, info.authentication, info.key);
+                       session.compressed = info.compression;
+               else
+                       (session.log or log)("info", "Stream encrypted");
+                       session.compressed = sock.compression and sock:compression(); --COMPAT mw/luasec-hg
                end
        end