-/* $OpenBSD: config.c,v 1.94 2024/01/15 15:29:00 tobhe Exp $ */
+/* $OpenBSD: config.c,v 1.95 2024/01/17 08:25:02 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
{
struct iked_socket *sock, **sock0 = NULL, **sock1 = NULL;
- log_debug("%s: received socket fd %d", __func__, imsg->fd);
-
if ((sock = calloc(1, sizeof(*sock))) == NULL)
fatal("config_getsocket: calloc");
IMSG_SIZE_CHECK(imsg, &sock->sock_addr);
memcpy(&sock->sock_addr, imsg->data, sizeof(sock->sock_addr));
- sock->sock_fd = imsg->fd;
+ sock->sock_fd = imsg_get_fd(imsg);
sock->sock_env = env;
+ log_debug("%s: received socket fd %d", __func__, sock->sock_fd);
+
switch (sock->sock_addr.ss_family) {
case AF_INET:
sock0 = &env->sc_sock4[0];
int
config_getpfkey(struct iked *env, struct imsg *imsg)
{
- log_debug("%s: received pfkey fd %d", __func__, imsg->fd);
- pfkey_init(env, imsg->fd);
+ int fd = imsg_get_fd(imsg);
+
+ log_debug("%s: received pfkey fd %d", __func__, fd);
+ pfkey_init(env, fd);
return (0);
}
-/* $OpenBSD: ocsp.c,v 1.24 2022/12/03 22:34:35 tobhe Exp $ */
+/* $OpenBSD: ocsp.c,v 1.25 2024/01/17 08:25:02 claudio Exp $ */
/*
* Copyright (c) 2014 Markus Friedl
uint8_t *ptr;
char *path = NULL;
size_t len;
- int ret = -1;
-
- log_debug("%s: received socket fd %d", __func__, imsg->fd);
+ int fd, ret = -1;
IMSG_SIZE_CHECK(imsg, &sh);
}
if (ioe == NULL) {
log_debug("%s: no pending request found", __func__);
- if (imsg->fd != -1)
- close(imsg->fd);
+ if ((fd = imsg_get_fd(imsg)) != -1) /* XXX */
+ close(fd);
return (-1);
}
TAILQ_REMOVE(&env->sc_ocsp, ioe, ioe_entry);
ocsp = ioe->ioe_ocsp;
free(ioe);
- if (imsg->fd == -1)
+ if ((fd = imsg_get_fd(imsg)) == -1)
goto done;
if ((sock = calloc(1, sizeof(*sock))) == NULL)
fatal("ocsp_receive_fd: calloc sock");
/* note that sock_addr is not set */
- sock->sock_fd = imsg->fd;
+ sock->sock_fd = fd;
sock->sock_env = env;
ocsp->ocsp_sock = sock;
+ log_debug("%s: received socket fd %d", __func__, sock->sock_fd);
+
/* fetch 'path' and 'fd' from imsg */
if ((path = get_string(ptr, len)) == NULL)
goto done;
- BIO_set_fd(ocsp->ocsp_cbio, imsg->fd, BIO_NOCLOSE);
+ BIO_set_fd(ocsp->ocsp_cbio, sock->sock_fd, BIO_NOCLOSE);
if ((ocsp->ocsp_req_ctx = OCSP_sendreq_new(ocsp->ocsp_cbio,
path, NULL, -1)) == NULL)
-/* $OpenBSD: proc.c,v 1.39 2023/06/28 12:31:19 gerhard Exp $ */
+/* $OpenBSD: proc.c,v 1.40 2024/01/17 08:25:02 claudio Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
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:
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 *