Remove requirement to use user root in snap package config files.

This commit is contained in:
Roger A. Light 2018-09-20 12:05:02 +01:00
parent 0e16a248f2
commit 7ca3a24686
2 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@
Broker:
- Elevate log level to warning for situation when socket limit is hit.
- Remove requirement to use `user root` in snap package config files.
1.5.2 - 20180919

View File

@ -94,6 +94,12 @@ int drop_privileges(struct mosquitto__config *config, bool temporary)
char err[256];
int rc;
const char *snap = getenv("SNAP_NAME");
if(snap && !strcmp(snap, "mosquitto")){
/* Don't attempt to drop privileges if running as a snap */
return MOSQ_ERR_SUCCESS;
}
if(geteuid() == 0){
if(config->user && strcmp(config->user, "root")){
pwd = getpwnam(config->user);