Software / code / prosody
Comparison
prosodyctl @ 2439:511ba389147a
prosodyctl: Set umask to protect data files, bump pposix dep to 0.3.2
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 10 Jan 2010 22:14:44 +0000 |
| parent | 2410:ce912b648741 |
| child | 2442:94c676b585c0 |
comparison
equal
deleted
inserted
replaced
| 2438:819ba949c7bc | 2439:511ba389147a |
|---|---|
| 64 require "util.datamanager".set_data_path(data_path); | 64 require "util.datamanager".set_data_path(data_path); |
| 65 | 65 |
| 66 -- Switch away from root and into the prosody user -- | 66 -- Switch away from root and into the prosody user -- |
| 67 local switched_user, current_uid; | 67 local switched_user, current_uid; |
| 68 | 68 |
| 69 local want_pposix_version = "0.3.1"; | 69 local want_pposix_version = "0.3.2"; |
| 70 local ok, pposix = pcall(require, "util.pposix"); | 70 local ok, pposix = pcall(require, "util.pposix"); |
| 71 | 71 |
| 72 if ok and pposix then | 72 if ok and pposix then |
| 73 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end | 73 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end |
| 74 current_uid = pposix.getuid(); | 74 current_uid = pposix.getuid(); |
| 87 if not switched_user then | 87 if not switched_user then |
| 88 -- Boo! | 88 -- Boo! |
| 89 print("Warning: Couldn't switch to Prosody user/group '"..tostring(desired_user).."'/'"..tostring(desired_group).."': "..tostring(err)); | 89 print("Warning: Couldn't switch to Prosody user/group '"..tostring(desired_user).."'/'"..tostring(desired_group).."': "..tostring(err)); |
| 90 end | 90 end |
| 91 end | 91 end |
| 92 | |
| 93 -- Set our umask to protect data files | |
| 94 pposix.umask(config.get("*", "core", "umask") or "027"); | |
| 92 else | 95 else |
| 93 print("Error: Unable to load pposix module. Check that Prosody is installed correctly.") | 96 print("Error: Unable to load pposix module. Check that Prosody is installed correctly.") |
| 94 print("For more help send the below error to us through http://prosody.im/discuss"); | 97 print("For more help send the below error to us through http://prosody.im/discuss"); |
| 95 print(tostring(pposix)) | 98 print(tostring(pposix)) |
| 96 end | 99 end |