char *arg; /* argument passed to "bind" for better error reporting */
char *file; /* file where the section appears */
int line; /* line where the section appears */
- struct { /* UNIX socket permissions */
- uid_t uid; /* -1 to leave unchanged */
- gid_t gid; /* -1 to leave unchanged */
- mode_t mode; /* 0 to leave unchanged */
- } ux;
+ struct {
+ struct { /* UNIX socket permissions */
+ uid_t uid; /* -1 to leave unchanged */
+ gid_t gid; /* -1 to leave unchanged */
+ mode_t mode; /* 0 to leave unchanged */
+ } ux;
+ } settings; /* all the settings needed for the listening socket */
};
/* The listener will be directly referenced by the fdtab[] which holds its
if (arg)
bind_conf->arg = strdup(arg);
- bind_conf->ux.uid = -1;
- bind_conf->ux.gid = -1;
- bind_conf->ux.mode = 0;
+ bind_conf->settings.ux.uid = -1;
+ bind_conf->settings.ux.gid = -1;
+ bind_conf->settings.ux.mode = 0;
bind_conf->xprt = xprt;
bind_conf->frontend = fe;
bind_conf->severity_output = CLI_SEVERITY_NONE;
bind_conf = bind_conf_alloc(curproxy, file, linenum, args[1], xprt_get(XPRT_RAW));
/* use default settings for unix sockets */
- bind_conf->ux.uid = global.unix_bind.ux.uid;
- bind_conf->ux.gid = global.unix_bind.ux.gid;
- bind_conf->ux.mode = global.unix_bind.ux.mode;
+ bind_conf->settings.ux.uid = global.unix_bind.ux.uid;
+ bind_conf->settings.ux.gid = global.unix_bind.ux.gid;
+ bind_conf->settings.ux.mode = global.unix_bind.ux.mode;
/* NOTE: the following line might create several listeners if there
* are comma-separated IPs or port ranges. So all further processing
{
char *endptr;
- conf->ux.mode = strtol(args[cur_arg + 1], &endptr, 8);
+ conf->settings.ux.mode = strtol(args[cur_arg + 1], &endptr, 8);
if (!*args[cur_arg + 1] || *endptr) {
memprintf(err, "'%s' : missing or invalid mode '%s' (octal integer expected)", args[cur_arg], args[cur_arg + 1]);
return ERR_ALERT | ERR_FATAL;
}
- conf->ux.gid = atol(args[cur_arg + 1]);
+ conf->settings.ux.gid = atol(args[cur_arg + 1]);
return 0;
}
return ERR_ALERT | ERR_FATAL;
}
- conf->ux.gid = group->gr_gid;
+ conf->settings.ux.gid = group->gr_gid;
return 0;
}
return ERR_ALERT | ERR_FATAL;
}
- conf->ux.uid = atol(args[cur_arg + 1]);
+ conf->settings.ux.uid = atol(args[cur_arg + 1]);
return 0;
}
return ERR_ALERT | ERR_FATAL;
}
- conf->ux.uid = user->pw_uid;
+ conf->settings.ux.uid = user->pw_uid;
return 0;
}
* where it works. We also don't change permissions on abstract sockets.
*/
if (!ext && path[0] &&
- (((listener->bind_conf->ux.uid != -1 || listener->bind_conf->ux.gid != -1) &&
- (chown(tempname, listener->bind_conf->ux.uid, listener->bind_conf->ux.gid) == -1)) ||
- (listener->bind_conf->ux.mode != 0 && chmod(tempname, listener->bind_conf->ux.mode) == -1))) {
+ (((listener->bind_conf->settings.ux.uid != -1 || listener->bind_conf->settings.ux.gid != -1) &&
+ (chown(tempname, listener->bind_conf->settings.ux.uid, listener->bind_conf->settings.ux.gid) == -1)) ||
+ (listener->bind_conf->settings.ux.mode != 0 && chmod(tempname, listener->bind_conf->settings.ux.mode) == -1))) {
err |= ERR_FATAL | ERR_ALERT;
msg = "cannot change UNIX socket ownership";
goto err_unlink_temp;