Mercurial > prosody-modules
annotate mod_carbons_adhoc/mod_carbons_adhoc.lua @ 6319:04c3273cb81f
mod_auth_cyrus: Add empty 'profile' table to SASL handler objects
This is for compatibility with Prosody's built-in util.sasl objects.
A SASL profile table usually includes methods supported by the backend, which
can be used by SASL mechanism handlers to perform operations (such as testing
the password). It also optionally contains a 'cb' field with channel binding
method handlers.
The Cyrus backend doesn't support channel binding, and doesn't have the same
concept of auth backend methods (it handles all that internally, and Prosody
has no insight or control over it).
Thus, we create an empty profile which informs Prosody that the SASL handler
does not support any of the auth or channel binding methods. Some features
will not work, but they didn't work anyway. This just makes it explicit.
This fixes a traceback in mod_sasl2_fast, which expected SASL handlers to
always contain a 'profile' field.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 04 Sep 2025 10:14:46 +0100 |
| parents | a6c51f380777 |
| children |
| rev | line source |
|---|---|
|
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
890
diff
changeset
|
1 -- Implement a Adhoc command which will show a user |
|
890
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
2 -- the status of carbons generation in regard to his clients |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
3 -- |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
4 -- Copyright (C) 2012 Michael Holzt |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
5 -- |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
6 -- This file is MIT/X11 licensed. |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
7 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
8 local st = require "util.stanza"; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
9 local jid_bare = require "util.jid".bare; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
10 local adhoc_new = module:require "adhoc".new; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
11 local xmlns_carbons_v2 = "urn:xmpp:carbons:2"; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
12 local xmlns_carbons_v1 = "urn:xmpp:carbons:1"; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
13 local xmlns_carbons_v0 = "urn:xmpp:carbons:0"; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
14 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
15 local bare_sessions = bare_sessions; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
16 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
17 local function adhoc_status(self, data, state) |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
18 local bare_jid = jid_bare(data.from); |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
19 local user_sessions = bare_sessions[bare_jid]; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
20 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
21 local result = ""; |
|
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
890
diff
changeset
|
22 |
|
890
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
23 user_sessions = user_sessions and user_sessions.sessions; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
24 for _, session in pairs(user_sessions) do |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
25 if session.full_jid then |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
26 result = result .. session.full_jid .. ": " .. |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
27 ( (session.want_carbons == xmlns_carbons_v2 and "v2" ) or |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
28 (session.want_carbons == xmlns_carbons_v1 and "v1" ) or |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
29 (session.want_carbons == xmlns_carbons_v0 and "v0" ) or |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
30 "none" ) .. "\n"; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
31 end |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
32 end |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
33 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
34 return { info = result, status = "completed" }; |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
35 end |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
36 |
|
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
890
diff
changeset
|
37 local status_desc = adhoc_new("Carbons: Get Status", |
|
890
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
38 "mod_carbons_adhoc#status", adhoc_status); |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
39 |
|
7ac1b8a799be
mod_carbons_adhoc: Initial commit.
Michael Holzt <kju@fqdn.org>
parents:
diff
changeset
|
40 module:add_item("adhoc", status_desc); |
