Mercurial > prosody-hg
comparison plugins/mod_posix.lua @ 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 | f3d241915429 |
| children | 883cf1f516a0 |
comparison
equal
deleted
inserted
replaced
| 1680:f3d241915429 | 1681:e76e2fb26fca |
|---|---|
| 38 end | 38 end |
| 39 end); | 39 end); |
| 40 | 40 |
| 41 -- Don't even think about it! | 41 -- Don't even think about it! |
| 42 module:add_event_hook("server-starting", function () | 42 module:add_event_hook("server-starting", function () |
| 43 if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then | 43 local suid = config_get("*", "core", "setuid"); |
| 44 module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); | 44 if not suid or suid == 0 or suid == "root" then |
| 45 module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root"); | 45 if pposix.getuid() == 0 and not config_get("*", "core", "run_as_root") then |
| 46 prosody.shutdown("Refusing to run as root"); | 46 module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); |
| 47 module:log("error", "For more information on running Prosody as root, see http://prosody.im/doc/root"); | |
| 48 prosody.shutdown("Refusing to run as root"); | |
| 49 end | |
| 47 end | 50 end |
| 48 end); | 51 end); |
| 49 | 52 |
| 50 local pidfile_written; | 53 local pidfile_written; |
| 51 | 54 |
