sync with OpenBSD -current
This commit is contained in:
parent
ee68147dcd
commit
1cefe29c7e
1651 changed files with 283292 additions and 68089 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: config.c,v 1.63 2022/12/28 21:30:16 jmc Exp $ */
|
||||
/* $OpenBSD: config.c,v 1.65 2024/01/17 08:22:40 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 - 2015 Reyk Floeter <reyk@openbsd.org>
|
||||
|
@ -626,6 +626,7 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
struct server_config srv_conf;
|
||||
uint8_t *p = imsg->data;
|
||||
size_t s;
|
||||
int fd;
|
||||
|
||||
IMSG_SIZE_CHECK(imsg, &srv_conf);
|
||||
memcpy(&srv_conf, p, sizeof(srv_conf));
|
||||
|
@ -634,6 +635,8 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
/* Reset these variables to avoid free'ing invalid pointers */
|
||||
serverconfig_reset(&srv_conf);
|
||||
|
||||
fd = imsg_get_fd(imsg);
|
||||
|
||||
if ((IMSG_DATA_SIZE(imsg) - s) < (size_t)srv_conf.return_uri_len) {
|
||||
log_debug("%s: invalid message length", __func__);
|
||||
goto fail;
|
||||
|
@ -643,11 +646,11 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
if ((srv = server_byaddr((struct sockaddr *)
|
||||
&srv_conf.ss, srv_conf.port)) != NULL) {
|
||||
/* Add "host" to existing listening server */
|
||||
if (imsg->fd != -1) {
|
||||
if (fd != -1) {
|
||||
if (srv->srv_s == -1)
|
||||
srv->srv_s = imsg->fd;
|
||||
srv->srv_s = fd;
|
||||
else
|
||||
close(imsg->fd);
|
||||
close(fd);
|
||||
}
|
||||
return (config_getserver_config(env, srv, imsg));
|
||||
}
|
||||
|
@ -660,7 +663,7 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
goto fail;
|
||||
|
||||
memcpy(&srv->srv_conf, &srv_conf, sizeof(srv->srv_conf));
|
||||
srv->srv_s = imsg->fd;
|
||||
srv->srv_s = fd;
|
||||
|
||||
if (config_getserver_auth(env, &srv->srv_conf) != 0)
|
||||
goto fail;
|
||||
|
@ -668,14 +671,6 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
SPLAY_INIT(&srv->srv_clients);
|
||||
TAILQ_INIT(&srv->srv_hosts);
|
||||
|
||||
TAILQ_INSERT_TAIL(&srv->srv_hosts, &srv->srv_conf, entry);
|
||||
TAILQ_INSERT_TAIL(env->sc_servers, srv, srv_entry);
|
||||
|
||||
DPRINTF("%s: %s %d configuration \"%s[%u]\", flags: %s", __func__,
|
||||
ps->ps_title[privsep_process], ps->ps_instance,
|
||||
srv->srv_conf.name, srv->srv_conf.id,
|
||||
printb_flags(srv->srv_conf.flags, SRVFLAG_BITS));
|
||||
|
||||
/*
|
||||
* Get all variable-length values for the parent server.
|
||||
*/
|
||||
|
@ -685,11 +680,19 @@ config_getserver(struct httpd *env, struct imsg *imsg)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&srv->srv_hosts, &srv->srv_conf, entry);
|
||||
TAILQ_INSERT_TAIL(env->sc_servers, srv, srv_entry);
|
||||
|
||||
DPRINTF("%s: %s %d configuration \"%s[%u]\", flags: %s", __func__,
|
||||
ps->ps_title[privsep_process], ps->ps_instance,
|
||||
srv->srv_conf.name, srv->srv_conf.id,
|
||||
printb_flags(srv->srv_conf.flags, SRVFLAG_BITS));
|
||||
|
||||
return (0);
|
||||
|
||||
fail:
|
||||
if (imsg->fd != -1)
|
||||
close(imsg->fd);
|
||||
if (fd != -1)
|
||||
close(fd);
|
||||
if (srv != NULL)
|
||||
serverconfig_free(&srv->srv_conf);
|
||||
free(srv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: logger.c,v 1.24 2021/01/27 07:21:53 deraadt Exp $ */
|
||||
/* $OpenBSD: logger.c,v 1.25 2024/01/17 08:22:40 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
|
||||
|
@ -144,9 +144,9 @@ logger_open_fd(struct imsg *imsg)
|
|||
|
||||
TAILQ_FOREACH(log, &log_files, log_entry) {
|
||||
if (log->log_id == id) {
|
||||
log->log_fd = imsg_get_fd(imsg);
|
||||
DPRINTF("%s: received log fd %d, file %s",
|
||||
__func__, imsg->fd, log->log_name);
|
||||
log->log_fd = imsg->fd;
|
||||
__func__, log->log_fd, log->log_name);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: proc.c,v 1.42 2023/02/15 20:44:01 tobhe Exp $ */
|
||||
/* $OpenBSD: proc.c,v 1.43 2024/01/17 08:22:40 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
|
||||
|
@ -668,7 +668,7 @@ proc_dispatch(int fd, short event, void *arg)
|
|||
case IMSG_CTL_PROCFD:
|
||||
IMSG_SIZE_CHECK(&imsg, &pf);
|
||||
memcpy(&pf, imsg.data, sizeof(pf));
|
||||
proc_accept(ps, imsg.fd, pf.pf_procid,
|
||||
proc_accept(ps, imsg_get_fd(&imsg), pf.pf_procid,
|
||||
pf.pf_instance);
|
||||
break;
|
||||
default:
|
||||
|
@ -799,7 +799,7 @@ proc_forward_imsg(struct privsep *ps, struct imsg *imsg,
|
|||
enum privsep_procid id, int n)
|
||||
{
|
||||
return (proc_compose_imsg(ps, id, n, imsg->hdr.type,
|
||||
imsg->hdr.peerid, imsg->fd, imsg->data, IMSG_DATA_SIZE(imsg)));
|
||||
imsg->hdr.peerid, -1, imsg->data, IMSG_DATA_SIZE(imsg)));
|
||||
}
|
||||
|
||||
struct imsgbuf *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue