Blame


1 8a35f56c 2022-07-16 thomas /*
2 8a35f56c 2022-07-16 thomas * Copyright (c) 2016, 2019, 2020-2021 Tracey Emery <tracey@traceyemery.net>
3 8a35f56c 2022-07-16 thomas * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
4 8a35f56c 2022-07-16 thomas *
5 8a35f56c 2022-07-16 thomas * Permission to use, copy, modify, and distribute this software for any
6 8a35f56c 2022-07-16 thomas * purpose with or without fee is hereby granted, provided that the above
7 8a35f56c 2022-07-16 thomas * copyright notice and this permission notice appear in all copies.
8 8a35f56c 2022-07-16 thomas *
9 8a35f56c 2022-07-16 thomas * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 8a35f56c 2022-07-16 thomas * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 8a35f56c 2022-07-16 thomas * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 8a35f56c 2022-07-16 thomas * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 8a35f56c 2022-07-16 thomas * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 8a35f56c 2022-07-16 thomas * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 8a35f56c 2022-07-16 thomas * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 8a35f56c 2022-07-16 thomas */
17 8a35f56c 2022-07-16 thomas
18 8a35f56c 2022-07-16 thomas #include <sys/param.h>
19 8b925c6c 2022-07-16 thomas #include <sys/queue.h>
20 8a35f56c 2022-07-16 thomas #include <sys/socket.h>
21 8a35f56c 2022-07-16 thomas #include <sys/wait.h>
22 8a35f56c 2022-07-16 thomas #include <sys/cdefs.h>
23 8a35f56c 2022-07-16 thomas
24 8a35f56c 2022-07-16 thomas #include <net/if.h>
25 8a35f56c 2022-07-16 thomas #include <netinet/in.h>
26 8a35f56c 2022-07-16 thomas
27 8a35f56c 2022-07-16 thomas #include <stdio.h>
28 8a35f56c 2022-07-16 thomas #include <stdlib.h>
29 8a35f56c 2022-07-16 thomas #include <string.h>
30 8a35f56c 2022-07-16 thomas #include <termios.h>
31 8a35f56c 2022-07-16 thomas #include <err.h>
32 8a35f56c 2022-07-16 thomas #include <errno.h>
33 8a35f56c 2022-07-16 thomas #include <event.h>
34 8a35f56c 2022-07-16 thomas #include <fcntl.h>
35 8a35f56c 2022-07-16 thomas #include <pwd.h>
36 8a35f56c 2022-07-16 thomas #include <signal.h>
37 8a35f56c 2022-07-16 thomas #include <syslog.h>
38 8a35f56c 2022-07-16 thomas #include <unistd.h>
39 8a35f56c 2022-07-16 thomas #include <ctype.h>
40 8a35f56c 2022-07-16 thomas
41 4fccd2fe 2023-03-08 thomas #include "got_compat.h"
42 8a35f56c 2022-07-16 thomas #include "got_opentemp.h"
43 8a35f56c 2022-07-16 thomas
44 8a35f56c 2022-07-16 thomas #include "proc.h"
45 8a35f56c 2022-07-16 thomas #include "gotwebd.h"
46 8a35f56c 2022-07-16 thomas
47 8a35f56c 2022-07-16 thomas __dead void usage(void);
48 8a35f56c 2022-07-16 thomas
49 8a35f56c 2022-07-16 thomas int main(int, char **);
50 8a35f56c 2022-07-16 thomas int gotwebd_configure(struct gotwebd *);
51 8a35f56c 2022-07-16 thomas void gotwebd_configure_done(struct gotwebd *);
52 8a35f56c 2022-07-16 thomas void gotwebd_sighdlr(int sig, short event, void *arg);
53 8a35f56c 2022-07-16 thomas void gotwebd_shutdown(void);
54 8a35f56c 2022-07-16 thomas int gotwebd_dispatch_sockets(int, struct privsep_proc *, struct imsg *);
55 8a35f56c 2022-07-16 thomas
56 8a35f56c 2022-07-16 thomas struct gotwebd *gotwebd_env;
57 8a35f56c 2022-07-16 thomas
58 8a35f56c 2022-07-16 thomas static struct privsep_proc procs[] = {
59 8a35f56c 2022-07-16 thomas { "sockets", PROC_SOCKS, gotwebd_dispatch_sockets, sockets,
60 8a35f56c 2022-07-16 thomas sockets_shutdown },
61 8a35f56c 2022-07-16 thomas };
62 8a35f56c 2022-07-16 thomas
63 8a35f56c 2022-07-16 thomas int
64 8a35f56c 2022-07-16 thomas gotwebd_dispatch_sockets(int fd, struct privsep_proc *p, struct imsg *imsg)
65 8a35f56c 2022-07-16 thomas {
66 8a35f56c 2022-07-16 thomas struct privsep *ps = p->p_ps;
67 8a35f56c 2022-07-16 thomas struct gotwebd *env = ps->ps_env;
68 8a35f56c 2022-07-16 thomas
69 8a35f56c 2022-07-16 thomas switch (imsg->hdr.type) {
70 8a35f56c 2022-07-16 thomas case IMSG_CFG_DONE:
71 8a35f56c 2022-07-16 thomas gotwebd_configure_done(env);
72 8a35f56c 2022-07-16 thomas break;
73 8a35f56c 2022-07-16 thomas default:
74 8a35f56c 2022-07-16 thomas return (-1);
75 8a35f56c 2022-07-16 thomas }
76 8a35f56c 2022-07-16 thomas
77 8a35f56c 2022-07-16 thomas return (0);
78 8a35f56c 2022-07-16 thomas }
79 8a35f56c 2022-07-16 thomas
80 8a35f56c 2022-07-16 thomas void
81 8a35f56c 2022-07-16 thomas gotwebd_sighdlr(int sig, short event, void *arg)
82 8a35f56c 2022-07-16 thomas {
83 8a35f56c 2022-07-16 thomas /* struct privsep *ps = arg; */
84 8a35f56c 2022-07-16 thomas
85 8a35f56c 2022-07-16 thomas if (privsep_process != PROC_GOTWEBD)
86 8a35f56c 2022-07-16 thomas return;
87 8a35f56c 2022-07-16 thomas
88 8a35f56c 2022-07-16 thomas switch (sig) {
89 8a35f56c 2022-07-16 thomas case SIGHUP:
90 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGHUP", __func__);
91 8a35f56c 2022-07-16 thomas break;
92 8a35f56c 2022-07-16 thomas case SIGPIPE:
93 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGPIPE", __func__);
94 8a35f56c 2022-07-16 thomas break;
95 8a35f56c 2022-07-16 thomas case SIGUSR1:
96 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGUSR1", __func__);
97 8a35f56c 2022-07-16 thomas break;
98 8a35f56c 2022-07-16 thomas case SIGTERM:
99 8a35f56c 2022-07-16 thomas case SIGINT:
100 8a35f56c 2022-07-16 thomas gotwebd_shutdown();
101 8a35f56c 2022-07-16 thomas break;
102 8a35f56c 2022-07-16 thomas default:
103 8a35f56c 2022-07-16 thomas fatalx("unexpected signal");
104 8a35f56c 2022-07-16 thomas }
105 8a35f56c 2022-07-16 thomas }
106 8a35f56c 2022-07-16 thomas
107 8a35f56c 2022-07-16 thomas __dead void
108 8a35f56c 2022-07-16 thomas usage(void)
109 8a35f56c 2022-07-16 thomas {
110 8a35f56c 2022-07-16 thomas fprintf(stderr, "usage: %s [-dnv] [-D macro=value] [-f file]\n",
111 8a35f56c 2022-07-16 thomas getprogname());
112 8a35f56c 2022-07-16 thomas exit(1);
113 8a35f56c 2022-07-16 thomas }
114 8a35f56c 2022-07-16 thomas
115 8a35f56c 2022-07-16 thomas int
116 8a35f56c 2022-07-16 thomas main(int argc, char **argv)
117 8a35f56c 2022-07-16 thomas {
118 8a35f56c 2022-07-16 thomas struct gotwebd *env;
119 8a35f56c 2022-07-16 thomas struct privsep *ps;
120 8a35f56c 2022-07-16 thomas unsigned int proc;
121 8a35f56c 2022-07-16 thomas int ch;
122 8a35f56c 2022-07-16 thomas const char *conffile = GOTWEBD_CONF;
123 8a35f56c 2022-07-16 thomas enum privsep_procid proc_id = PROC_GOTWEBD;
124 8a35f56c 2022-07-16 thomas int proc_instance = 0;
125 8a35f56c 2022-07-16 thomas const char *errp, *title = NULL;
126 8a35f56c 2022-07-16 thomas int argc0 = argc;
127 8a35f56c 2022-07-16 thomas
128 8a35f56c 2022-07-16 thomas env = calloc(1, sizeof(*env));
129 8a35f56c 2022-07-16 thomas if (env == NULL)
130 8a35f56c 2022-07-16 thomas fatal("%s: calloc", __func__);
131 8a35f56c 2022-07-16 thomas
132 8a35f56c 2022-07-16 thomas /* XXX: add s and S for both sockets */
133 f7065961 2022-10-27 thomas while ((ch = getopt(argc, argv, "D:df:I:nP:v")) != -1) {
134 8a35f56c 2022-07-16 thomas switch (ch) {
135 8a35f56c 2022-07-16 thomas case 'D':
136 8a35f56c 2022-07-16 thomas if (cmdline_symset(optarg) < 0)
137 8a35f56c 2022-07-16 thomas log_warnx("could not parse macro definition %s",
138 8a35f56c 2022-07-16 thomas optarg);
139 8a35f56c 2022-07-16 thomas break;
140 8a35f56c 2022-07-16 thomas case 'd':
141 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 2;
142 8a35f56c 2022-07-16 thomas break;
143 8a35f56c 2022-07-16 thomas case 'f':
144 8a35f56c 2022-07-16 thomas conffile = optarg;
145 8a35f56c 2022-07-16 thomas break;
146 f7065961 2022-10-27 thomas case 'I':
147 f7065961 2022-10-27 thomas proc_instance = strtonum(optarg, 0,
148 f7065961 2022-10-27 thomas PROC_MAX_INSTANCES, &errp);
149 f7065961 2022-10-27 thomas if (errp)
150 f7065961 2022-10-27 thomas fatalx("invalid process instance");
151 8a35f56c 2022-07-16 thomas break;
152 8a35f56c 2022-07-16 thomas case 'n':
153 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 2;
154 8a35f56c 2022-07-16 thomas env->gotwebd_noaction = 1;
155 8a35f56c 2022-07-16 thomas break;
156 8a35f56c 2022-07-16 thomas case 'P':
157 8a35f56c 2022-07-16 thomas title = optarg;
158 8a35f56c 2022-07-16 thomas proc_id = proc_getid(procs, nitems(procs), title);
159 8a35f56c 2022-07-16 thomas if (proc_id == PROC_MAX)
160 8a35f56c 2022-07-16 thomas fatalx("invalid process name");
161 8a35f56c 2022-07-16 thomas break;
162 f7065961 2022-10-27 thomas case 'v':
163 f7065961 2022-10-27 thomas env->gotwebd_verbose++;
164 8a35f56c 2022-07-16 thomas break;
165 8a35f56c 2022-07-16 thomas default:
166 8a35f56c 2022-07-16 thomas usage();
167 8a35f56c 2022-07-16 thomas }
168 8a35f56c 2022-07-16 thomas }
169 8a35f56c 2022-07-16 thomas
170 8a35f56c 2022-07-16 thomas /* log to stderr until daemonized */
171 8a35f56c 2022-07-16 thomas log_init(env->gotwebd_debug ? env->gotwebd_debug : 1, LOG_DAEMON);
172 8a35f56c 2022-07-16 thomas
173 8a35f56c 2022-07-16 thomas argc -= optind;
174 8a35f56c 2022-07-16 thomas if (argc > 0)
175 8a35f56c 2022-07-16 thomas usage();
176 8a35f56c 2022-07-16 thomas
177 8a35f56c 2022-07-16 thomas ps = calloc(1, sizeof(*ps));
178 8a35f56c 2022-07-16 thomas if (ps == NULL)
179 8a35f56c 2022-07-16 thomas fatal("%s: calloc:", __func__);
180 8a35f56c 2022-07-16 thomas
181 8a35f56c 2022-07-16 thomas gotwebd_env = env;
182 8a35f56c 2022-07-16 thomas env->gotwebd_ps = ps;
183 8a35f56c 2022-07-16 thomas ps->ps_env = env;
184 8a35f56c 2022-07-16 thomas env->gotwebd_conffile = conffile;
185 8a35f56c 2022-07-16 thomas
186 8a35f56c 2022-07-16 thomas if (parse_config(env->gotwebd_conffile, env) == -1)
187 8a35f56c 2022-07-16 thomas exit(1);
188 8a35f56c 2022-07-16 thomas
189 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction && !env->gotwebd_debug)
190 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 1;
191 8a35f56c 2022-07-16 thomas
192 8a35f56c 2022-07-16 thomas /* check for root privileges */
193 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction == 0) {
194 8a35f56c 2022-07-16 thomas if (geteuid())
195 8a35f56c 2022-07-16 thomas fatalx("need root privileges");
196 8a35f56c 2022-07-16 thomas }
197 8a35f56c 2022-07-16 thomas
198 8a35f56c 2022-07-16 thomas ps->ps_pw = getpwnam(GOTWEBD_USER);
199 8a35f56c 2022-07-16 thomas if (ps->ps_pw == NULL)
200 8a35f56c 2022-07-16 thomas fatalx("unknown user %s", GOTWEBD_USER);
201 8a35f56c 2022-07-16 thomas
202 8a35f56c 2022-07-16 thomas log_init(env->gotwebd_debug, LOG_DAEMON);
203 8a35f56c 2022-07-16 thomas log_setverbose(env->gotwebd_verbose);
204 8a35f56c 2022-07-16 thomas
205 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction)
206 8a35f56c 2022-07-16 thomas ps->ps_noaction = 1;
207 8a35f56c 2022-07-16 thomas
208 8a35f56c 2022-07-16 thomas ps->ps_instances[PROC_SOCKS] = env->prefork_gotwebd;
209 8a35f56c 2022-07-16 thomas ps->ps_instance = proc_instance;
210 8a35f56c 2022-07-16 thomas if (title != NULL)
211 8a35f56c 2022-07-16 thomas ps->ps_title[proc_id] = title;
212 8a35f56c 2022-07-16 thomas
213 8a35f56c 2022-07-16 thomas for (proc = 0; proc < nitems(procs); proc++)
214 8a35f56c 2022-07-16 thomas procs[proc].p_chroot = strlen(env->httpd_chroot) ?
215 8a35f56c 2022-07-16 thomas env->httpd_chroot : D_HTTPD_CHROOT;
216 8a35f56c 2022-07-16 thomas
217 8a35f56c 2022-07-16 thomas /* only the gotwebd returns */
218 8a35f56c 2022-07-16 thomas proc_init(ps, procs, nitems(procs), argc0, argv, proc_id);
219 8a35f56c 2022-07-16 thomas
220 8a35f56c 2022-07-16 thomas log_procinit("gotwebd");
221 8a35f56c 2022-07-16 thomas if (!env->gotwebd_debug && daemon(0, 0) == -1)
222 8a35f56c 2022-07-16 thomas fatal("can't daemonize");
223 8a35f56c 2022-07-16 thomas
224 8a35f56c 2022-07-16 thomas if (ps->ps_noaction == 0)
225 8a35f56c 2022-07-16 thomas log_info("%s startup", getprogname());
226 8a35f56c 2022-07-16 thomas
227 8a35f56c 2022-07-16 thomas event_init();
228 8a35f56c 2022-07-16 thomas
229 8a35f56c 2022-07-16 thomas signal_set(&ps->ps_evsigint, SIGINT, gotwebd_sighdlr, ps);
230 8a35f56c 2022-07-16 thomas signal_set(&ps->ps_evsigterm, SIGTERM, gotwebd_sighdlr, ps);
231 8a35f56c 2022-07-16 thomas signal_set(&ps->ps_evsighup, SIGHUP, gotwebd_sighdlr, ps);
232 8a35f56c 2022-07-16 thomas signal_set(&ps->ps_evsigpipe, SIGPIPE, gotwebd_sighdlr, ps);
233 8a35f56c 2022-07-16 thomas signal_set(&ps->ps_evsigusr1, SIGUSR1, gotwebd_sighdlr, ps);
234 8a35f56c 2022-07-16 thomas
235 8a35f56c 2022-07-16 thomas signal_add(&ps->ps_evsigint, NULL);
236 8a35f56c 2022-07-16 thomas signal_add(&ps->ps_evsigterm, NULL);
237 8a35f56c 2022-07-16 thomas signal_add(&ps->ps_evsighup, NULL);
238 8a35f56c 2022-07-16 thomas signal_add(&ps->ps_evsigpipe, NULL);
239 8a35f56c 2022-07-16 thomas signal_add(&ps->ps_evsigusr1, NULL);
240 8a35f56c 2022-07-16 thomas
241 8a35f56c 2022-07-16 thomas if (!env->gotwebd_noaction)
242 8a35f56c 2022-07-16 thomas proc_connect(ps);
243 8a35f56c 2022-07-16 thomas
244 8a35f56c 2022-07-16 thomas if (gotwebd_configure(env) == -1)
245 8a35f56c 2022-07-16 thomas fatalx("configuration failed");
246 8a35f56c 2022-07-16 thomas
247 8a35f56c 2022-07-16 thomas #ifdef PROFILE
248 8a35f56c 2022-07-16 thomas if (unveil("gmon.out", "rwc") != 0)
249 8a35f56c 2022-07-16 thomas err(1, "gmon.out");
250 8a35f56c 2022-07-16 thomas #endif
251 8a35f56c 2022-07-16 thomas
252 8a35f56c 2022-07-16 thomas if (unveil(strlen(env->httpd_chroot) > 0 ? env->httpd_chroot :
253 8a35f56c 2022-07-16 thomas D_HTTPD_CHROOT, "rwc") == -1)
254 8a35f56c 2022-07-16 thomas err(1, "unveil");
255 8a35f56c 2022-07-16 thomas
256 8a35f56c 2022-07-16 thomas if (unveil(GOT_TMPDIR_STR, "rw") == -1)
257 8a35f56c 2022-07-16 thomas err(1, "unveil");
258 8a35f56c 2022-07-16 thomas
259 8a35f56c 2022-07-16 thomas if (unveil(GOTWEBD_CONF, "r") == -1)
260 8a35f56c 2022-07-16 thomas err(1, "unveil");
261 8a35f56c 2022-07-16 thomas
262 8a35f56c 2022-07-16 thomas if (unveil(NULL, NULL) != 0)
263 8a35f56c 2022-07-16 thomas err(1, "unveil");
264 8a35f56c 2022-07-16 thomas
265 8a35f56c 2022-07-16 thomas #ifndef PROFILE
266 8a35f56c 2022-07-16 thomas if (pledge("stdio rpath wpath cpath inet unix", NULL) == -1)
267 8a35f56c 2022-07-16 thomas err(1, "pledge");
268 8a35f56c 2022-07-16 thomas #endif
269 8a35f56c 2022-07-16 thomas
270 8a35f56c 2022-07-16 thomas event_dispatch();
271 8a35f56c 2022-07-16 thomas
272 8a35f56c 2022-07-16 thomas log_debug("%s gotwebd exiting", getprogname());
273 8a35f56c 2022-07-16 thomas
274 8a35f56c 2022-07-16 thomas return (0);
275 8a35f56c 2022-07-16 thomas }
276 8a35f56c 2022-07-16 thomas
277 8a35f56c 2022-07-16 thomas int
278 8a35f56c 2022-07-16 thomas gotwebd_configure(struct gotwebd *env)
279 8a35f56c 2022-07-16 thomas {
280 8a35f56c 2022-07-16 thomas struct server *srv;
281 8a35f56c 2022-07-16 thomas struct socket *sock;
282 8a35f56c 2022-07-16 thomas int id;
283 8a35f56c 2022-07-16 thomas
284 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction) {
285 8a35f56c 2022-07-16 thomas fprintf(stderr, "configuration OK\n");
286 8a35f56c 2022-07-16 thomas proc_kill(env->gotwebd_ps);
287 8a35f56c 2022-07-16 thomas exit(0);
288 8a35f56c 2022-07-16 thomas }
289 8a35f56c 2022-07-16 thomas
290 8a35f56c 2022-07-16 thomas /* gotweb need to reload its config. */
291 8a35f56c 2022-07-16 thomas env->gotwebd_reload = env->prefork_gotwebd;
292 8a35f56c 2022-07-16 thomas
293 8a35f56c 2022-07-16 thomas /* send our gotweb servers */
294 90d63d47 2022-08-16 thomas TAILQ_FOREACH(srv, &env->servers, entry) {
295 8a35f56c 2022-07-16 thomas if (config_setserver(env, srv) == -1)
296 8a35f56c 2022-07-16 thomas fatalx("%s: send server error", __func__);
297 8a35f56c 2022-07-16 thomas }
298 8a35f56c 2022-07-16 thomas
299 8a35f56c 2022-07-16 thomas /* send our sockets */
300 90d63d47 2022-08-16 thomas TAILQ_FOREACH(sock, &env->sockets, entry) {
301 8a35f56c 2022-07-16 thomas if (config_setsock(env, sock) == -1)
302 8a35f56c 2022-07-16 thomas fatalx("%s: send socket error", __func__);
303 8a35f56c 2022-07-16 thomas if (config_setfd(env, sock) == -1)
304 8a35f56c 2022-07-16 thomas fatalx("%s: send priv_fd error", __func__);
305 8a35f56c 2022-07-16 thomas }
306 8a35f56c 2022-07-16 thomas
307 8a35f56c 2022-07-16 thomas for (id = 0; id < PROC_MAX; id++) {
308 8a35f56c 2022-07-16 thomas if (id == privsep_process)
309 8a35f56c 2022-07-16 thomas continue;
310 8a35f56c 2022-07-16 thomas proc_compose(env->gotwebd_ps, id, IMSG_CFG_DONE, NULL, 0);
311 8a35f56c 2022-07-16 thomas }
312 8a35f56c 2022-07-16 thomas
313 8a35f56c 2022-07-16 thomas return (0);
314 8a35f56c 2022-07-16 thomas }
315 8a35f56c 2022-07-16 thomas
316 8a35f56c 2022-07-16 thomas void
317 8a35f56c 2022-07-16 thomas gotwebd_configure_done(struct gotwebd *env)
318 8a35f56c 2022-07-16 thomas {
319 8a35f56c 2022-07-16 thomas int id;
320 8a35f56c 2022-07-16 thomas
321 8a35f56c 2022-07-16 thomas if (env->gotwebd_reload == 0) {
322 8a35f56c 2022-07-16 thomas log_warnx("%s: configuration already finished", __func__);
323 8a35f56c 2022-07-16 thomas return;
324 8a35f56c 2022-07-16 thomas }
325 8a35f56c 2022-07-16 thomas
326 8a35f56c 2022-07-16 thomas env->gotwebd_reload--;
327 8a35f56c 2022-07-16 thomas if (env->gotwebd_reload == 0) {
328 8a35f56c 2022-07-16 thomas for (id = 0; id < PROC_MAX; id++) {
329 8a35f56c 2022-07-16 thomas if (id == privsep_process)
330 8a35f56c 2022-07-16 thomas continue;
331 8a35f56c 2022-07-16 thomas proc_compose(env->gotwebd_ps, id, IMSG_CTL_START,
332 8a35f56c 2022-07-16 thomas NULL, 0);
333 8a35f56c 2022-07-16 thomas }
334 8a35f56c 2022-07-16 thomas }
335 8a35f56c 2022-07-16 thomas }
336 8a35f56c 2022-07-16 thomas
337 8a35f56c 2022-07-16 thomas void
338 8a35f56c 2022-07-16 thomas gotwebd_shutdown(void)
339 8a35f56c 2022-07-16 thomas {
340 8a35f56c 2022-07-16 thomas proc_kill(gotwebd_env->gotwebd_ps);
341 8a35f56c 2022-07-16 thomas
342 8a35f56c 2022-07-16 thomas /* unlink(gotwebd_env->gotweb->gotweb_conf.gotweb_unix_socket_name); */
343 8a35f56c 2022-07-16 thomas /* free(gotwebd_env->gotweb); */
344 8a35f56c 2022-07-16 thomas free(gotwebd_env);
345 8a35f56c 2022-07-16 thomas
346 8a35f56c 2022-07-16 thomas log_warnx("gotwebd terminating");
347 8a35f56c 2022-07-16 thomas exit(0);
348 8a35f56c 2022-07-16 thomas }