Changeset

1681:e76e2fb26fca

Make mod_posix not complain about root user, if setuid is set to something different as root.
author Tobias Markmann <tm@ayena.de>
date Sat, 15 Aug 2009 12:19:07 +0200
parents 1680:f3d241915429
children 1682:883cf1f516a0
files plugins/mod_posix.lua
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_posix.lua	Sat Aug 15 12:17:27 2009 +0200
+++ b/plugins/mod_posix.lua	Sat Aug 15 12:19:07 2009 +0200
@@ -40,10 +40,13 @@
 
 -- Don't even think about it!
 module:add_event_hook("server-starting", function ()
-		if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then
-			module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!");
-			module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root");
-			prosody.shutdown("Refusing to run as root");
+		local suid = config_get("*", "core", "setuid");
+		if not suid or suid == 0 or suid == "root" then
+			if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then
+				module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!");
+				module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root");
+				prosody.shutdown("Refusing to run as root");
+			end
 		end
 	end);