Software /
code /
prosody
Comparison
prosodyctl @ 8094:dcda2ae4569d
prosodyctl: Don't switch user if we are root and run_as_root is enabled
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 19 Apr 2017 12:40:03 +0100 |
parent | 8067:91550b6f93d2 |
child | 8096:dd3191974f2a |
comparison
equal
deleted
inserted
replaced
8092:0a1c0f1107d2 | 8094:dcda2ae4569d |
---|---|
139 local ok, pposix = pcall(require, "util.pposix"); | 139 local ok, pposix = pcall(require, "util.pposix"); |
140 | 140 |
141 if ok and pposix then | 141 if ok and pposix then |
142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end | 142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end |
143 current_uid = pposix.getuid(); | 143 current_uid = pposix.getuid(); |
144 if current_uid == 0 then | 144 if current_uid == 0 and config.get("*", "run_as_root") ~= true then |
145 -- We haz root! | 145 -- We haz root! |
146 local desired_user = config.get("*", "prosody_user") or "prosody"; | 146 local desired_user = config.get("*", "prosody_user") or "prosody"; |
147 local desired_group = config.get("*", "prosody_group") or desired_user; | 147 local desired_group = config.get("*", "prosody_group") or desired_user; |
148 local ok, err = pposix.setgid(desired_group); | 148 local ok, err = pposix.setgid(desired_group); |
149 if ok then | 149 if ok then |