1
0
mirror of https://github.com/openbsd/src.git synced 2026-05-01 17:46:35 +00:00

Ensure that syslogd(8) runs TLS handshake callback.

It could happen that the logging client triggered the TLS read
callback before the TLS handshake was recognized by syslogd.  Then
using the hostname from the client certificate did not work.  If
TLS is used after accept, register the handshake callback for both
read and write.  After the handshake has finished, switch to read
callback.  Run it once to process all messaged that might have been
received.

reported, tested and OK henning@
This commit is contained in:
bluhm
2025-06-26 19:10:13 +00:00
parent 5a255a8d60
commit 5392107232

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: syslogd.c,v 1.286 2025/06/25 09:43:23 bluhm Exp $ */
/* $OpenBSD: syslogd.c,v 1.287 2025/06/26 19:10:13 bluhm Exp $ */
/*
* Copyright (c) 2014-2021 Alexander Bluhm <bluhm@genua.de>
@@ -1176,7 +1176,8 @@ acceptcb(int lfd, short event, void *arg, int usetls)
p->p_fd = fd;
p->p_ctx = NULL;
p->p_peername = NULL;
if ((p->p_bufev = bufferevent_new(fd, tcp_readcb,
if ((p->p_bufev = bufferevent_new(fd,
usetls ? tls_handshakecb : tcp_readcb,
usetls ? tls_handshakecb : NULL, tcp_closecb, p)) == NULL) {
log_warn("bufferevent \"%s\"", peername);
free(p);
@@ -1243,6 +1244,7 @@ tls_handshakecb(struct bufferevent *bufev, void *arg)
}
bufferevent_setcb(bufev, tcp_readcb, NULL, tcp_closecb, p);
tcp_readcb(bufev, arg);
}
/*