sessionmanager, mod_tls: Mark a session as secure when TLS is active

Fri, 29 May 2009 14:28:53 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 29 May 2009 14:28:53 +0100
changeset 1213
de66fa750daf
parent 1212
3be23cf5a659
child 1214
27d4cfb8fb7a

sessionmanager, mod_tls: Mark a session as secure when TLS is active

core/sessionmanager.lua file | annotate | diff | comparison | revisions
plugins/mod_tls.lua file | annotate | diff | comparison | revisions
--- a/core/sessionmanager.lua	Thu May 28 20:39:32 2009 +0100
+++ b/core/sessionmanager.lua	Fri May 29 14:28:53 2009 +0100
@@ -171,6 +171,12 @@
 		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);
--- a/plugins/mod_tls.lua	Thu May 28 20:39:32 2009 +0100
+++ b/plugins/mod_tls.lua	Fri May 29 14:28:53 2009 +0100
@@ -19,6 +19,7 @@
 				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");

mercurial