Upstream commit https://gitlab.com/samba-team/devel/samba/-/commit/6e263432 fixes compilation on BSD/macOS.