Software / code / prosody
Comparison
prosodyctl @ 8277:57c5dd08ff0a
prosodyctl: Abort and warn if the config can't be opened after dropping root privileges (fixes #990)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 27 Sep 2017 15:37:10 +0200 |
| parent | 8276:5ebad58b2548 |
| child | 8285:433b2a41351f |
| child | 8419:57610304e30d |
comparison
equal
deleted
inserted
replaced
| 8276:5ebad58b2548 | 8277:57c5dd08ff0a |
|---|---|
| 162 end | 162 end |
| 163 end | 163 end |
| 164 if not switched_user then | 164 if not switched_user then |
| 165 -- Boo! | 165 -- Boo! |
| 166 print("Warning: Couldn't switch to Prosody user/group '"..tostring(desired_user).."'/'"..tostring(desired_group).."': "..tostring(err)); | 166 print("Warning: Couldn't switch to Prosody user/group '"..tostring(desired_user).."'/'"..tostring(desired_group).."': "..tostring(err)); |
| 167 else | |
| 168 -- Make sure the Prosody user can read the config | |
| 169 local conf, err, errno = io.open(ENV_CONFIG); | |
| 170 if conf then | |
| 171 conf:close(); | |
| 172 else | |
| 173 print("The config file is not readable by the '"..desired_user.."' user."); | |
| 174 print("Prosody will not be able to read it."); | |
| 175 print("Error was "..err); | |
| 176 os.exit(1); | |
| 177 end | |
| 167 end | 178 end |
| 168 end | 179 end |
| 169 | 180 |
| 170 -- Set our umask to protect data files | 181 -- Set our umask to protect data files |
| 171 pposix.umask(config.get("*", "umask") or "027"); | 182 pposix.umask(config.get("*", "umask") or "027"); |