32 local uid = module:get_option("setuid"); |
32 local uid = module:get_option("setuid"); |
33 local gid = module:get_option("setgid"); |
33 local gid = module:get_option("setgid"); |
34 if gid then |
34 if gid then |
35 local success, msg = pposix.setgid(gid); |
35 local success, msg = pposix.setgid(gid); |
36 if success then |
36 if success then |
37 module:log("debug", "Changed group to "..gid.." successfully."); |
37 module:log("debug", "Changed group to %s successfully.", gid); |
38 else |
38 else |
39 module:log("error", "Failed to change group to "..gid..". Error: "..msg); |
39 module:log("error", "Failed to change group to %s. Error: %s", gid, msg); |
40 prosody.shutdown("Failed to change group to "..gid); |
40 prosody.shutdown("Failed to change group to %s", gid); |
41 end |
41 end |
42 end |
42 end |
43 if uid then |
43 if uid then |
44 local success, msg = pposix.setuid(uid); |
44 local success, msg = pposix.setuid(uid); |
45 if success then |
45 if success then |
46 module:log("debug", "Changed user to "..uid.." successfully."); |
46 module:log("debug", "Changed user to %s successfully.", uid); |
47 else |
47 else |
48 module:log("error", "Failed to change user to "..uid..". Error: "..msg); |
48 module:log("error", "Failed to change user to %s. Error: %s", uid, msg); |
49 prosody.shutdown("Failed to change user to "..uid); |
49 prosody.shutdown("Failed to change user to %s", uid); |
50 end |
50 end |
51 end |
51 end |
52 end); |
52 end); |
53 |
53 |
54 -- Don't even think about it! |
54 -- Don't even think about it! |