Software / code / prosody-modules
File
mod_post_msg/mod_post_msg.lua @ 6251:694f8fab07d4
: mod_sasl2*** : Update Compability for all of them
diff --git a/mod_sasl2/README.md b/mod_sasl2/README.md
--- a/mod_sasl2/README.md
+++ b/mod_sasl2/README.md
@@ -31,6 +31,7 @@ This module requires Prosody **trunk** a
Prosody Version Status
----------------------- ----------------
- trunk as of 2024-11-24 Works
+ trunk as of 2025-05-25 Works
+ 0.13 Works
0.12 Does not work
----------------------- ----------------
diff --git a/mod_sasl2_bind2/README.md b/mod_sasl2_bind2/README.md
--- a/mod_sasl2_bind2/README.md
+++ b/mod_sasl2_bind2/README.md
@@ -16,5 +16,6 @@ This module depends on [mod_sasl2]. It e
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Works
0.12 Does not work
diff --git a/mod_sasl2_fast/README.md b/mod_sasl2_fast/README.md
--- a/mod_sasl2_fast/README.md
+++ b/mod_sasl2_fast/README.md
@@ -33,5 +33,6 @@ clients being logged out unexpectedly.
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Work
0.12 Does not work
diff --git a/mod_sasl2_sm/README.md b/mod_sasl2_sm/README.md
--- a/mod_sasl2_sm/README.md
+++ b/mod_sasl2_sm/README.md
@@ -17,5 +17,6 @@ configuration options.
Prosody-Version Status
--------------- ----------------------
- trunk Works as of 2024-12-21
+ trunk Works as of 2025-05-25
+ 0.13 Work
0.12 Does not work
diff --git a/mod_sasl_ssdp/README.md b/mod_sasl_ssdp/README.md
--- a/mod_sasl_ssdp/README.md
+++ b/mod_sasl_ssdp/README.md
@@ -18,8 +18,8 @@ There are no configuration options for t
# Compatibility
-For SASL2 (XEP-0388) clients, it is compatible with the mod_sasl2 community module.
-
-For clients using RFC 6120 SASL, it requires Prosody trunk 33e5edbd6a4a or
-later. It is not compatible with Prosody 0.12 (it will load, but simply
-won't do anything) for "legacy SASL".
+ Prosody-Version Status
+ --------------- ----------------------
+ trunk Works as of 2025-05-25
+ 0.13 Works
+ 0.12 Does not work
| author | Menel <menel@snikket.de> |
|---|---|
| date | Mon, 12 May 2025 11:07:45 +0200 |
| parent | 2989:926aaaeb0d21 |
line wrap: on
line source
module:depends"http" local jid_split = require "util.jid".split; local jid_prep = require "util.jid".prep; local msg = require "util.stanza".message; local test_password = require "core.usermanager".test_password; local b64_decode = require "util.encodings".base64.decode; local formdecode = require "net.http".formdecode; local xml = require"util.xml"; local json = require "util.json"; local function require_valid_user(f) return function(event, path) local request = event.request; local response = event.response; local headers = request.headers; if not headers.authorization then response.headers.www_authenticate = ("Basic realm=%q"):format(module.host.."/"..module.name); return 401 end local from_jid, password = b64_decode(headers.authorization:match"[^ ]*$"):match"([^:]*):(.*)"; from_jid = jid_prep(from_jid); if from_jid and password then local user, host = jid_split(from_jid); local ok, err = test_password(user, host, password); if ok and user and host then module:log("debug", "Authed as %s", from_jid); return f(event, path, from_jid); elseif err then module:log("debug", "User failed authentication: %s", err); end end return 401 end end local function handle_post(event, path, authed_user) local request = event.request; local response = event.response; local headers = request.headers; local body_type = headers.content_type; local to = jid_prep(path); local message; if body_type == "text/plain" then if to and request.body then message = msg({ to = to, from = authed_user, type = "chat"},request.body); end elseif body_type == "application/x-www-form-urlencoded" then local post_body = formdecode(request.body); message = msg({ to = post_body.to or to, from = authed_user, type = post_body.type or "chat"}, post_body.body); if post_body.html then local html, err = xml.parse([[<body xmlns="http://www.w3.org/1999/xhtml">]]..post_body.html..[[</body>]]); if not html then module:log("warn", "mod_post_msg: invalid XML: %s", err); return 400; end message:tag("html", {xmlns="http://jabber.org/protocol/xhtml-im"}):add_child(html):up(); end elseif body_type == "application/json" then local post_body = json.decode(request.body); if not post_body then return 400; end message = msg({ to = post_body.to or to, from = authed_user, type = post_body.type or "chat"}, post_body.body); else return 415; end if message and message.attr.to then module:log("debug", "Sending %s", tostring(message)); module:send(message); return 201; end return 422; end module:provides("http", { default_path = "/msg"; route = { ["POST /*"] = require_valid_user(handle_post); OPTIONS = function(e) local headers = e.response.headers; headers.allow = "POST"; headers.accept = "application/x-www-form-urlencoded, text/plain"; return 200; end; } });