Software / code / prosody
Comparison
plugins/mod_c2s.lua @ 6846:7eb166fa1f26
mod_c2s, mod_s2s: Close incoming connections if there are no features to offer on incomplete streams (fixes #285)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 24 Sep 2015 20:05:23 +0200 |
| parent | 6630:6735e2d735d6 |
| child | 7101:f83211f4d776 |
comparison
equal
deleted
inserted
replaced
| 6845:bb7854355df1 | 6846:7eb166fa1f26 |
|---|---|
| 81 end | 81 end |
| 82 end | 82 end |
| 83 | 83 |
| 84 local features = st.stanza("stream:features"); | 84 local features = st.stanza("stream:features"); |
| 85 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); | 85 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); |
| 86 send(features); | 86 if features.tags[1] or session.full_jid then |
| 87 send(features); | |
| 88 else | |
| 89 (session.log or log)("warn", "No features to offer"); | |
| 90 session:close{ condition = "undefined-condition", text = "No features to proceed with" }; | |
| 91 end | |
| 87 end | 92 end |
| 88 | 93 |
| 89 function stream_callbacks.streamclosed(session) | 94 function stream_callbacks.streamclosed(session) |
| 90 session.log("debug", "Received </stream:stream>"); | 95 session.log("debug", "Received </stream:stream>"); |
| 91 session:close(false); | 96 session:close(false); |