# HG changeset patch # User Tobias Markmann # Date 1250332243 -7200 # Node ID 883cf1f516a0e6d77052139adcfab90dc7b0c0a0 # Parent e76e2fb26fca0ff93a7bd4b4405b1b2adf57ab93 Shutdown prosody if changing user or group fails. diff -r e76e2fb26fca -r 883cf1f516a0 plugins/mod_posix.lua --- a/plugins/mod_posix.lua Sat Aug 15 12:19:07 2009 +0200 +++ b/plugins/mod_posix.lua Sat Aug 15 12:30:43 2009 +0200 @@ -29,12 +29,22 @@ 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);