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 161663e7 2023-03-11 thomas #include "got_reference.h"
44 8a35f56c 2022-07-16 thomas
45 8a35f56c 2022-07-16 thomas #include "proc.h"
46 8a35f56c 2022-07-16 thomas #include "gotwebd.h"
47 8a35f56c 2022-07-16 thomas
48 8a35f56c 2022-07-16 thomas __dead void usage(void);
49 8a35f56c 2022-07-16 thomas
50 8a35f56c 2022-07-16 thomas int main(int, char **);
51 8a35f56c 2022-07-16 thomas int gotwebd_configure(struct gotwebd *);
52 8a35f56c 2022-07-16 thomas void gotwebd_configure_done(struct gotwebd *);
53 8a35f56c 2022-07-16 thomas void gotwebd_sighdlr(int sig, short event, void *arg);
54 8a35f56c 2022-07-16 thomas void gotwebd_shutdown(void);
55 8a35f56c 2022-07-16 thomas int gotwebd_dispatch_sockets(int, struct privsep_proc *, struct imsg *);
56 8a35f56c 2022-07-16 thomas
57 8a35f56c 2022-07-16 thomas struct gotwebd *gotwebd_env;
58 8a35f56c 2022-07-16 thomas
59 8a35f56c 2022-07-16 thomas static struct privsep_proc procs[] = {
60 8a35f56c 2022-07-16 thomas { "sockets", PROC_SOCKS, gotwebd_dispatch_sockets, sockets,
61 8a35f56c 2022-07-16 thomas sockets_shutdown },
62 8a35f56c 2022-07-16 thomas };
63 8a35f56c 2022-07-16 thomas
64 8a35f56c 2022-07-16 thomas int
65 8a35f56c 2022-07-16 thomas gotwebd_dispatch_sockets(int fd, struct privsep_proc *p, struct imsg *imsg)
66 8a35f56c 2022-07-16 thomas {
67 8a35f56c 2022-07-16 thomas struct privsep *ps = p->p_ps;
68 8a35f56c 2022-07-16 thomas struct gotwebd *env = ps->ps_env;
69 8a35f56c 2022-07-16 thomas
70 8a35f56c 2022-07-16 thomas switch (imsg->hdr.type) {
71 8a35f56c 2022-07-16 thomas case IMSG_CFG_DONE:
72 8a35f56c 2022-07-16 thomas gotwebd_configure_done(env);
73 8a35f56c 2022-07-16 thomas break;
74 8a35f56c 2022-07-16 thomas default:
75 8a35f56c 2022-07-16 thomas return (-1);
76 8a35f56c 2022-07-16 thomas }
77 8a35f56c 2022-07-16 thomas
78 8a35f56c 2022-07-16 thomas return (0);
79 8a35f56c 2022-07-16 thomas }
80 8a35f56c 2022-07-16 thomas
81 8a35f56c 2022-07-16 thomas void
82 8a35f56c 2022-07-16 thomas gotwebd_sighdlr(int sig, short event, void *arg)
83 8a35f56c 2022-07-16 thomas {
84 8a35f56c 2022-07-16 thomas /* struct privsep *ps = arg; */
85 8a35f56c 2022-07-16 thomas
86 8a35f56c 2022-07-16 thomas if (privsep_process != PROC_GOTWEBD)
87 8a35f56c 2022-07-16 thomas return;
88 8a35f56c 2022-07-16 thomas
89 8a35f56c 2022-07-16 thomas switch (sig) {
90 8a35f56c 2022-07-16 thomas case SIGHUP:
91 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGHUP", __func__);
92 8a35f56c 2022-07-16 thomas break;
93 8a35f56c 2022-07-16 thomas case SIGPIPE:
94 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGPIPE", __func__);
95 8a35f56c 2022-07-16 thomas break;
96 8a35f56c 2022-07-16 thomas case SIGUSR1:
97 8a35f56c 2022-07-16 thomas log_info("%s: ignoring SIGUSR1", __func__);
98 8a35f56c 2022-07-16 thomas break;
99 8a35f56c 2022-07-16 thomas case SIGTERM:
100 8a35f56c 2022-07-16 thomas case SIGINT:
101 8a35f56c 2022-07-16 thomas gotwebd_shutdown();
102 8a35f56c 2022-07-16 thomas break;
103 8a35f56c 2022-07-16 thomas default:
104 8a35f56c 2022-07-16 thomas fatalx("unexpected signal");
105 8a35f56c 2022-07-16 thomas }
106 8a35f56c 2022-07-16 thomas }
107 8a35f56c 2022-07-16 thomas
108 8a35f56c 2022-07-16 thomas __dead void
109 8a35f56c 2022-07-16 thomas usage(void)
110 8a35f56c 2022-07-16 thomas {
111 8a35f56c 2022-07-16 thomas fprintf(stderr, "usage: %s [-dnv] [-D macro=value] [-f file]\n",
112 8a35f56c 2022-07-16 thomas getprogname());
113 8a35f56c 2022-07-16 thomas exit(1);
114 8a35f56c 2022-07-16 thomas }
115 8a35f56c 2022-07-16 thomas
116 8a35f56c 2022-07-16 thomas int
117 8a35f56c 2022-07-16 thomas main(int argc, char **argv)
118 8a35f56c 2022-07-16 thomas {
119 8a35f56c 2022-07-16 thomas struct gotwebd *env;
120 8a35f56c 2022-07-16 thomas struct privsep *ps;
121 8a35f56c 2022-07-16 thomas unsigned int proc;
122 8a35f56c 2022-07-16 thomas int ch;
123 8a35f56c 2022-07-16 thomas const char *conffile = GOTWEBD_CONF;
124 8a35f56c 2022-07-16 thomas enum privsep_procid proc_id = PROC_GOTWEBD;
125 8a35f56c 2022-07-16 thomas int proc_instance = 0;
126 8a35f56c 2022-07-16 thomas const char *errp, *title = NULL;
127 8a35f56c 2022-07-16 thomas int argc0 = argc;
128 8a35f56c 2022-07-16 thomas
129 8a35f56c 2022-07-16 thomas env = calloc(1, sizeof(*env));
130 8a35f56c 2022-07-16 thomas if (env == NULL)
131 8a35f56c 2022-07-16 thomas fatal("%s: calloc", __func__);
132 8a35f56c 2022-07-16 thomas
133 8a35f56c 2022-07-16 thomas /* XXX: add s and S for both sockets */
134 f7065961 2022-10-27 thomas while ((ch = getopt(argc, argv, "D:df:I:nP:v")) != -1) {
135 8a35f56c 2022-07-16 thomas switch (ch) {
136 8a35f56c 2022-07-16 thomas case 'D':
137 8a35f56c 2022-07-16 thomas if (cmdline_symset(optarg) < 0)
138 8a35f56c 2022-07-16 thomas log_warnx("could not parse macro definition %s",
139 8a35f56c 2022-07-16 thomas optarg);
140 8a35f56c 2022-07-16 thomas break;
141 8a35f56c 2022-07-16 thomas case 'd':
142 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 2;
143 8a35f56c 2022-07-16 thomas break;
144 8a35f56c 2022-07-16 thomas case 'f':
145 8a35f56c 2022-07-16 thomas conffile = optarg;
146 8a35f56c 2022-07-16 thomas break;
147 f7065961 2022-10-27 thomas case 'I':
148 f7065961 2022-10-27 thomas proc_instance = strtonum(optarg, 0,
149 f7065961 2022-10-27 thomas PROC_MAX_INSTANCES, &errp);
150 f7065961 2022-10-27 thomas if (errp)
151 f7065961 2022-10-27 thomas fatalx("invalid process instance");
152 8a35f56c 2022-07-16 thomas break;
153 8a35f56c 2022-07-16 thomas case 'n':
154 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 2;
155 8a35f56c 2022-07-16 thomas env->gotwebd_noaction = 1;
156 8a35f56c 2022-07-16 thomas break;
157 8a35f56c 2022-07-16 thomas case 'P':
158 8a35f56c 2022-07-16 thomas title = optarg;
159 8a35f56c 2022-07-16 thomas proc_id = proc_getid(procs, nitems(procs), title);
160 8a35f56c 2022-07-16 thomas if (proc_id == PROC_MAX)
161 8a35f56c 2022-07-16 thomas fatalx("invalid process name");
162 8a35f56c 2022-07-16 thomas break;
163 f7065961 2022-10-27 thomas case 'v':
164 f7065961 2022-10-27 thomas env->gotwebd_verbose++;
165 8a35f56c 2022-07-16 thomas break;
166 8a35f56c 2022-07-16 thomas default:
167 8a35f56c 2022-07-16 thomas usage();
168 8a35f56c 2022-07-16 thomas }
169 8a35f56c 2022-07-16 thomas }
170 8a35f56c 2022-07-16 thomas
171 8a35f56c 2022-07-16 thomas /* log to stderr until daemonized */
172 8a35f56c 2022-07-16 thomas log_init(env->gotwebd_debug ? env->gotwebd_debug : 1, LOG_DAEMON);
173 8a35f56c 2022-07-16 thomas
174 8a35f56c 2022-07-16 thomas argc -= optind;
175 8a35f56c 2022-07-16 thomas if (argc > 0)
176 8a35f56c 2022-07-16 thomas usage();
177 8a35f56c 2022-07-16 thomas
178 8a35f56c 2022-07-16 thomas ps = calloc(1, sizeof(*ps));
179 8a35f56c 2022-07-16 thomas if (ps == NULL)
180 8a35f56c 2022-07-16 thomas fatal("%s: calloc:", __func__);
181 8a35f56c 2022-07-16 thomas
182 8a35f56c 2022-07-16 thomas gotwebd_env = env;
183 8a35f56c 2022-07-16 thomas env->gotwebd_ps = ps;
184 8a35f56c 2022-07-16 thomas ps->ps_env = env;
185 8a35f56c 2022-07-16 thomas env->gotwebd_conffile = conffile;
186 8a35f56c 2022-07-16 thomas
187 8a35f56c 2022-07-16 thomas if (parse_config(env->gotwebd_conffile, env) == -1)
188 8a35f56c 2022-07-16 thomas exit(1);
189 8a35f56c 2022-07-16 thomas
190 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction && !env->gotwebd_debug)
191 8a35f56c 2022-07-16 thomas env->gotwebd_debug = 1;
192 8a35f56c 2022-07-16 thomas
193 8a35f56c 2022-07-16 thomas /* check for root privileges */
194 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction == 0) {
195 8a35f56c 2022-07-16 thomas if (geteuid())
196 8a35f56c 2022-07-16 thomas fatalx("need root privileges");
197 8a35f56c 2022-07-16 thomas }
198 8a35f56c 2022-07-16 thomas
199 8a35f56c 2022-07-16 thomas ps->ps_pw = getpwnam(GOTWEBD_USER);
200 8a35f56c 2022-07-16 thomas if (ps->ps_pw == NULL)
201 8a35f56c 2022-07-16 thomas fatalx("unknown user %s", GOTWEBD_USER);
202 8a35f56c 2022-07-16 thomas
203 8a35f56c 2022-07-16 thomas log_init(env->gotwebd_debug, LOG_DAEMON);
204 8a35f56c 2022-07-16 thomas log_setverbose(env->gotwebd_verbose);
205 8a35f56c 2022-07-16 thomas
206 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction)
207 8a35f56c 2022-07-16 thomas ps->ps_noaction = 1;
208 8a35f56c 2022-07-16 thomas
209 8a35f56c 2022-07-16 thomas ps->ps_instances[PROC_SOCKS] = env->prefork_gotwebd;
210 8a35f56c 2022-07-16 thomas ps->ps_instance = proc_instance;
211 8a35f56c 2022-07-16 thomas if (title != NULL)
212 8a35f56c 2022-07-16 thomas ps->ps_title[proc_id] = title;
213 8a35f56c 2022-07-16 thomas
214 8a35f56c 2022-07-16 thomas for (proc = 0; proc < nitems(procs); proc++)
215 0b16f49b 2023-06-22 thomas procs[proc].p_chroot = env->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 0b16f49b 2023-06-22 thomas if (unveil(env->httpd_chroot, "rwc") == -1)
253 8a35f56c 2022-07-16 thomas err(1, "unveil");
254 8a35f56c 2022-07-16 thomas
255 8a35f56c 2022-07-16 thomas if (unveil(GOT_TMPDIR_STR, "rw") == -1)
256 8a35f56c 2022-07-16 thomas err(1, "unveil");
257 8a35f56c 2022-07-16 thomas
258 8a35f56c 2022-07-16 thomas if (unveil(GOTWEBD_CONF, "r") == -1)
259 8a35f56c 2022-07-16 thomas err(1, "unveil");
260 8a35f56c 2022-07-16 thomas
261 8a35f56c 2022-07-16 thomas if (unveil(NULL, NULL) != 0)
262 8a35f56c 2022-07-16 thomas err(1, "unveil");
263 8a35f56c 2022-07-16 thomas
264 8a35f56c 2022-07-16 thomas #ifndef PROFILE
265 8a35f56c 2022-07-16 thomas if (pledge("stdio rpath wpath cpath inet unix", NULL) == -1)
266 8a35f56c 2022-07-16 thomas err(1, "pledge");
267 8a35f56c 2022-07-16 thomas #endif
268 8a35f56c 2022-07-16 thomas
269 8a35f56c 2022-07-16 thomas event_dispatch();
270 8a35f56c 2022-07-16 thomas
271 8a35f56c 2022-07-16 thomas log_debug("%s gotwebd exiting", getprogname());
272 8a35f56c 2022-07-16 thomas
273 8a35f56c 2022-07-16 thomas return (0);
274 8a35f56c 2022-07-16 thomas }
275 8a35f56c 2022-07-16 thomas
276 8a35f56c 2022-07-16 thomas int
277 8a35f56c 2022-07-16 thomas gotwebd_configure(struct gotwebd *env)
278 8a35f56c 2022-07-16 thomas {
279 8a35f56c 2022-07-16 thomas struct server *srv;
280 8a35f56c 2022-07-16 thomas struct socket *sock;
281 8a35f56c 2022-07-16 thomas int id;
282 8a35f56c 2022-07-16 thomas
283 8a35f56c 2022-07-16 thomas if (env->gotwebd_noaction) {
284 8a35f56c 2022-07-16 thomas fprintf(stderr, "configuration OK\n");
285 8a35f56c 2022-07-16 thomas proc_kill(env->gotwebd_ps);
286 8a35f56c 2022-07-16 thomas exit(0);
287 8a35f56c 2022-07-16 thomas }
288 8a35f56c 2022-07-16 thomas
289 8a35f56c 2022-07-16 thomas /* gotweb need to reload its config. */
290 8a35f56c 2022-07-16 thomas env->gotwebd_reload = env->prefork_gotwebd;
291 8a35f56c 2022-07-16 thomas
292 8a35f56c 2022-07-16 thomas /* send our gotweb servers */
293 90d63d47 2022-08-16 thomas TAILQ_FOREACH(srv, &env->servers, entry) {
294 8a35f56c 2022-07-16 thomas if (config_setserver(env, srv) == -1)
295 8a35f56c 2022-07-16 thomas fatalx("%s: send server error", __func__);
296 8a35f56c 2022-07-16 thomas }
297 8a35f56c 2022-07-16 thomas
298 8a35f56c 2022-07-16 thomas /* send our sockets */
299 90d63d47 2022-08-16 thomas TAILQ_FOREACH(sock, &env->sockets, entry) {
300 8a35f56c 2022-07-16 thomas if (config_setsock(env, sock) == -1)
301 8a35f56c 2022-07-16 thomas fatalx("%s: send socket error", __func__);
302 8a35f56c 2022-07-16 thomas if (config_setfd(env, sock) == -1)
303 8a35f56c 2022-07-16 thomas fatalx("%s: send priv_fd error", __func__);
304 8a35f56c 2022-07-16 thomas }
305 8a35f56c 2022-07-16 thomas
306 8a35f56c 2022-07-16 thomas for (id = 0; id < PROC_MAX; id++) {
307 8a35f56c 2022-07-16 thomas if (id == privsep_process)
308 8a35f56c 2022-07-16 thomas continue;
309 8a35f56c 2022-07-16 thomas proc_compose(env->gotwebd_ps, id, IMSG_CFG_DONE, NULL, 0);
310 8a35f56c 2022-07-16 thomas }
311 8a35f56c 2022-07-16 thomas
312 8a35f56c 2022-07-16 thomas return (0);
313 8a35f56c 2022-07-16 thomas }
314 8a35f56c 2022-07-16 thomas
315 8a35f56c 2022-07-16 thomas void
316 8a35f56c 2022-07-16 thomas gotwebd_configure_done(struct gotwebd *env)
317 8a35f56c 2022-07-16 thomas {
318 8a35f56c 2022-07-16 thomas int id;
319 8a35f56c 2022-07-16 thomas
320 8a35f56c 2022-07-16 thomas if (env->gotwebd_reload == 0) {
321 8a35f56c 2022-07-16 thomas log_warnx("%s: configuration already finished", __func__);
322 8a35f56c 2022-07-16 thomas return;
323 8a35f56c 2022-07-16 thomas }
324 8a35f56c 2022-07-16 thomas
325 8a35f56c 2022-07-16 thomas env->gotwebd_reload--;
326 8a35f56c 2022-07-16 thomas if (env->gotwebd_reload == 0) {
327 8a35f56c 2022-07-16 thomas for (id = 0; id < PROC_MAX; id++) {
328 8a35f56c 2022-07-16 thomas if (id == privsep_process)
329 8a35f56c 2022-07-16 thomas continue;
330 8a35f56c 2022-07-16 thomas proc_compose(env->gotwebd_ps, id, IMSG_CTL_START,
331 8a35f56c 2022-07-16 thomas NULL, 0);
332 8a35f56c 2022-07-16 thomas }
333 8a35f56c 2022-07-16 thomas }
334 8a35f56c 2022-07-16 thomas }
335 8a35f56c 2022-07-16 thomas
336 8a35f56c 2022-07-16 thomas void
337 8a35f56c 2022-07-16 thomas gotwebd_shutdown(void)
338 8a35f56c 2022-07-16 thomas {
339 8a35f56c 2022-07-16 thomas proc_kill(gotwebd_env->gotwebd_ps);
340 8a35f56c 2022-07-16 thomas
341 8a35f56c 2022-07-16 thomas /* unlink(gotwebd_env->gotweb->gotweb_conf.gotweb_unix_socket_name); */
342 8a35f56c 2022-07-16 thomas /* free(gotwebd_env->gotweb); */
343 8a35f56c 2022-07-16 thomas free(gotwebd_env);
344 8a35f56c 2022-07-16 thomas
345 8a35f56c 2022-07-16 thomas log_warnx("gotwebd terminating");
346 8a35f56c 2022-07-16 thomas exit(0);
347 8a35f56c 2022-07-16 thomas }