Files
Stefan-Sanger b49e9bcaa1 fix: guard mod_saslauth against session destroyed during async HTTP auth
mod_auth_http_async blocks the c2s async runner on an HTTP call inside
SASL plain_test. If the client disconnects during that call,
sessionmanager.retire_session nils every session field (incl.
base_type) and marks it destroyed. When the runner resumed,
mod_saslauth crashed at sasl_process_cdata line 94 on
'sasl/'..session.base_type..'/'. Bail out when the session is gone
instead of firing the event and sending a reply to a dead connection.

Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/9>
2026-07-16 08:38:14 +02:00

5.3 KiB
Raw Permalink Blame History

Prosody source patches

Unified diffs against pristine prosody-0.12.6, applied in the Dockerfile builder stage with patch -p1 from the extracted source root, before ./configure && make install. Paths inside each patch (a/... / b/...) are relative to the source root, so no separate mapping file is needed. patch --fuzz=0 is used so any upstream drift fails the build loudly instead of half-applying.

To change a patch: extract the pristine tarball, apply all patches, edit, and regenerate with diff -u pristine/<path> patched/<path> (keep the a/<path> / b/<path> header form).

Patch intent

Patch Target What it does / why
mod_carbons.patch plugins/mod_carbons.lua Hook vnc-rest-message (fired by mod_http_rest) so REST-injected messages are carbon-copied.
mod_mam.patch plugins/mod_mam/mod_mam.lua Archive REST-injected messages (vnc-rest-message hook, stored under the sender); always store (shall_storetrue, because users live in the external HTTP auth backend so user_exists() can't be trusted); only archive stanzas with a <body>.
mod_muc_mam.patch plugins/mod_muc_mam.lua Keep MUC archives when a room is destroyed (upstream deletes them). Expiry/cleanup needs no patch since 0.12: muc_log_expires_after = "never" (set in the config template) disables the whole cleanup path upstream.
mod_muc.patch plugins/muc/mod_muc.lua Route iq-set/bare/xmpp:vnctalk:unregister:query to the new handle_unregister_iq (see register.lib.patch).
register.lib.patch plugins/muc/register.lib.lua Add handle_unregister_iq: fires vnc-muc-kick (consumed by mod_vnc_track_kicks) and removes the requester's room affiliation.
muc.lib.patch plugins/muc/muc.lib.lua (a) broadcast() also routes to offline remote affiliated members; (b) suppress the unavailable self-presence in publicise_occupant_status; (c) let owner/admin/member post to a room without being a present occupant (bypasses the muc-occupant-groupchat event and its not-in-room rejection); (d) fire muc-config-sub-mitted on config changes — consumed by an external service.
hidden.lib.patch plugins/muc/hidden.lib.lua Hide the "publicly searchable" room config option for everyone when public rooms are restricted (upstream exempts admins).
mod_muc_unique.patch plugins/mod_muc_unique.lua Rework muc#unique handler; answer item-not-found for bare-JID requests.
mod_websocket.patch plugins/mod_websocket.lua Re-add WebSocket continuation-frame (fragmented-message) support that was removed upstream in the 0.12/13.0 rewrite. VNCtalk clients fragment large WebSocket messages (e.g. vCard sets with avatars >~64 KB); 13.0.6's validate_frame hard-rejected any frame with FIN=false (close code 1003) silently — no log was emitted because the rejection fired on the partial-frame path before handle_frame was reached, and websocket_close() itself does not log. This patch removes the blanket not frame.FIN rejection from validate_frame and restores the dataBuffer fragment-accumulation logic from 0.11.6 inside handle_frame: text frames (opcode 0x1) with FIN=false start a buffer, continuation frames (opcode 0x0) append to it, and the concatenated data is returned only when a frame with FIN=true arrives. The accumulated size is capped by the configurable websocket_max_message_size option (default 2 MB, 2×1024×1024); if exceeded the connection is closed with WebSocket close code 1009 ("Message too big") and the buffer is reset, preventing unbounded memory growth from buggy or malicious clients that never send a FIN frame.
mod_saslauth.patch plugins/mod_saslauth.lua Guard sasl_process_cdata against a session that was destroyed while the SASL handler was suspended. mod_auth_http_async performs a blocking async HTTP call inside the SASL plain_test callback, which parks the c2s async runner. If the client disconnects during that call, sessionmanager.destroy_sessionretire_session nils every field on the session (including base_type) and marks it destroyed. When the HTTP call returns and the runner resumes, mod_saslauth then crashed at module:fire_event("sasl/"..session.base_type.."/"..status, ...) with attempt to concatenate a nil value (field 'base_type'). The patch bails out of sasl_process_cdata when session.destroyed or session.base_type is nil, so no event is fired and no reply is sent to an already-dead connection. Non-fatal for auth itself (the next login attempt on a fresh session succeeds), but it spammed the logs with a traceback on every disconnect-during-SASL.

Patches removed at the 0.12.6 upgrade (M1)

  • moduleapi.patch (module:open_host_store) — the two consumers (mod_vnc_muc_fcm, mod_vnc_muc_fcm_hin) now call require "core.storagemanager".open(host, name, type) directly.
  • mod_admin_telnet.patch / portmanager.patch (bind telnet console on *) — replaced by console_interfaces = { "*" } in the config template.
  • The operator-precedence hunk formerly in muc.lib.patch — fixed upstream in 0.12.
  • The dumpTable/table_clone debug helpers and info-level log spam formerly carried in several patches — dropped; they had no functional effect.

See upgrade-plan.md in the repo root for the per-version disposition of every patch.