diff options
Diffstat (limited to 'patches/source/dbus')
-rw-r--r-- | patches/source/dbus/dbus-1.4.x-allow_root_globally.diff | 18 | ||||
-rw-r--r-- | patches/source/dbus/dbus.CVE-2013-2168.diff | 91 | ||||
-rwxr-xr-x | patches/source/dbus/dbus.SlackBuild | 145 | ||||
-rw-r--r-- | patches/source/dbus/dbus.set.home.diff | 22 | ||||
-rw-r--r-- | patches/source/dbus/doinst.sh | 22 | ||||
-rw-r--r-- | patches/source/dbus/rc.messagebus | 82 | ||||
-rw-r--r-- | patches/source/dbus/slack-desc | 18 |
7 files changed, 398 insertions, 0 deletions
diff --git a/patches/source/dbus/dbus-1.4.x-allow_root_globally.diff b/patches/source/dbus/dbus-1.4.x-allow_root_globally.diff new file mode 100644 index 000000000..6bd84833f --- /dev/null +++ b/patches/source/dbus/dbus-1.4.x-allow_root_globally.diff @@ -0,0 +1,18 @@ +diff -Nur dbus-1.4.0.orig//bus/system.conf.in dbus-1.4.0//bus/system.conf.in +--- dbus-1.4.0.orig//bus/system.conf.in 2010-08-31 16:44:19.000000000 -0500 ++++ dbus-1.4.0//bus/system.conf.in 2010-09-14 09:17:56.080373096 -0500 +@@ -70,6 +70,14 @@ + send_member="UpdateActivationEnvironment"/> + </policy> + ++ <!-- Allow root to do anything over the messagebus. ++ Don't whine about "security" - anyone with root privileges ++ can edit this file anyway, so -ENOHOLE here. --> ++ <policy user="root"> ++ <allow send_destination="*"/> ++ <allow send_interface="*"/> ++ </policy> ++ + <!-- Config files are placed here that among other things, punch + holes in the above policy for specific services. --> + <includedir>system.d</includedir> diff --git a/patches/source/dbus/dbus.CVE-2013-2168.diff b/patches/source/dbus/dbus.CVE-2013-2168.diff new file mode 100644 index 000000000..7ae8f4a0d --- /dev/null +++ b/patches/source/dbus/dbus.CVE-2013-2168.diff @@ -0,0 +1,91 @@ +From 954d75b2b64e4799f360d2a6bf9cff6d9fee37e7 Mon Sep 17 00:00:00 2001 +From: Simon McVittie <simon.mcvittie@collabora.co.uk> +Date: Mon, 10 Jun 2013 17:06:47 +0000 +Subject: CVE-2013-2168: _dbus_printf_string_upper_bound: copy the va_list for each use + +Using a va_list more than once is non-portable: it happens to work +under the ABI of (for instance) x86 Linux, but not x86-64 Linux. + +This led to _dbus_printf_string_upper_bound() crashing if it should +have returned exactly 1024 bytes. Many system services can be induced +to process a caller-controlled string in ways that +end up using _dbus_printf_string_upper_bound(), so this is a denial of +service. + +Reviewed-by: Thiago Macieira <thiago@kde.org> +--- +diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c +index fc67799..e31c735 100644 +--- a/dbus/dbus-sysdeps-unix.c ++++ b/dbus/dbus-sysdeps-unix.c +@@ -3121,8 +3121,11 @@ _dbus_printf_string_upper_bound (const char *format, + char static_buf[1024]; + int bufsize = sizeof (static_buf); + int len; ++ va_list args_copy; + +- len = vsnprintf (static_buf, bufsize, format, args); ++ DBUS_VA_COPY (args_copy, args); ++ len = vsnprintf (static_buf, bufsize, format, args_copy); ++ va_end (args_copy); + + /* If vsnprintf() returned non-negative, then either the string fits in + * static_buf, or this OS has the POSIX and C99 behaviour where vsnprintf +@@ -3138,8 +3141,12 @@ _dbus_printf_string_upper_bound (const char *format, + * or the real length could be coincidentally the same. Which is it? + * If vsnprintf returns the truncated length, we'll go to the slow + * path. */ +- if (vsnprintf (static_buf, 1, format, args) == 1) ++ DBUS_VA_COPY (args_copy, args); ++ ++ if (vsnprintf (static_buf, 1, format, args_copy) == 1) + len = -1; ++ ++ va_end (args_copy); + } + + /* If vsnprintf() returned negative, we have to do more work. +@@ -3155,7 +3162,10 @@ _dbus_printf_string_upper_bound (const char *format, + if (buf == NULL) + return -1; + +- len = vsnprintf (buf, bufsize, format, args); ++ DBUS_VA_COPY (args_copy, args); ++ len = vsnprintf (buf, bufsize, format, args_copy); ++ va_end (args_copy); ++ + dbus_free (buf); + + /* If the reported length is exactly the buffer size, round up to the +diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c +index bc4951b..c42316f 100644 +--- a/dbus/dbus-sysdeps-win.c ++++ b/dbus/dbus-sysdeps-win.c +@@ -538,9 +538,12 @@ int _dbus_printf_string_upper_bound (const char *format, + char buf[1024]; + int bufsize; + int len; ++ va_list args_copy; + + bufsize = sizeof (buf); +- len = _vsnprintf (buf, bufsize - 1, format, args); ++ DBUS_VA_COPY (args_copy, args); ++ len = _vsnprintf (buf, bufsize - 1, format, args_copy); ++ va_end (args_copy); + + while (len == -1) /* try again */ + { +@@ -553,7 +556,9 @@ int _dbus_printf_string_upper_bound (const char *format, + if (p == NULL) + return -1; + +- len = _vsnprintf (p, bufsize - 1, format, args); ++ DBUS_VA_COPY (args_copy, args); ++ len = _vsnprintf (p, bufsize - 1, format, args_copy); ++ va_end (args_copy); + free (p); + } + +-- +cgit v0.9.0.2-2-gbebe + diff --git a/patches/source/dbus/dbus.SlackBuild b/patches/source/dbus/dbus.SlackBuild new file mode 100755 index 000000000..554a09047 --- /dev/null +++ b/patches/source/dbus/dbus.SlackBuild @@ -0,0 +1,145 @@ +#!/bin/sh + +# Copyright 2007-2010 Robby Workman, Northport, Alabama, USA +# Copyright 2007-2012 Patrick Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PKGNAM=dbus +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | cut -d - -f 2 | rev | cut -f 3- -d . | rev)} +BUILD=${BUILD:-4_slack14.0} + +NUMJOBS=${NUMJOBS:-" -j7 "} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.xz || exit 1 +cd $PKGNAM-$VERSION || exit 1 +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +zcat $CWD/dbus-1.4.x-allow_root_globally.diff.gz | patch -p1 --verbose || exit 1 +zcat $CWD/dbus.set.home.diff.gz | patch -p1 --verbose || exit 1 +zcat $CWD/dbus.CVE-2013-2168.diff.gz | patch -p1 --verbose || exit 1 + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --docdir=/usr/doc/$PKGNAM-$VERSION \ + --disable-doxygen-docs \ + --enable-shared=yes \ + --enable-static=no \ + --enable-inotify \ + --enable-x11-autolaunch \ + --with-system-pid-file=/var/run/dbus/dbus.pid \ + --with-system-socket=/var/run/dbus/system_bus_socket \ + --with-init-scripts=slackware \ + --build=$ARCH-slackware-linux + +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG + +find $PKG | xargs file | grep -e "executable" -e "shared object" \ + | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +# Compress and link manpages, if any: +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +# Install a custom init script for dbus - the included one is not good for us +rm $PKG/etc/rc.d/* +zcat $CWD/rc.messagebus.gz > $PKG/etc/rc.d/rc.messagebus.new +chmod 0755 $PKG/etc/rc.d/rc.messagebus.new + +# Fix some directory ownership +chown messagebus $PKG/var/lib/dbus + +# Add documentation +mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION +cp -a \ + AUTHORS COPYING* HACKING INSTALL NEWS README* doc/*.{txt,html,dtd} \ + $PKG/usr/doc/$PKGNAM-$VERSION +find $PKG/usr/doc/$PKGNAM-$VERSION -type f -exec chmod 0644 {} \; + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION) + cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog + touch -r ChangeLog $DOCSDIR/ChangeLog +fi + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz + diff --git a/patches/source/dbus/dbus.set.home.diff b/patches/source/dbus/dbus.set.home.diff new file mode 100644 index 000000000..5c0f7976a --- /dev/null +++ b/patches/source/dbus/dbus.set.home.diff @@ -0,0 +1,22 @@ +Set HOME environment variable when switching user. + +2011-08-05 Egor Y. Egorov + +References: +https://bugs.freedesktop.org/show_bug.cgi?id=39857 +https://bugs.kde.org/show_bug.cgi?id=249217#c27 + +diff --git a/bus/activation-helper.c b/bus/activation-helper.c +index baba8f0..b75ea7c 100644 +--- a/bus/activation-helper.c ++++ b/bus/activation-helper.c +@@ -344,6 +344,8 @@ switch_user (char *user, DBusError *error) + "cannot setuid user %i", pw->pw_uid); + return FALSE; + } ++ ++ _dbus_setenv ("HOME", pw->pw_dir); + #endif + return TRUE; + } + diff --git a/patches/source/dbus/doinst.sh b/patches/source/dbus/doinst.sh new file mode 100644 index 000000000..d12d7756a --- /dev/null +++ b/patches/source/dbus/doinst.sh @@ -0,0 +1,22 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.messagebus.new: +if [ -e etc/rc.d/rc.messagebus ]; then + cp -a etc/rc.d/rc.messagebus etc/rc.d/rc.messagebus.new.incoming + cat etc/rc.d/rc.messagebus.new > etc/rc.d/rc.messagebus.new.incoming + mv etc/rc.d/rc.messagebus.new.incoming etc/rc.d/rc.messagebus.new +fi + +config etc/rc.d/rc.messagebus.new + diff --git a/patches/source/dbus/rc.messagebus b/patches/source/dbus/rc.messagebus new file mode 100644 index 000000000..fb035af54 --- /dev/null +++ b/patches/source/dbus/rc.messagebus @@ -0,0 +1,82 @@ +#!/bin/sh +# +# messagebus: The D-BUS systemwide message bus +# +# description: This is a daemon which broadcasts notifications of system events \ +# and other messages. See http://www.freedesktop.org/software/dbus/ +# +# processname: dbus-daemon +# pidfile: /var/run/dbus/pid + +# This is a modified version of the rc.messagebus script distributed with the +# dbus sources. Thanks to Don Tanner of the GWare <http://gware.org> Project +# for most of the work involved --Robby Workman <rworkman@slackware.com> + + +PIDFILE=/var/run/dbus/dbus.pid + +start() { + mkdir -p $(dirname $PIDFILE) + if ! ps -u messagebus -c | grep -wq dbus-daemon; then + rm -f $(dirname $PIDFILE)/* + if [ -x /usr/bin/dbus-uuidgen -a -x /usr/bin/dbus-daemon ] ; then + echo "Starting system message bus: /usr/bin/dbus-uuidgen --ensure ; /usr/bin/dbus-daemon --system" + /usr/bin/dbus-uuidgen --ensure + /usr/bin/dbus-daemon --system 1> /dev/null + fi + fi +} + +stop() { + if [ -e "$PIDFILE" ]; then + echo "Stopping system message bus..." + pid=$(cat $PIDFILE) + kill $pid 1> /dev/null 2> /dev/null + # Just in case: + killall dbus-daemon 1> /dev/null 2> /dev/null + rm -f $PIDFILE + fi +} + +reload() { + echo "Reloading system message bus configuration..." + if [ -e "$PIDFILE" ]; then + pid=$(cat $PIDFILE) + kill -HUP $pid + else + killall -HUP dbus-daemon + fi +} + +status() { + if ps -u messagebus -c | grep -wq dbus-daemon; then + echo "System dbus-daemon is running." + else + echo "System dbus-daemon is stopped." + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + echo "You may need to restart your Window Manager to reconnect to the system dbus." + ;; + reload) + reload + ;; + status) + status + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + ;; +esac + diff --git a/patches/source/dbus/slack-desc b/patches/source/dbus/slack-desc new file mode 100644 index 000000000..0610ab8d3 --- /dev/null +++ b/patches/source/dbus/slack-desc @@ -0,0 +1,18 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + |-----handy-ruler------------------------------------------------------| +dbus: dbus (D-Bus message bus system) +dbus: +dbus: D-Bus supplies both a system daemon (for events such as "new hardware +dbus: device added" or "printer queue changed") and a per user login +dbus: session daemon (for general IPC needs among user applications). +dbus: Also, the message bus is built on top of a general one-to-one message +dbus: passing framework, which can be used by any two apps to communicate +dbus: directly (without going through the message bus daemon). +dbus: +dbus: +dbus: |