Software /
code /
prosody
Comparison
plugins/mod_tls.lua @ 2576:b70e73872c4d
mod_tls: Don't advertise TLS after authentication.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 10 Feb 2010 01:36:22 +0500 |
parent | 2544:b68cbc664d18 |
child | 2594:ab52fdd9f5d0 |
comparison
equal
deleted
inserted
replaced
2575:8f4d69940132 | 2576:b70e73872c4d |
---|---|
48 | 48 |
49 | 49 |
50 local starttls_attr = { xmlns = xmlns_starttls }; | 50 local starttls_attr = { xmlns = xmlns_starttls }; |
51 module:add_event_hook("stream-features", | 51 module:add_event_hook("stream-features", |
52 function (session, features) | 52 function (session, features) |
53 if session.conn.starttls then | 53 if not session.username and session.conn.starttls then |
54 features:tag("starttls", starttls_attr); | 54 features:tag("starttls", starttls_attr); |
55 if secure_auth_only then | 55 if secure_auth_only then |
56 features:tag("required"):up():up(); | 56 features:tag("required"):up():up(); |
57 else | 57 else |
58 features:up(); | 58 features:up(); |
61 end); | 61 end); |
62 | 62 |
63 module:hook("s2s-stream-features", | 63 module:hook("s2s-stream-features", |
64 function (data) | 64 function (data) |
65 local session, features = data.session, data.features; | 65 local session, features = data.session, data.features; |
66 if session.to_host and session.conn.starttls then | 66 if session.to_host and session.type ~= "s2sin" and session.conn.starttls then |
67 features:tag("starttls", starttls_attr):up(); | 67 features:tag("starttls", starttls_attr):up(); |
68 if secure_s2s_only then | 68 if secure_s2s_only then |
69 features:tag("required"):up():up(); | 69 features:tag("required"):up():up(); |
70 else | 70 else |
71 features:up(); | 71 features:up(); |