Download raw body.
gotwebd: ensure child procs inherit -f conffile
The below diff fixes a bug in gotwebd where a non-default config file is effectively ignored as child processes always use either the default config filepath (i.e., /etc/gotwebd.conf) or default options if no file exists at the default path. So if the `chroot` and/or `user` options, for example, set non-default values, they're silently ignored; the default chroot (/var/www) and user (www) are used instead. The diff restores the previous proc.c behaviour of copying the -f optarg to the child process argv. commit 9b84b1b63ab48741a8c3ad3846cbc618ad29bb76 (main) from: Mark Jamsek <mark@jamsek.dev> date: Tue Nov 19 12:14:52 2024 UTC gotwebd: ensure child procs inherit non-default config If a non-default config filepath is specified with -f, it is effectively ignored as child processes always either parse the default config file (/etc/gotwebd.conf) if it exists, or use defaults. Options specified in the config file used by server procs (e.g., chroot, user) are ignored. If -f is used with a non-default config file, pass it to child procs. M gotwebd/gotwebd.c | 5+ 1- 1 file changed, 5 insertions(+), 1 deletion(-) commit - 47450175a80904ac2ae82257a97bb0b9dfcdde3d commit + 9b84b1b63ab48741a8c3ad3846cbc618ad29bb76 blob - 80cd0545feee7ce87bd2fdf066a67b5a87c1e0d8 blob + 792b6cd2d9a880c6eda669664af5e7f61c4b8126 --- gotwebd/gotwebd.c +++ gotwebd/gotwebd.c @@ -210,7 +210,7 @@ gotwebd_sighdlr(int sig, short event, void *arg) static int spawn_socket_process(struct gotwebd *env, const char *argv0, int n) { - const char *argv[6]; + const char *argv[8]; int argc = 0; int p[2]; pid_t pid; @@ -238,6 +238,10 @@ spawn_socket_process(struct gotwebd *env, const char * argv[argc++] = argv0; argv[argc++] = "-S"; + if (strcmp(env->gotwebd_conffile, GOTWEBD_CONF) != 0) { + argv[argc++] = "-f"; + argv[argc++] = env->gotwebd_conffile; + } if (env->gotwebd_debug) argv[argc++] = "-d"; if (env->gotwebd_verbose > 0) -- Mark Jamsek <https://bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
gotwebd: ensure child procs inherit -f conffile