@@ 1,127 0,0 @@
-From 7faabbeb1d735069a2fd1e24e20b2543306a0e28 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Tue, 24 Mar 2020 11:31:41 +0100
-Subject: [PATCH] _dbus_generate_random_bytes: use getrandom(2)
-
-Use getrandom(2) and fall back to /dev/urandom if it is missing or if it
-fails some any reason.
-
-This solves problem where dbus-uuidgen is called from a chroot which
-lacks /dev/urandom.
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
----
- cmake/ConfigureChecks.cmake | 2 ++
- cmake/config.h.cmake | 2 ++
- configure.ac | 3 ++-
- dbus/dbus-sysdeps-unix.c | 23 ++++++++++++++++++++---
- 4 files changed, 26 insertions(+), 4 deletions(-)
-
-diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
-index a9a5fc90..f920c75f 100644
---- a/cmake/ConfigureChecks.cmake
-+++ b/cmake/ConfigureChecks.cmake
-@@ -26,6 +26,7 @@ check_include_file(strings.h HAVE_STRINGS_H)
- check_include_file(syslog.h HAVE_SYSLOG_H)
- check_include_files("stdint.h;sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
- check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H)
-+check_include_file(sys/random.h HAVE_SYS_RANDOM_H)
- check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
- check_include_file(sys/stat.h HAVE_SYS_STAT_H)
- check_include_file(sys/types.h HAVE_SYS_TYPES_H)
-@@ -62,6 +63,7 @@ check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
- check_symbol_exists(SCM_RIGHTS "sys/types.h;sys/socket.h;sys/un.h" HAVE_UNIX_FD_PASSING)
- check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL)
- check_symbol_exists(raise "signal.h" HAVE_RAISE)
-+check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
- check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
- check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
- check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
-diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
-index 11191821..10388fce 100644
---- a/cmake/config.h.cmake
-+++ b/cmake/config.h.cmake
-@@ -128,6 +128,7 @@
- #cmakedefine HAVE_SYS_EVENTS_H
- #cmakedefine HAVE_SYS_INOTIFY_H
- #cmakedefine HAVE_SYS_PRCTL_H
-+#cmakedefine HAVE_SYS_RANDOM_H 1
- #cmakedefine HAVE_SYS_RESOURCE_H
- #cmakedefine HAVE_SYS_STAT_H
-
-@@ -205,6 +206,7 @@
- #cmakedefine HAVE_ACCEPT4 1
- #cmakedefine HAVE_DIRFD 1
- #cmakedefine HAVE_INOTIFY_INIT1 1
-+#cmakedefine HAVE_GETRANDOM 1
- #cmakedefine HAVE_GETRLIMIT 1
- #cmakedefine HAVE_PRLIMIT 1
- #cmakedefine HAVE_SETRLIMIT 1
-diff --git a/configure.ac b/configure.ac
-index a1ba877a..c9f50b0f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -619,7 +619,7 @@ AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension]
- AC_SEARCH_LIBS(socket,[socket network])
- AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
-
--AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid setresuid getrlimit prlimit])
-+AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid setresuid getrlimit getrandom prlimit])
-
- AC_CHECK_HEADERS([syslog.h])
- if test "x$ac_cv_header_syslog_h" = "xyes"; then
-@@ -667,6 +667,7 @@ fi
-
- AC_CHECK_HEADERS(sys/resource.h)
- AC_CHECK_HEADERS([sys/time.h])
-+AC_CHECK_HEADERS([sys/random.h])
-
- AC_CHECK_HEADERS(dirent.h)
-
-diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
-index e8cd5b33..44f7711e 100644
---- a/dbus/dbus-sysdeps-unix.c
-+++ b/dbus/dbus-sysdeps-unix.c
-@@ -80,6 +80,9 @@
- #ifdef HAVE_ALLOCA_H
- #include <alloca.h>
- #endif
-+#ifdef HAVE_SYS_RANDOM_H
-+#include <sys/random.h>
-+#endif
-
- #ifdef HAVE_ADT
- #include <bsm/adt.h>
-@@ -3158,12 +3161,26 @@ _dbus_generate_random_bytes (DBusString *str,
- int n_bytes,
- DBusError *error)
- {
-- int old_len;
-+ int old_len = _dbus_string_get_length (str);
- int fd;
- int result;
-+#ifdef HAVE_GETRANDOM
-+ char *buffer;
-+
-+ if (!_dbus_string_lengthen (str, n_bytes))
-+ {
-+ _DBUS_SET_OOM (error);
-+ return FALSE;
-+ }
-+
-+ buffer = _dbus_string_get_data_len (str, old_len, n_bytes);
-+ result = getrandom (buffer, n_bytes, GRND_NONBLOCK);
-
-- old_len = _dbus_string_get_length (str);
-- fd = -1;
-+ if (result == n_bytes)
-+ return TRUE;
-+
-+ _dbus_string_set_length (str, old_len);
-+#endif
-
- /* note, urandom on linux will fall back to pseudorandom */
- fd = open ("/dev/urandom", O_RDONLY);
---
-2.26.0
-
@@ 1,7 1,7 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: xdavidwu <xdavidwuph@gmail.com>
pkgname=dbus
-pkgver=1.12.22
+pkgver=1.14.0
pkgrel=0
pkgdesc="Freedesktop.org message bus system"
url="https://www.freedesktop.org/Software/dbus"
@@ 25,8 25,7 @@ pkggroups="messagebus"
install="$pkgname.pre-install $pkgname.post-install"
triggers="$pkgname.trigger=/usr/share/dbus-1/system.d"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-x11"
-source="https://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz
- 0001-_dbus_generate_random_bytes-use-getrandom-2.patch
+source="https://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.xz
"
options="!check" # Introduces circular dependency with xorg-server (xvfb-run -> xvfb)
@@ 89,6 88,5 @@ x11() {
sha512sums="
-0a716022f9d693fcaf871b6dfb5f242b49a8dd05d3316ec3e530f5129f1d81a2fa9caec795fa62cfdcba6ed21549fdd2f896f9bf1cc9a96e2a7d04f2c7ec7be6 dbus-1.12.22.tar.gz
-3db35499361e84d8e2469b88b033f49813b179188ac25f1841a989988c352af398a56dfd94383813626c6dfd032194f7a9fcdba001ccc3e005e7cd22dae7a7ed 0001-_dbus_generate_random_bytes-use-getrandom-2.patch
+9bf17a3ebb3cf44722c6fbf24ee56e9dc14d6882fc312f26c7f07459d969424bc2fb63a229139e011804ecc479a8f0eb1a0c83286f8d5a664c5979d12634179f dbus-1.14.0.tar.xz
"