Annotate

util/prosodyctl.lua @ 13246:2e04d54fb013

mod_tokenauth: Fix revoking a single token without revoking whole grant This appears to have been a copy-paste of the grant revocation function, or maybe the other way around. Either way, it deleted the whole grant instead of the individual token as might be expected.
author Kim Alvefur <zash@zash.se>
date Sun, 23 Jul 2023 02:54:49 +0200
parent 12975:d10957394a3c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1522
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 1515
diff changeset
1 -- Prosody IM
2923
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 2796
diff changeset
2 -- Copyright (C) 2008-2010 Matthew Wild
b7049746bd29 Update copyright headers for 2010
Matthew Wild <mwild1@gmail.com>
parents: 2796
diff changeset
3 -- Copyright (C) 2008-2010 Waqas Hussain
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
4 --
1522
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 1515
diff changeset
5 -- This project is MIT/X11 licensed. Please see the
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 1515
diff changeset
6 -- COPYING file in the source package for more information.
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 1515
diff changeset
7 --
569d58d21612 Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents: 1515
diff changeset
8
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9
12975
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
10 local config = require "prosody.core.configmanager";
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
11 local encodings = require "prosody.util.encodings";
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 local stringprep = encodings.stringprep;
12975
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
13 local storagemanager = require "prosody.core.storagemanager";
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
14 local usermanager = require "prosody.core.usermanager";
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
15 local interpolation = require "prosody.util.interpolation";
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
16 local signal = require "prosody.util.signal";
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
17 local set = require "prosody.util.set";
2794
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
18 local lfs = require "lfs";
4485
abfd27b59fa8 util.prosodyctl: Add getline() and show_prompt()
Kim Alvefur <zash@zash.se>
parents: 4335
diff changeset
19 local type = type;
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 local nodeprep, nameprep = stringprep.nodeprep, stringprep.nameprep;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 local io, os = io, os;
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
24 local print = print;
7259
d8300985f2bb net.websocket.frames, util.datetime, util.json, util.prosodyctl, util.rfc6724: Remove unused variables [luacheck]
Matthew Wild <mwild1@gmail.com>
parents: 6777
diff changeset
25 local tonumber = tonumber;
1130
442c87de8e2d util.prosodyctl: Import CFG_SOURCEDIR from the global environment (thanks macaronyde!)
Matthew Wild <mwild1@gmail.com>
parents: 1123
diff changeset
26
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
27 local _G = _G;
3294
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
28 local prosody = prosody;
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
29
10871
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
30 local error_messages = setmetatable({
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
31 ["invalid-username"] = "The given username is invalid in a Jabber ID";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
32 ["invalid-hostname"] = "The given hostname is invalid";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
33 ["no-password"] = "No password was supplied";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
34 ["no-such-user"] = "The given user does not exist on the server";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
35 ["no-such-host"] = "The given hostname does not exist in the config";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
36 ["unable-to-save-data"] = "Unable to store, perhaps you don't have permission?";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
37 ["no-pidfile"] = "There is no 'pidfile' option in the configuration file, see https://prosody.im/doc/prosodyctl#pidfile for help";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
38 ["invalid-pidfile"] = "The 'pidfile' option in the configuration file is not a string, see https://prosody.im/doc/prosodyctl#pidfile for help";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
39 ["no-posix"] = "The mod_posix module is not enabled in the Prosody config file, see https://prosody.im/doc/prosodyctl for more info";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
40 ["no-such-method"] = "This module has no commands";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
41 ["not-running"] = "Prosody is not running";
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
42 }, { __index = function (_,k) return "Error: "..(tostring(k):gsub("%-", " "):gsub("^.", string.upper)); end });
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
43
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
44 -- UI helpers
12975
d10957394a3c util: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12785
diff changeset
45 local show_message = require "prosody.util.human.io".printf;
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
46
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
47 local function show_usage(usage, desc)
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
48 print("Usage: ".._G.arg[0].." "..usage);
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
49 if desc then
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
50 print(" "..desc);
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
51 end
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
52 end
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
53
10152
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
54 local function show_module_configuration_help(mod_name)
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
55 print("Done.")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
56 print("If you installed a prosody plugin, don't forget to add its name under the 'modules_enabled' section inside your configuration file.")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
57 print("Depending on the module, there might be further configuration steps required.")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
58 print("")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
59 print("More info about: ")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
60 print(" modules_enabled: https://prosody.im/doc/modules_enabled")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
61 print(" "..mod_name..": https://modules.prosody.im/"..mod_name..".html")
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
62 end
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
63
4142
caa78589598f prosodyctl, util.prosodyctl: Move UI functions to util.prosodyctl so they can be used outside of prosodyctl itself
Matthew Wild <mwild1@gmail.com>
parents: 3777
diff changeset
64 -- Server control
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
65 local function adduser(params)
10367
649acbfbf7fe util.prosodyctl: Enforce strict JID validation on user creation
Kim Alvefur <zash@zash.se>
parents: 10209
diff changeset
66 local user, host, password = nodeprep(params.user, true), nameprep(params.host), params.password;
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
67 if not user then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
68 return false, "invalid-username";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
69 elseif not host then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
70 return false, "invalid-hostname";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
71 end
3294
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
72
4501
eacc93e23f21 util.prosodyctl: Fix variable name clash introduced in 55ef5d83d00a (thanks chris)
Matthew Wild <mwild1@gmail.com>
parents: 4499
diff changeset
73 local host_session = prosody.hosts[host];
eacc93e23f21 util.prosodyctl: Fix variable name clash introduced in 55ef5d83d00a (thanks chris)
Matthew Wild <mwild1@gmail.com>
parents: 4499
diff changeset
74 if not host_session then
4499
55ef5d83d00a util.prosodyctl: In the register command, check that the virtual exists before proceeding.
Kim Alvefur <zash@zash.se>
parents: 4335
diff changeset
75 return false, "no-such-host";
55ef5d83d00a util.prosodyctl: In the register command, check that the virtual exists before proceeding.
Kim Alvefur <zash@zash.se>
parents: 4335
diff changeset
76 end
5524
e9090966c803 util.prosodyctl: Initialize storagemanager on the host before initializing usermanager. This fixes brokenness when the auth provider opens the store on load (as they all do since eeea0eb2602a) (thanks nulani)
Matthew Wild <mwild1@gmail.com>
parents: 5379
diff changeset
77
e9090966c803 util.prosodyctl: Initialize storagemanager on the host before initializing usermanager. This fixes brokenness when the auth provider opens the store on load (as they all do since eeea0eb2602a) (thanks nulani)
Matthew Wild <mwild1@gmail.com>
parents: 5379
diff changeset
78 storagemanager.initialize_host(host);
4501
eacc93e23f21 util.prosodyctl: Fix variable name clash introduced in 55ef5d83d00a (thanks chris)
Matthew Wild <mwild1@gmail.com>
parents: 4499
diff changeset
79 local provider = host_session.users;
3294
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
80 if not(provider) or provider.name == "null" then
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
81 usermanager.initialize_host(host);
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
82 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
83
3777
5ecbcef42ffb mod_admin_adhoc: Support for reloading multiple modules
Florian Zeitz <florob@babelmonkeys.de>
parents: 3771
diff changeset
84 local ok, errmsg = usermanager.create_user(user, password, host);
1123
da7ff11a03ee util.prosodyctl: Return success status of usermanager.create_user()
Matthew Wild <mwild1@gmail.com>
parents: 1087
diff changeset
85 if not ok then
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
86 return false, errmsg or "creating-user-failed";
1123
da7ff11a03ee util.prosodyctl: Return success status of usermanager.create_user()
Matthew Wild <mwild1@gmail.com>
parents: 1087
diff changeset
87 end
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
88 return true;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
89 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
90
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
91 local function user_exists(params)
7262
751a4832adb4 util.prosodyctl: Remove unused variable [luacheck]
Matthew Wild <mwild1@gmail.com>
parents: 7259
diff changeset
92 local user, host = nodeprep(params.user), nameprep(params.host);
5524
e9090966c803 util.prosodyctl: Initialize storagemanager on the host before initializing usermanager. This fixes brokenness when the auth provider opens the store on load (as they all do since eeea0eb2602a) (thanks nulani)
Matthew Wild <mwild1@gmail.com>
parents: 5379
diff changeset
93
e9090966c803 util.prosodyctl: Initialize storagemanager on the host before initializing usermanager. This fixes brokenness when the auth provider opens the store on load (as they all do since eeea0eb2602a) (thanks nulani)
Matthew Wild <mwild1@gmail.com>
parents: 5379
diff changeset
94 storagemanager.initialize_host(host);
3711
2a1cfaf3ee61 util.prosodyctl: Prep JIDs before checking whether they exist (thanks tja)
Matthew Wild <mwild1@gmail.com>
parents: 3627
diff changeset
95 local provider = prosody.hosts[host].users;
3294
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
96 if not(provider) or provider.name == "null" then
3711
2a1cfaf3ee61 util.prosodyctl: Prep JIDs before checking whether they exist (thanks tja)
Matthew Wild <mwild1@gmail.com>
parents: 3627
diff changeset
97 usermanager.initialize_host(host);
3294
89dd67cc3689 util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
Matthew Wild <mwild1@gmail.com>
parents: 2925
diff changeset
98 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
99
3711
2a1cfaf3ee61 util.prosodyctl: Prep JIDs before checking whether they exist (thanks tja)
Matthew Wild <mwild1@gmail.com>
parents: 3627
diff changeset
100 return usermanager.user_exists(user, host);
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
101 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
102
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
103 local function passwd(params)
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
104 if not user_exists(params) then
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
105 return false, "no-such-user";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
106 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
107
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
108 return adduser(params);
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
109 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
110
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
111 local function deluser(params)
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
112 if not user_exists(params) then
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
113 return false, "no-such-user";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
114 end
5102
ae8a993b598d util.prosodyctl: Use usermanager to delete users instead of unsetting their password
Kim Alvefur <zash@zash.se>
parents: 5023
diff changeset
115 local user, host = nodeprep(params.user), nameprep(params.host);
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
116
5102
ae8a993b598d util.prosodyctl: Use usermanager to delete users instead of unsetting their password
Kim Alvefur <zash@zash.se>
parents: 5023
diff changeset
117 return usermanager.delete_user(user, host);
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
118 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
119
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
120 local function getpid()
5379
27de7cc94111 util.{prosodyctl,openssl}: More use of config sections removed
Kim Alvefur <zash@zash.se>
parents: 5102
diff changeset
121 local pidfile = config.get("*", "pidfile");
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
122 if not pidfile then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
123 return false, "no-pidfile";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
124 end
6356
fb1535328ac7 prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
Kim Alvefur <zash@zash.se>
parents: 5524
diff changeset
125
fb1535328ac7 prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
Kim Alvefur <zash@zash.se>
parents: 5524
diff changeset
126 if type(pidfile) ~= "string" then
fb1535328ac7 prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
Kim Alvefur <zash@zash.se>
parents: 5524
diff changeset
127 return false, "invalid-pidfile";
fb1535328ac7 prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
Kim Alvefur <zash@zash.se>
parents: 5524
diff changeset
128 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
129
8123
bd591c5fc1bf util.prosodyctl: Resolve possibly relative pidfile path (fixes inconsistency with mod_posix)
Kim Alvefur <zash@zash.se>
parents: 7457
diff changeset
130 pidfile = config.resolve_relative_path(prosody.paths.data, pidfile);
bd591c5fc1bf util.prosodyctl: Resolve possibly relative pidfile path (fixes inconsistency with mod_posix)
Kim Alvefur <zash@zash.se>
parents: 7457
diff changeset
131
8883
3f975bbfec3b util.prosodyctl: Rename variables for consistency (thanks Link Mauve)
Kim Alvefur <zash@zash.se>
parents: 8668
diff changeset
132 local modules_disabled = set.new(config.get("*", "modules_disabled"));
3f975bbfec3b util.prosodyctl: Rename variables for consistency (thanks Link Mauve)
Kim Alvefur <zash@zash.se>
parents: 8668
diff changeset
133 if prosody.platform ~= "posix" or modules_disabled:contains("posix") then
3627
9e62937c9757 prosodyctl, util.prosodyctl: Show error when mod_posix is not enabled and an attempt is made to query Prosody's status (thanks stever)
Matthew Wild <mwild1@gmail.com>
parents: 3307
diff changeset
134 return false, "no-posix";
9e62937c9757 prosodyctl, util.prosodyctl: Show error when mod_posix is not enabled and an attempt is made to query Prosody's status (thanks stever)
Matthew Wild <mwild1@gmail.com>
parents: 3307
diff changeset
135 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
136
2796
1e287badd033 prosodyctl: Use mode r+ for opening the file so 1) it fails if the file doesn't exist 2) we have write access to lock it
Matthew Wild <mwild1@gmail.com>
parents: 2794
diff changeset
137 local file, err = io.open(pidfile, "r+");
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
138 if not file then
1515
9991329e6b67 util.prosodyctl: Fix undefined global access
Matthew Wild <mwild1@gmail.com>
parents: 1130
diff changeset
139 return false, "pidfile-read-failed", err;
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
140 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
141
10536
a469d2bcea96 util.prosodyctl: Silence luacheck warnings
Kim Alvefur <zash@zash.se>
parents: 10367
diff changeset
142 local locked, err = lfs.lock(file, "w"); -- luacheck: ignore 211/err
2794
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
143 if locked then
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
144 file:close();
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
145 return false, "pidfile-not-locked";
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
146 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
147
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
148 local pid = tonumber(file:read("*a"));
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
149 file:close();
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
150
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
151 if not pid then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
152 return false, "invalid-pid";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
153 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
154
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
155 return true, pid;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
156 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
157
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
158 local function isrunning()
10536
a469d2bcea96 util.prosodyctl: Silence luacheck warnings
Kim Alvefur <zash@zash.se>
parents: 10367
diff changeset
159 local ok, pid, err = getpid(); -- luacheck: ignore 211/err
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
160 if not ok then
2794
5f14cd94a563 util.prosodyctl: Report Prosody as not running if the pidfile isn't locked
Matthew Wild <mwild1@gmail.com>
parents: 1522
diff changeset
161 if pid == "pidfile-read-failed" or pid == "pidfile-not-locked" then
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
162 -- Report as not running, since we can't open the pidfile
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
163 -- (it probably doesn't exist)
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
164 return true, false;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
165 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
166 return ok, pid;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
167 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
168 return true, signal.kill(pid, 0) == 0;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
169 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
170
9781
161411a41377 util.prosodyctl: Allow passing path to Lua runtime to the start() function
Kim Alvefur <zash@zash.se>
parents: 8883
diff changeset
171 local function start(source_dir, lua)
161411a41377 util.prosodyctl: Allow passing path to Lua runtime to the start() function
Kim Alvefur <zash@zash.se>
parents: 8883
diff changeset
172 lua = lua and lua .. " " or "";
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
173 local ok, ret = isrunning();
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
174 if not ok then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
175 return ok, ret;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
176 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
177 if ret then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
178 return false, "already-running";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
179 end
8668
31c5abd49dfe prosodyctl, util.prosodyctl: Pass source path as a parameter instead of global variable
Matthew Wild <mwild1@gmail.com>
parents: 8634
diff changeset
180 if not source_dir then
10627
88be11e9f9b9 util.prosodyctl: Pass command line flag to force daemonization on start
Kim Alvefur <zash@zash.se>
parents: 10536
diff changeset
181 os.execute(lua .. "./prosody -D");
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
182 else
10627
88be11e9f9b9 util.prosodyctl: Pass command line flag to force daemonization on start
Kim Alvefur <zash@zash.se>
parents: 10536
diff changeset
183 os.execute(lua .. source_dir.."/../../bin/prosody -D");
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
184 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
185 return true;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
186 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
187
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
188 local function stop()
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
189 local ok, ret = isrunning();
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
190 if not ok then
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
191 return ok, ret;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
192 end
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
193 if not ret then
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
194 return false, "not-running";
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
195 end
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
196
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
197 local ok, pid = getpid()
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
198 if not ok then return false, pid; end
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
199
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
200 signal.kill(pid, signal.SIGTERM);
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
201 return true;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
202 end
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
203
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
204 local function reload()
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
205 local ok, ret = isrunning();
1087
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
206 if not ok then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
207 return ok, ret;
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
208 end
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
209 if not ret then
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
210 return false, "not-running";
5e9475bec571 prosodyctl, util.prosodyctl: New prosodyctl utility for managing Prosody servers
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
211 end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
212
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
213 local ok, pid = getpid()
4335
3a2a01432b5c Add "reload" command to prosodyctl
Vladimir Protasov <eoranged@ya.ru>
parents: 4142
diff changeset
214 if not ok then return false, pid; end
6771
60957dd5b41b util.{interpolation,prosodyctl,sql}: Trim trailing whitespace
Kim Alvefur <zash@zash.se>
parents: 6367
diff changeset
215
4335
3a2a01432b5c Add "reload" command to prosodyctl
Vladimir Protasov <eoranged@ya.ru>
parents: 4142
diff changeset
216 signal.kill(pid, signal.SIGHUP);
3a2a01432b5c Add "reload" command to prosodyctl
Vladimir Protasov <eoranged@ya.ru>
parents: 4142
diff changeset
217 return true;
3a2a01432b5c Add "reload" command to prosodyctl
Vladimir Protasov <eoranged@ya.ru>
parents: 4142
diff changeset
218 end
5023
dcc8e789df36 mod_admin_telnet, prosody, prosodyctl, ejabberd2prosody: Don't depend on modules setting globals
Florian Zeitz <florob@babelmonkeys.de>
parents: 4503
diff changeset
219
11132
287d0d80aa57 util.prosodyctl: Construct luarocks command line with templates
Kim Alvefur <zash@zash.se>
parents: 10871
diff changeset
220 local render_cli = interpolation.new("%b{}", function (s) return "'"..s:gsub("'","'\\''").."'" end)
287d0d80aa57 util.prosodyctl: Construct luarocks command line with templates
Kim Alvefur <zash@zash.se>
parents: 10871
diff changeset
221
11134
3e3f22043552 util.prosodyctl: Move hardcoded luarocks server into prosodyctl
Kim Alvefur <zash@zash.se>
parents: 11133
diff changeset
222 local function call_luarocks(operation, mod, server)
11290
7919ecdc4a72 util.prosodyctl: Use installer path prepared by util.startup
Kim Alvefur <zash@zash.se>
parents: 11136
diff changeset
223 local dir = prosody.paths.installer;
11490
34d4e4a01ef8 util.prosodyctl: Install plugins for current Lua version
Kim Alvefur <zash@zash.se>
parents: 11299
diff changeset
224 local ok, _, code = os.execute(render_cli("luarocks --lua-version={luav} {op} --tree={dir} {server&--server={server}} {mod?}", {
34d4e4a01ef8 util.prosodyctl: Install plugins for current Lua version
Kim Alvefur <zash@zash.se>
parents: 11299
diff changeset
225 dir = dir; op = operation; mod = mod; server = server; luav = _VERSION:match("5%.%d");
11136
d0d3e25b7300 util.prosodyctl: Simplify luarocks invocation
Kim Alvefur <zash@zash.se>
parents: 11134
diff changeset
226 }));
12785
123d74bf60e3 util.prosodyctl: Remove Lua 5.1 os.execute() return value compat
Kim Alvefur <zash@zash.se>
parents: 11490
diff changeset
227 return ok and code;
10181
c7d5cd766533 util.prosodyctl: Added the call_luarocks function
João Duarte <jvsDuarte08@gmail.com>
parents: 10180
diff changeset
228 end
c7d5cd766533 util.prosodyctl: Added the call_luarocks function
João Duarte <jvsDuarte08@gmail.com>
parents: 10180
diff changeset
229
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
230 return {
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
231 show_message = show_message;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
232 show_warning = show_message;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
233 show_usage = show_usage;
10152
7e9c30eab11e util.prosodyctl: Added the show_module_configuration_help function
João Duarte <jvsDuarte08@gmail.com>
parents: 10148
diff changeset
234 show_module_configuration_help = show_module_configuration_help;
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
235 adduser = adduser;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
236 user_exists = user_exists;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
237 passwd = passwd;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
238 deluser = deluser;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
239 getpid = getpid;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
240 isrunning = isrunning;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
241 start = start;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
242 stop = stop;
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
243 reload = reload;
10181
c7d5cd766533 util.prosodyctl: Added the call_luarocks function
João Duarte <jvsDuarte08@gmail.com>
parents: 10180
diff changeset
244 call_luarocks = call_luarocks;
10871
e5dee71d0ebb prosodyctl+util.prosodyctl.*: Start breaking up the ever-growing prosodyctl
Matthew Wild <mwild1@gmail.com>
parents: 10722
diff changeset
245 error_messages = error_messages;
6777
5de6b93d0190 util.*: Remove use of module() function, make all module functions local and return them in a table at the end
Kim Alvefur <zash@zash.se>
parents: 6771
diff changeset
246 };