diff options
author | Tobias Markmann <tm@ayena.de> | 2009-08-15 12:30:43 +0200 |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2009-08-15 12:30:43 +0200 |
commit | 60e7583c9f6f93928b5d7edca190a793d272293e (patch) | |
tree | 51aab67e3d46215d0dc911074db26ee8edc2f3ab | |
parent | 9d799a32c82fe16655cc4996b9ac96538dc04ed9 (diff) | |
download | prosody-60e7583c9f6f93928b5d7edca190a793d272293e.tar.gz prosody-60e7583c9f6f93928b5d7edca190a793d272293e.zip |
Shutdown prosody if changing user or group fails.
-rw-r--r-- | plugins/mod_posix.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 0184ef36..af4cdb16 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -29,12 +29,22 @@ module:add_event_hook("server-started", function () local uid = config_get("*", "core", "setuid"); local gid = config_get("*", "core", "setgid"); if gid then - pposix.setgid(gid); - module:log("debug", "Change group to "..gid.."."); + local success, msg = pposix.setgid(gid); + if success then + module:log("debug", "Changed group to "..gid.." successfully."); + else + module:log("error", "Failed to change group to "..gid..". Error: "..msg); + prosody.shutdown("Failed to change group to "..gid); + end end if uid then - pposix.setuid(uid); - module:log("debug", "Change user to "..uid.."."); + local success, msg = pposix.setuid(uid); + if success then + module:log("debug", "Changed user to "..uid.." successfully."); + else + module:log("error", "Failed to change user to "..uid..". Error: "..msg); + prosody.shutdown("Failed to change user to "..uid); + end end end); |