Software / code / prosody
Comparison
plugins/mod_c2s.lua @ 5764:969e0a054795
mod_c2s, mod_s2s: Log a message that stream encryption has been enabled with some details
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 02 Aug 2013 15:12:24 +0200 |
| parent | 5759:767e29b2cd3a |
| child | 5773:c9a712673d8a |
comparison
equal
deleted
inserted
replaced
| 5763:0e52f1d5ca71 | 5764:969e0a054795 |
|---|---|
| 66 -- If session.secure is *false* (not nil) then it means we /were/ encrypting | 66 -- If session.secure is *false* (not nil) then it means we /were/ encrypting |
| 67 -- since we now have a new stream header, session is secured | 67 -- since we now have a new stream header, session is secured |
| 68 if session.secure == false then | 68 if session.secure == false then |
| 69 session.secure = true; | 69 session.secure = true; |
| 70 | 70 |
| 71 -- Check if TLS compression is used | |
| 72 local sock = session.conn:socket(); | 71 local sock = session.conn:socket(); |
| 73 if sock.info then | 72 if sock.info then |
| 74 session.compressed = sock:info"compression"; | 73 local info = sock:info(); |
| 75 elseif sock.compression then | 74 (session.log or log)("info", "Stream encrypted (%s) with %s, authenticated with %s and exchanged keys with %s", |
| 76 session.compressed = sock:compression(); --COMPAT mw/luasec-hg | 75 info.protocol, info.encryption, info.authentication, info.key); |
| 76 session.compressed = info.compression; | |
| 77 else | |
| 78 (session.log or log)("info", "Stream encrypted"); | |
| 79 session.compressed = sock.compression and sock:compression(); --COMPAT mw/luasec-hg | |
| 77 end | 80 end |
| 78 end | 81 end |
| 79 | 82 |
| 80 local features = st.stanza("stream:features"); | 83 local features = st.stanza("stream:features"); |
| 81 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); | 84 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); |