Software /
code /
prosody
Comparison
plugins/mod_legacyauth.lua @ 1218:8e02c10c9e60
mod_legacyauth: Hide stream feature when secure auth is enabled, and session isn't secure
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 29 May 2009 18:04:53 +0100 |
parent | 1216:fd8ce71bc72b |
child | 1523:841d61be198f |
comparison
equal
deleted
inserted
replaced
1217:844ef764ef0e | 1218:8e02c10c9e60 |
---|---|
17 local sessionmanager = require "core.sessionmanager"; | 17 local sessionmanager = require "core.sessionmanager"; |
18 local usermanager = require "core.usermanager"; | 18 local usermanager = require "core.usermanager"; |
19 | 19 |
20 module:add_feature("jabber:iq:auth"); | 20 module:add_feature("jabber:iq:auth"); |
21 module:add_event_hook("stream-features", function (session, features) | 21 module:add_event_hook("stream-features", function (session, features) |
22 if not session.username then features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); end | 22 if secure_auth_only and not session.secure then |
23 -- Sorry, not offering to insecure streams! | |
24 return; | |
25 elseif not session.username then | |
26 features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); | |
27 end | |
23 end); | 28 end); |
24 | 29 |
25 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", | 30 module:add_iq_handler("c2s_unauthed", "jabber:iq:auth", |
26 function (session, stanza) | 31 function (session, stanza) |
27 if secure_auth_only and not session.secure then | 32 if secure_auth_only and not session.secure then |