diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-05-29 14:28:53 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-05-29 14:28:53 +0100 |
commit | 81fedc9a08fafb1f2cbbe6568a6e904ebbea25b8 (patch) | |
tree | 6f6f441b57007fd890e1bf578b29f9cce8295946 | |
parent | 762a39c8d024c74897747c35f51cbbf8018fae42 (diff) | |
download | prosody-81fedc9a08fafb1f2cbbe6568a6e904ebbea25b8.tar.gz prosody-81fedc9a08fafb1f2cbbe6568a6e904ebbea25b8.zip |
sessionmanager, mod_tls: Mark a session as secure when TLS is active
-rw-r--r-- | core/sessionmanager.lua | 6 | ||||
-rw-r--r-- | plugins/mod_tls.lua | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 68493d87..07c44dfb 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -171,6 +171,12 @@ function streamopened(session, attr) session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; return; end + + -- If session.secure is *false* (not nil) then it means we /were/ encrypting + -- since we now have a new stream header, session is secured + if session.secure == false then + session.secure = true; + end local features = st.stanza("stream:features"); fire_event("stream-features", session, features); diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index b382f318..85dc6bba 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -19,6 +19,7 @@ module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, session:reset_stream(); session.conn.starttls(); session.log("info", "TLS negotiation started..."); + session.secure = false; else -- FIXME: What reply? session.log("warn", "Attempt to start TLS, but TLS is not available on this connection"); |