]> git.ipfire.org Git - thirdparty/nqptp.git/commit
Hoist PTP socket handling, drop privileges on OpenBSD
authorKlemens Nanni <kn@openbsd.org>
Sat, 27 Jan 2024 04:36:29 +0000 (05:36 +0100)
committerKlemens Nanni <klemens@posteo.de>
Sat, 27 Jan 2024 07:44:37 +0000 (08:44 +0100)
commit4586bb084a98e3b9f18d101fb91c72112a527323
tree9e5637d36d93ffb50b0cd2e5df8900bce3beff2e
parent3487ba6a67f4a147effa03ea05ba8712f5a7ec86
Hoist PTP socket handling, drop privileges on OpenBSD

bind(2)ing ports below 1024 is the only privileged operation NQPTP does.

Move its code up in main() before shared memory handling such that root
privileges can be dropped immediately after it;  no currently supported
system does that, thus this should be a NOOP.

Do so on OpenBSD where shm_open(3) does not allow access to shared memory
objects by multiple UIDs, i.e. to communicate, shairport-sync and NQPTP
must create them and run as the very same user.

OpenBSD's official audio/shairport-sync user provides an rc.d(8) daemon
script that runs as `_shairport` user.
Makefile.am
nqptp-utilities.c
nqptp.c