diff options
author | Stephen Klimaszewski <steev@gentoo.org> | 2010-02-03 16:07:35 +0000 |
---|---|---|
committer | Stephen Klimaszewski <steev@gentoo.org> | 2010-02-03 16:07:35 +0000 |
commit | 5e454582d499a526b92a8146faa66ff37e600038 (patch) | |
tree | 1bfe7f096d515f34eccc517dc67bec43bd2452fd /sys-apps | |
parent | add eautoreconf (diff) | |
download | gentoo-2-5e454582d499a526b92a8146faa66ff37e600038.tar.gz gentoo-2-5e454582d499a526b92a8146faa66ff37e600038.tar.bz2 gentoo-2-5e454582d499a526b92a8146faa66ff37e600038.zip |
Bump dbus, add 2 patches from upstream, one to fix a compilation issue
with selinux disabled, the other to move the shutdown handler into
inotify.
(Portage version: 2.1.7.17/cvs/Linux i686)
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/dbus/ChangeLog | 13 | ||||
-rw-r--r-- | sys-apps/dbus/dbus-1.2.18.ebuild | 137 | ||||
-rw-r--r-- | sys-apps/dbus/files/0001-Fix-inotify-shutdown.patch | 195 | ||||
-rw-r--r-- | sys-apps/dbus/files/0002-Fix-compilation-in-disable-selinux-case.patch | 182 |
4 files changed, 525 insertions, 2 deletions
diff --git a/sys-apps/dbus/ChangeLog b/sys-apps/dbus/ChangeLog index ea53bad2b4dd..a69870b051ca 100644 --- a/sys-apps/dbus/ChangeLog +++ b/sys-apps/dbus/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-apps/dbus -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/ChangeLog,v 1.242 2009/11/23 21:27:56 eva Exp $ +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/ChangeLog,v 1.243 2010/02/03 16:07:35 steev Exp $ + +*dbus-1.2.18 (03 Feb 2010) + + 03 Feb 2010; <steev@gentoo.org> +files/0001-Fix-inotify-shutdown.patch, + +dbus-1.2.18.ebuild, + +files/0002-Fix-compilation-in-disable-selinux-case.patch: + Bump dbus, add 2 patches from upstream, one to fix a compilation issue + with selinux disabled, the other to move the shutdown handler into + inotify. 23 Nov 2009; Gilles Dartiguelongue <eva@gentoo.org> dbus-1.3.0-r1.ebuild: Add missing docbook-xml-dtd:4.1.2 dependency, bug #293867. diff --git a/sys-apps/dbus/dbus-1.2.18.ebuild b/sys-apps/dbus/dbus-1.2.18.ebuild new file mode 100644 index 000000000000..4057f98089c2 --- /dev/null +++ b/sys-apps/dbus/dbus-1.2.18.ebuild @@ -0,0 +1,137 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/dbus/dbus-1.2.18.ebuild,v 1.1 2010/02/03 16:07:35 steev Exp $ + +inherit eutils multilib flag-o-matic + +DESCRIPTION="A message bus system, a simple way for applications to talk to each other" +HOMEPAGE="http://dbus.freedesktop.org/" +SRC_URI="http://dbus.freedesktop.org/releases/dbus/${P}.tar.gz" + +LICENSE="|| ( GPL-2 AFL-2.1 )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="debug doc selinux test X" + +RDEPEND="X? ( x11-libs/libXt x11-libs/libX11 ) + selinux? ( sys-libs/libselinux + sec-policy/selinux-dbus ) + >=dev-libs/expat-1.95.8 + !<sys-apps/dbus-0.91" +DEPEND="${RDEPEND} + dev-util/pkgconfig + doc? ( app-doc/doxygen + app-text/xmlto )" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}/0001-Fix-inotify-shutdown.patch" + epatch "${FILESDIR}/0002-Fix-compilation-in-disable-selinux-case.patch" + + # Tests were restricted because of this + sed -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \ + -e '/"dispatch"/d' -i "${S}/bus/test-main.c" +} + +src_compile() { + # so we can get backtraces from apps + append-flags -rdynamic + + # libaudit is *only* used in DBus wrt SELinux support, so disable it, if + # not on an SELinux profile. + econf \ + $(use_with X x) \ + $(use_enable kernel_linux inotify) \ + $(use_enable kernel_FreeBSD kqueue) \ + $(use_enable selinux) \ + $(use_enable selinux libaudit) \ + $(use_enable debug verbose-mode) \ + $(use_enable debug asserts) \ + $(use_enable test tests) \ + $(use_enable test asserts) \ + --with-xml=expat \ + --with-system-pid-file=/var/run/dbus.pid \ + --with-system-socket=/var/run/dbus/system_bus_socket \ + --with-session-socket-dir=/tmp \ + --with-dbus-user=messagebus \ + --localstatedir=/var \ + $(use_enable doc doxygen-docs) \ + --disable-xml-docs \ + || die "econf failed" + + # after the compile, it uses a selinuxfs interface to + # check if the SELinux policy has the right support + use selinux && addwrite /selinux/access + + emake || die "make failed" +} + +src_test() { + DBUS_VERBOSE=1 make check || die "make check failed" +} + +src_install() { + emake DESTDIR="${D}" install || die "make install failed" + + # initscript + newinitd "${FILESDIR}"/dbus.init-1.0 dbus + + if use X ; then + # dbus X session script (#77504) + # turns out to only work for GDM. has been merged into other desktop + # (kdm and such scripts) + exeinto /etc/X11/xinit/xinitrc.d/ + doexe "${FILESDIR}"/30-dbus + fi + + # needs to exist for the system socket + keepdir /var/run/dbus + # needs to exist for machine id + keepdir /var/lib/dbus + # needs to exist for dbus sessions to launch + + keepdir /usr/lib/dbus-1.0/services + keepdir /usr/share/dbus-1/services + keepdir /etc/dbus-1/system.d/ + keepdir /etc/dbus-1/session.d/ + + dodoc AUTHORS ChangeLog HACKING NEWS README doc/TODO + if use doc; then + dohtml doc/*html + fi +} + +pkg_preinst() { + enewgroup messagebus + enewuser messagebus -1 "-1" -1 messagebus +} + +pkg_postinst() { + elog "To start the D-Bus system-wide messagebus by default" + elog "you should add it to the default runlevel :" + elog "\`rc-update add dbus default\`" + elog + elog "Some applications require a session bus in addition to the system" + elog "bus. Please see \`man dbus-launch\` for more information." + elog + elog + ewarn "You MUST run 'revdep-rebuild' after emerging this package" + elog + ewarn "You must restart D-Bus \`/etc/init.d/dbus restart\` to run" + ewarn "the new version of the daemon." + + if has_version x11-base/xorg-server && built_with_use x11-base/xorg-server hal; then + elog + ewarn "You are currently running X with the hal useflag enabled" + ewarn "restarting the dbus service WILL restart X as well" + ebeep 5 + fi + + if use test; then + elog + ewarn "You have unit tests enabled, this results in an insecure library" + ewarn "It is recommended that you reinstall *without* FEATURES=test" + fi +} diff --git a/sys-apps/dbus/files/0001-Fix-inotify-shutdown.patch b/sys-apps/dbus/files/0001-Fix-inotify-shutdown.patch new file mode 100644 index 000000000000..862adb28a413 --- /dev/null +++ b/sys-apps/dbus/files/0001-Fix-inotify-shutdown.patch @@ -0,0 +1,195 @@ +From 90fe96b1875350f86a4a773d4a0a22009950dd4d Mon Sep 17 00:00:00 2001 +From: Colin Walters <walters@verbum.org> +Date: Tue, 2 Feb 2010 12:37:17 -0500 +Subject: [PATCH 1/2] Fix inotify shutdown + +We were incorrectly passing NULL for a DBusList when the usage expected +is a pointer to a NULL DBusList pointer. Also during dbus_shutdown +we need to actually close the inotify fd, and remove our watch. + +Move the shutdown handler out of bus.c and into inotify where we +can do all of this cleanly. +--- + bus/bus.c | 8 --- + bus/dir-watch-inotify.c | 128 ++++++++++++++++++++++++++++++----------------- + 2 files changed, 82 insertions(+), 54 deletions(-) + +diff --git a/bus/bus.c b/bus/bus.c +index bfd398e..8150df2 100644 +--- a/bus/bus.c ++++ b/bus/bus.c +@@ -551,12 +551,6 @@ process_config_postinit (BusContext *context, + return TRUE; + } + +-static void +-bus_shutdown_all_directory_watches (void *data) +-{ +- bus_set_watched_dirs ((BusContext *) data, NULL); +-} +- + BusContext* + bus_context_new (const DBusString *config_file, + ForceForkSetting force_fork, +@@ -588,8 +582,6 @@ bus_context_new (const DBusString *config_file, + + _dbus_generate_uuid (&context->uuid); + +- _dbus_register_shutdown_func (bus_shutdown_all_directory_watches, context); +- + if (!_dbus_string_copy_data (config_file, &context->config_file)) + { + BUS_SET_OOM (error); +diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c +index f87a634..bb71394 100644 +--- a/bus/dir-watch-inotify.c ++++ b/bus/dir-watch-inotify.c +@@ -92,59 +92,16 @@ _handle_inotify_watch (DBusWatch *passed_watch, unsigned int flags, void *data) + return TRUE; + } + +-static int +-_init_inotify (BusContext *context) +-{ +- int ret = 0; +- +- if (inotify_fd == -1) { +-#ifdef HAVE_INOTIFY_INIT1 +- inotify_fd = inotify_init1 (IN_CLOEXEC); +-#else +- inotify_fd = inotify_init (); +-#endif +- if (inotify_fd <= 0) { +- _dbus_warn ("Cannot initialize inotify\n"); +- goto out; +- } +- loop = bus_context_get_loop (context); +- +- watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE, +- _handle_inotify_watch, NULL, NULL); +- +- if (watch == NULL) +- { +- _dbus_warn ("Unable to create inotify watch\n"); +- goto out; +- } +- +- if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback, +- NULL, NULL)) +- { +- _dbus_warn ("Unable to add reload watch to main loop"); +- _dbus_watch_unref (watch); +- watch = NULL; +- goto out; +- } +- } ++#include <stdio.h> + +- ret = 1; +- +-out: +- return ret; +-} +- +-void +-bus_set_watched_dirs (BusContext *context, DBusList **directories) ++static void ++_set_watched_dirs_internal (DBusList **directories) + { + int new_wds[MAX_DIRS_TO_WATCH]; + char *new_dirs[MAX_DIRS_TO_WATCH]; + DBusList *link; + int i, j, wd; + +- if (!_init_inotify (context)) +- goto out; +- + for (i = 0; i < MAX_DIRS_TO_WATCH; i++) + { + new_wds[i] = -1; +@@ -226,3 +183,82 @@ bus_set_watched_dirs (BusContext *context, DBusList **directories) + + out:; + } ++ ++#include <stdio.h> ++static void ++_shutdown_inotify (void *data) ++{ ++ DBusList *empty = NULL; ++ ++ if (inotify_fd == -1) ++ return; ++ ++ _set_watched_dirs_internal (&empty); ++ ++ close (inotify_fd); ++ inotify_fd = -1; ++ if (watch != NULL) ++ { ++ _dbus_loop_remove_watch (loop, watch, _inotify_watch_callback, NULL); ++ _dbus_watch_unref (watch); ++ _dbus_loop_unref (loop); ++ } ++ watch = NULL; ++ loop = NULL; ++} ++ ++static int ++_init_inotify (BusContext *context) ++{ ++ int ret = 0; ++ ++ if (inotify_fd == -1) ++ { ++#ifdef HAVE_INOTIFY_INIT1 ++ inotify_fd = inotify_init1 (IN_CLOEXEC); ++#else ++ inotify_fd = inotify_init (); ++#endif ++ if (inotify_fd <= 0) ++ { ++ _dbus_warn ("Cannot initialize inotify\n"); ++ goto out; ++ } ++ loop = bus_context_get_loop (context); ++ _dbus_loop_ref (loop); ++ ++ watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE, ++ _handle_inotify_watch, NULL, NULL); ++ ++ if (watch == NULL) ++ { ++ _dbus_warn ("Unable to create inotify watch\n"); ++ goto out; ++ } ++ ++ if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback, ++ NULL, NULL)) ++ { ++ _dbus_warn ("Unable to add reload watch to main loop"); ++ _dbus_watch_unref (watch); ++ watch = NULL; ++ goto out; ++ } ++ ++ _dbus_register_shutdown_func (_shutdown_inotify, NULL); ++ } ++ ++ ret = 1; ++ ++out: ++ return ret; ++} ++ ++void ++bus_set_watched_dirs (BusContext *context, DBusList **directories) ++{ ++ if (!_init_inotify (context)) ++ return; ++ ++ _set_watched_dirs_internal (directories); ++} +-- +1.6.2.5 + diff --git a/sys-apps/dbus/files/0002-Fix-compilation-in-disable-selinux-case.patch b/sys-apps/dbus/files/0002-Fix-compilation-in-disable-selinux-case.patch new file mode 100644 index 000000000000..a0f6e47b841e --- /dev/null +++ b/sys-apps/dbus/files/0002-Fix-compilation-in-disable-selinux-case.patch @@ -0,0 +1,182 @@ +From 3dac125d61ebc4f614a1723580043e2f1c811f59 Mon Sep 17 00:00:00 2001 +From: Colin Walters <walters@verbum.org> +Date: Tue, 2 Feb 2010 14:57:47 -0500 +Subject: [PATCH 2/2] Fix compilation in --disable-selinux case + +_dbus_change_to_daemon_user moved into selinux.c for the --with-selinux +(and audit) case because that's where all of the relevant libcap headers +were being used. However in the --disable-selinux case this didn't +compile and wasn't very clean. + +If we don't have libaudit, use the legacy direct setgid/setuid bits +we had before in dbus-sysdeps-util-unix.c. +--- + bus/selinux.c | 35 ++--------------------- + bus/selinux.h | 2 - + dbus/dbus-sysdeps-util-unix.c | 62 +++++++++++++++++++++++++++++++++++++++++ + dbus/dbus-sysdeps.h | 3 ++ + 4 files changed, 68 insertions(+), 34 deletions(-) + +diff --git a/bus/selinux.c b/bus/selinux.c +index 456723a..e61efc5 100644 +--- a/bus/selinux.c ++++ b/bus/selinux.c +@@ -1017,6 +1017,8 @@ bus_selinux_shutdown (void) + #endif /* HAVE_SELINUX */ + } + ++/* The !HAVE_LIBAUDIT case lives in dbus-sysdeps-util-unix.c */ ++#ifdef HAVE_LIBAUDIT + /** + * Changes the user and group the bus is running as. + * +@@ -1042,7 +1044,6 @@ _dbus_change_to_daemon_user (const char *user, + return FALSE; + } + +-#ifdef HAVE_LIBAUDIT + /* If we were root */ + if (_dbus_geteuid () == 0) + { +@@ -1083,38 +1084,8 @@ _dbus_change_to_daemon_user (const char *user, + return FALSE; + } + } +-#else +- /* setgroups() only works if we are a privileged process, +- * so we don't return error on failure; the only possible +- * failure is that we don't have perms to do it. +- * +- * not sure this is right, maybe if setuid() +- * is going to work then setgroups() should also work. +- */ +- if (setgroups (0, NULL) < 0) +- _dbus_warn ("Failed to drop supplementary groups: %s\n", +- _dbus_strerror (errno)); +- +- /* Set GID first, or the setuid may remove our permission +- * to change the GID +- */ +- if (setgid (gid) < 0) +- { +- dbus_set_error (error, _dbus_error_from_errno (errno), +- "Failed to set GID to %lu: %s", gid, +- _dbus_strerror (errno)); +- return FALSE; +- } +- +- if (setuid (uid) < 0) +- { +- dbus_set_error (error, _dbus_error_from_errno (errno), +- "Failed to set UID to %lu: %s", uid, +- _dbus_strerror (errno)); +- return FALSE; +- } +-#endif /* !HAVE_LIBAUDIT */ + + return TRUE; + } ++#endif + +diff --git a/bus/selinux.h b/bus/selinux.h +index f208fbe..3bab36d 100644 +--- a/bus/selinux.h ++++ b/bus/selinux.h +@@ -68,7 +68,5 @@ BusSELinuxID* bus_selinux_init_connection_id (DBusConnection *connection, + + + void bus_selinux_audit_init(void); +-dbus_bool_t _dbus_change_to_daemon_user (const char *user, +- DBusError *error); + + #endif /* BUS_SELINUX_H */ +diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c +index 27cdbb0..74e8d88 100644 +--- a/dbus/dbus-sysdeps-util-unix.c ++++ b/dbus/dbus-sysdeps-util-unix.c +@@ -303,6 +303,68 @@ _dbus_verify_daemon_user (const char *user) + return _dbus_get_user_id_and_primary_group (&u, NULL, NULL); + } + ++ ++/* The HAVE_LIBAUDIT case lives in selinux.c */ ++#ifndef HAVE_LIBAUDIT ++/** ++ * Changes the user and group the bus is running as. ++ * ++ * @param user the user to become ++ * @param error return location for errors ++ * @returns #FALSE on failure ++ */ ++dbus_bool_t ++_dbus_change_to_daemon_user (const char *user, ++ DBusError *error) ++{ ++ dbus_uid_t uid; ++ dbus_gid_t gid; ++ DBusString u; ++ ++ _dbus_string_init_const (&u, user); ++ ++ if (!_dbus_get_user_id_and_primary_group (&u, &uid, &gid)) ++ { ++ dbus_set_error (error, DBUS_ERROR_FAILED, ++ "User '%s' does not appear to exist?", ++ user); ++ return FALSE; ++ } ++ ++ /* setgroups() only works if we are a privileged process, ++ * so we don't return error on failure; the only possible ++ * failure is that we don't have perms to do it. ++ * ++ * not sure this is right, maybe if setuid() ++ * is going to work then setgroups() should also work. ++ */ ++ if (setgroups (0, NULL) < 0) ++ _dbus_warn ("Failed to drop supplementary groups: %s\n", ++ _dbus_strerror (errno)); ++ ++ /* Set GID first, or the setuid may remove our permission ++ * to change the GID ++ */ ++ if (setgid (gid) < 0) ++ { ++ dbus_set_error (error, _dbus_error_from_errno (errno), ++ "Failed to set GID to %lu: %s", gid, ++ _dbus_strerror (errno)); ++ return FALSE; ++ } ++ ++ if (setuid (uid) < 0) ++ { ++ dbus_set_error (error, _dbus_error_from_errno (errno), ++ "Failed to set UID to %lu: %s", uid, ++ _dbus_strerror (errno)); ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++#endif /* !HAVE_LIBAUDIT */ ++ + void + _dbus_init_system_log (void) + { +diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h +index b154f01..80f0ba2 100644 +--- a/dbus/dbus-sysdeps.h ++++ b/dbus/dbus-sysdeps.h +@@ -512,6 +512,9 @@ unsigned long _dbus_pid_for_log (void); + */ + dbus_pid_t _dbus_getpid (void); + ++dbus_bool_t _dbus_change_to_daemon_user (const char *user, ++ DBusError *error); ++ + void _dbus_flush_caches (void); + + /** @} */ +-- +1.6.2.5 + |