diff --git a/devel/dbus/Makefile b/devel/dbus/Makefile index f0f6c5f3b449..a72b5b366431 100644 --- a/devel/dbus/Makefile +++ b/devel/dbus/Makefile @@ -1,71 +1,71 @@ PORTNAME= dbus DISTVERSION= 1.14.10 -PORTREVISION= 4 +PORTREVISION= 5 PORTEPOCH= 1 CATEGORIES= devel gnome MASTER_SITES= https://dbus.freedesktop.org/releases/dbus/ MAINTAINER= desktop@FreeBSD.org COMMENT= Message bus system for inter-application communication WWW= https://www.freedesktop.org/Software/dbus LICENSE= GPLv2 LIB_DEPENDS= libexpat.so:textproc/expat2 USES= cpe gmake libtool localbase pkgconfig python:build shebangfix tar:xz CPE_VENDOR= d-bus_project CPE_PRODUCT= d-bus USE_LDCONFIG= yes USE_RC_SUBR= dbus SHEBANG_FILES= tools/GetAllMatchRules.py GNU_CONFIGURE= yes GNU_CONFIGURE_MANPREFIX=${PREFIX}/share CONFIGURE_ARGS= --disable-apparmor \ --disable-doxygen-docs \ --disable-selinux \ --disable-systemd \ --with-session-socket-dir=/tmp \ --with-test-socket-dir=${WRKDIR} CONFIGURE_ENV= have_ld_version_script=yes INSTALL_TARGET= install-strip PORTSCOUT= limitw:1,even USERS= messagebus GROUPS= messagebus _LIBVERSION= 3.32.4 PLIST_SUB= GROUPS=${GROUPS} \ VERSION="1.0" \ LIBVERSION=${_LIBVERSION} OPTIONS_DEFINE= EXAMPLES MANPAGES X11 OPTIONS_DEFAULT= MANPAGES X11 OPTIONS_SUB= yes X11_DESC= Support X11 Desktop Environments MANPAGES_BUILD_DEPENDS= minixmlto:textproc/minixmlto MANPAGES_CONFIGURE_ENV= XMLTO=${LOCALBASE}/bin/minixmlto MANPAGES_CONFIGURE_ENABLE= xml-docs X11_USES= xorg X11_USE= XORG=ice,sm,x11 X11_CONFIGURE_WITH= x post-patch: @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${WRKSRC}/dbus/dbus-sysdeps-util-unix.c post-install: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${MV} ${STAGEDIR}${DOCSDIR}/examples/* ${STAGEDIR}${EXAMPLESDIR} ${RM} -r ${STAGEDIR}${DOCSDIR} .for file in session.conf system.conf @cd ${STAGEDIR}${ETCDIR}-1/ && \ ${MV} ${file} ${file}.sample .endfor .include diff --git a/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c b/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c index 9a1e8badbaa7..d8671714af28 100644 --- a/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c +++ b/devel/dbus/files/patch-dbus_dbus-sysdeps-unix.c @@ -1,89 +1,122 @@ --- dbus/dbus-sysdeps-unix.c.orig 2023-08-16 10:29:50 UTC +++ dbus/dbus-sysdeps-unix.c @@ -37,6 +37,7 @@ #include "dbus-credentials.h" #include "dbus-nonce.h" +#include #include #include #include -@@ -62,6 +63,9 @@ +@@ -59,9 +60,16 @@ + #include + #include + ++#ifdef __FreeBSD__ ++#include ++#endif ++ #ifdef HAVE_ERRNO_H #include #endif +#ifdef HAVE_LINUX_CLOSE_RANGE_H +#include +#endif #ifdef HAVE_SYSLOG_H #include #endif -@@ -80,6 +84,9 @@ +@@ -80,6 +88,9 @@ #ifdef HAVE_SYS_RANDOM_H #include #endif +#ifdef HAVE_SYS_SYSCALL_H +#include +#endif #ifdef HAVE_ADT #include -@@ -137,6 +144,21 @@ +@@ -137,6 +148,21 @@ #endif /* Solaris */ +#if defined(__linux__) && defined(__NR_close_range) && !defined(HAVE_CLOSE_RANGE) +/* The kernel headers are new enough to have the close_range syscall, + * but glibc isn't new enough to have the syscall wrapper, so call the + * syscall directly. */ +static inline int +close_range (unsigned int first, + unsigned int last, + unsigned int flags) +{ + return syscall (__NR_close_range, first, last, flags); +} +/* Now we can call that inline wrapper as though it was provided by glibc. */ +#define HAVE_CLOSE_RANGE +#endif + /** * Ensure that the standard file descriptors stdin, stdout and stderr * are open, by opening /dev/null if necessary. -@@ -4791,7 +4813,24 @@ _dbus_close_all (void) +@@ -2325,6 +2351,25 @@ _dbus_read_credentials_socket (DBusSocket clien + pid_read = cr.unp_pid; + uid_read = cr.unp_euid; + } ++#elif defined(LOCAL_PEERCRED) ++ struct xucred cr; ++ socklen_t cr_len = sizeof (cr); ++ ++ if (getsockopt (client_fd.fd, 0, LOCAL_PEERCRED, &cr, &cr_len) != 0) ++ { ++ _dbus_verbose ("Failed to getsockopt(LOCAL_PEERCRED): %s\n", ++ _dbus_strerror (errno)); ++ } ++ else if (cr_len != sizeof (cr)) ++ { ++ _dbus_verbose ("Failed to getsockopt(LOCAL_PEERCRED), returned %d bytes, expected %d\n", ++ cr_len, (int) sizeof (cr)); ++ } ++ else ++ { ++ pid_read = cr.cr_pid; ++ uid_read = cr.cr_uid; ++ } + #elif defined(HAVE_CMSGCRED) + /* We only check for HAVE_CMSGCRED, but we're really assuming that the + * presence of that struct implies SCM_CREDS. Supported by at least +@@ -4791,7 +4836,24 @@ _dbus_close_all (void) void _dbus_close_all (void) { +#ifdef HAVE_CLOSE_RANGE + if (close_range (3, INT_MAX, 0) == 0) + return; +#endif + + /* Some library implementations of closefrom() are not async-signal-safe, + * and we call _dbus_close_all() after forking, so we only do this on + * operating systems where we know that closefrom() is a system call */ +#if defined(HAVE_CLOSEFROM) && ( \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__sun__) && defined(F_CLOSEFROM) \ +) + closefrom (3); +#else act_on_fds_3_and_up (close_ignore_error); +#endif } /** -@@ -4801,6 +4840,11 @@ _dbus_fd_set_all_close_on_exec (void) +@@ -4801,6 +4863,11 @@ _dbus_fd_set_all_close_on_exec (void) void _dbus_fd_set_all_close_on_exec (void) { +#if defined(HAVE_CLOSE_RANGE) && defined(CLOSE_RANGE_CLOEXEC) + if (close_range (3, INT_MAX, CLOSE_RANGE_CLOEXEC) == 0) + return; +#endif + act_on_fds_3_and_up (_dbus_fd_set_close_on_exec); }