actually upload new source, delete unused patches;

This commit is contained in:
Colin Walters 2010-02-02 16:20:43 +00:00
parent ad3a4388b3
commit 3bc596950b
12 changed files with 2 additions and 1407 deletions

View File

@ -1 +1 @@
dbus-1.2.16.tar.gz
dbus-1.2.18.tar.gz

View File

@ -1,13 +0,0 @@
diff -urN dbus-1.2.1/bus/system.conf.in dbus-1.2.1.b/bus/system.conf.in
--- dbus-1.2.1/bus/system.conf.in 2008-04-04 11:24:08.000000000 -0400
+++ dbus-1.2.1.b/bus/system.conf.in 2008-07-17 13:56:26.000000000 -0400
@@ -17,6 +17,9 @@
<!-- Run as special user -->
<user>@DBUS_USER@</user>
+ <!-- Up the max timeout -->
+ <limit name="reply_timeout">21600000</limit>
+
<!-- Fork into daemon mode -->
<fork/>

View File

@ -1,230 +0,0 @@
diff -urp dbus-1.2.16.orig/bus/selinux.c dbus-1.2.16/bus/selinux.c
--- dbus-1.2.16.orig/bus/selinux.c 2009-10-03 08:46:51.000000000 -0400
+++ dbus-1.2.16/bus/selinux.c 2009-10-03 08:47:26.000000000 -0400
@@ -45,6 +45,7 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef HAVE_LIBAUDIT
+#include <cap-ng.h>
#include <libaudit.h>
#endif /* HAVE_LIBAUDIT */
#endif /* HAVE_SELINUX */
@@ -143,13 +144,17 @@ log_callback (const char *fmt, ...)
#ifdef HAVE_LIBAUDIT
if (audit_fd >= 0)
{
- char buf[PATH_MAX*2];
+ capng_get_caps_process();
+ if (capng_have_capability(CAPNG_EFFECTIVE, CAP_AUDIT_WRITE))
+ {
+ char buf[PATH_MAX*2];
- /* FIXME: need to change this to show real user */
- vsnprintf(buf, sizeof(buf), fmt, ap);
- audit_log_user_avc_message(audit_fd, AUDIT_USER_AVC, buf, NULL, NULL,
+ /* FIXME: need to change this to show real user */
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ audit_log_user_avc_message(audit_fd, AUDIT_USER_AVC, buf, NULL, NULL,
NULL, getuid());
- return;
+ return;
+ }
}
#endif /* HAVE_LIBAUDIT */
diff -urp dbus-1.2.16.orig/configure.in dbus-1.2.16/configure.in
--- dbus-1.2.16.orig/configure.in 2009-10-03 08:46:51.000000000 -0400
+++ dbus-1.2.16/configure.in 2009-10-03 08:47:26.000000000 -0400
@@ -844,7 +844,7 @@ else
AC_CHECK_LIB(audit, audit_log_user_avc_message,
have_libaudit=yes, have_libaudit=no)
if test x$have_libaudit = xyes ; then
- AC_CHECK_LIB(cap, cap_set_proc,
+ AC_CHECK_LIB(cap-ng, capng_clear,
have_libaudit=yes, have_libaudit=no)
fi
fi
@@ -853,7 +853,7 @@ AM_CONDITIONAL(HAVE_LIBAUDIT, test x$hav
if test x$have_libaudit = xyes ; then
SELINUX_LIBS="$SELINUX_LIBS -laudit"
- LIBS="-lcap $LIBS"
+ LIBS="-lcap-ng $LIBS"
AC_DEFINE(HAVE_LIBAUDIT,1,[audit daemon SELinux support])
fi
diff -urp dbus-1.2.16.orig/dbus/dbus-sysdeps-util-unix.c dbus-1.2.16/dbus/dbus-sysdeps-util-unix.c
--- dbus-1.2.16.orig/dbus/dbus-sysdeps-util-unix.c 2009-10-03 08:46:51.000000000 -0400
+++ dbus-1.2.16/dbus/dbus-sysdeps-util-unix.c 2009-10-03 08:52:14.000000000 -0400
@@ -46,8 +46,7 @@
#include <syslog.h>
#include <syslog.h>
#ifdef HAVE_LIBAUDIT
-#include <sys/prctl.h>
-#include <sys/capability.h>
+#include <cap-ng.h>
#include <libaudit.h>
#endif /* HAVE_LIBAUDIT */
@@ -323,10 +322,6 @@ _dbus_change_to_daemon_user (const char
dbus_uid_t uid;
dbus_gid_t gid;
DBusString u;
-#ifdef HAVE_LIBAUDIT
- dbus_bool_t we_were_root;
- cap_t new_caps;
-#endif
_dbus_string_init_const (&u, user);
@@ -339,123 +334,49 @@ _dbus_change_to_daemon_user (const char
}
#ifdef HAVE_LIBAUDIT
- we_were_root = _dbus_geteuid () == 0;
- new_caps = NULL;
- /* have a tmp set of caps that we use to transition to the usr/grp dbus should
- * run as ... doesn't really help. But keeps people happy.
- */
-
- if (we_were_root)
+ /* If we were root */
+ if (_dbus_geteuid () == 0)
{
- cap_value_t new_cap_list[] = { CAP_AUDIT_WRITE };
- cap_value_t tmp_cap_list[] = { CAP_AUDIT_WRITE, CAP_SETUID, CAP_SETGID };
- cap_t tmp_caps = cap_init();
-
- if (!tmp_caps || !(new_caps = cap_init ()))
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "Failed to initialize drop of capabilities: %s\n",
- _dbus_strerror (errno));
-
- if (tmp_caps)
- cap_free (tmp_caps);
+ int rc;
- return FALSE;
- }
-
- /* assume these work... */
- cap_set_flag (new_caps, CAP_PERMITTED, 1, new_cap_list, CAP_SET);
- cap_set_flag (new_caps, CAP_EFFECTIVE, 1, new_cap_list, CAP_SET);
- cap_set_flag (tmp_caps, CAP_PERMITTED, 3, tmp_cap_list, CAP_SET);
- cap_set_flag (tmp_caps, CAP_EFFECTIVE, 3, tmp_cap_list, CAP_SET);
-
- if (prctl (PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1)
+ capng_clear(CAPNG_SELECT_BOTH);
+ capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
+ CAP_AUDIT_WRITE);
+ rc = capng_change_id(uid, gid, 0);
+ if (rc)
{
- dbus_set_error (error, _dbus_error_from_errno (errno),
- "Failed to set keep-capabilities: %s\n",
- _dbus_strerror (errno));
- cap_free (tmp_caps);
- goto fail;
- }
-
- if (cap_set_proc (tmp_caps) == -1)
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
+ switch (rc) {
+ default:
+ dbus_set_error (error, DBUS_ERROR_FAILED,
"Failed to drop capabilities: %s\n",
_dbus_strerror (errno));
- cap_free (tmp_caps);
- goto fail;
- }
- cap_free (tmp_caps);
- }
-#endif /* HAVE_LIBAUDIT */
-
- /* 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),
+ break;
+ case -4:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to set GID to %lu: %s", gid,
_dbus_strerror (errno));
- goto fail;
- }
-
- if (setuid (uid) < 0)
- {
- dbus_set_error (error, _dbus_error_from_errno (errno),
+ break;
+ case -5:
+ _dbus_warn ("Failed to drop supplementary groups: %s\n",
+ _dbus_strerror (errno));
+ break;
+ case -6:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to set UID to %lu: %s", uid,
_dbus_strerror (errno));
- goto fail;
- }
-
-#ifdef HAVE_LIBAUDIT
- if (we_were_root)
- {
- if (cap_set_proc (new_caps))
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "Failed to drop capabilities: %s\n",
- _dbus_strerror (errno));
- goto fail;
- }
- cap_free (new_caps);
-
- /* should always work, if it did above */
- if (prctl (PR_SET_KEEPCAPS, 0, 0, 0, 0) == -1)
- {
- dbus_set_error (error, _dbus_error_from_errno (errno),
+ break;
+ case -7:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to unset keep-capabilities: %s\n",
_dbus_strerror (errno));
+ break;
+ }
return FALSE;
}
}
-#endif
+#endif /* HAVE_LIBAUDIT */
return TRUE;
-
- fail:
-#ifdef HAVE_LIBAUDIT
- if (!we_were_root)
- {
- /* should always work, if it did above */
- prctl (PR_SET_KEEPCAPS, 0, 0, 0, 0);
- cap_free (new_caps);
- }
-#endif
-
- return FALSE;
}
void

View File

@ -1,190 +0,0 @@
From cde84d96106bd005a98d064fe392301ba1f87743 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Wed, 10 Dec 2008 14:17:02 -0500
Subject: [PATCH] Add syslog of security denials and configuration file reloads
We need to start logging denials so that they become more easily trackable
and debuggable.
---
bus/bus.c | 41 +++++++++++++++++++++++++++++++----------
bus/main.c | 1 +
dbus/dbus-sysdeps-unix.c | 1 -
dbus/dbus-sysdeps-util-unix.c | 38 ++++++++++++++++++++++++++++++++++++++
dbus/dbus-sysdeps.h | 3 +++
5 files changed, 73 insertions(+), 11 deletions(-)
diff --git a/bus/bus.c b/bus/bus.c
index 42cc295..8d7879a 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -834,6 +834,7 @@ bus_context_reload_config (BusContext *context,
}
ret = TRUE;
+ _dbus_log_info ("Reloaded configuration\n");
failed:
if (parser != NULL)
bus_config_parser_unref (parser);
@@ -1315,13 +1316,13 @@ bus_context_check_security_policy (BusContext *context,
message))
{
const char *dest;
+ const char *msg = "A security policy in place prevents this sender "
+ "from sending this message to this recipient, "
+ "see message bus configuration file (rejected message "
+ "had interface \"%s\" member \"%s\" error name \"%s\" destination \"%s\")";
dest = dbus_message_get_destination (message);
- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
- "A security policy in place prevents this sender "
- "from sending this message to this recipient, "
- "see message bus configuration file (rejected message "
- "had interface \"%s\" member \"%s\" error name \"%s\" destination \"%s\")",
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, msg,
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) : "(unset)",
dbus_message_get_member (message) ?
@@ -1329,6 +1330,15 @@ bus_context_check_security_policy (BusContext *context,
dbus_message_get_error_name (message) ?
dbus_message_get_error_name (message) : "(unset)",
dest ? dest : DBUS_SERVICE_DBUS);
+ /* Needs to be duplicated to avoid calling malloc and having to handle OOM */
+ _dbus_log_security (msg,
+ dbus_message_get_interface (message) ?
+ dbus_message_get_interface (message) : "(unset)",
+ dbus_message_get_member (message) ?
+ dbus_message_get_member (message) : "(unset)",
+ dbus_message_get_error_name (message) ?
+ dbus_message_get_error_name (message) : "(unset)",
+ dest ? dest : DBUS_SERVICE_DBUS);
_dbus_verbose ("security policy disallowing message due to sender policy\n");
return FALSE;
}
@@ -1341,14 +1351,14 @@ bus_context_check_security_policy (BusContext *context,
addressed_recipient, proposed_recipient,
message))
{
+ const char *msg = "A security policy in place prevents this recipient "
+ "from receiving this message from this sender, "
+ "see message bus configuration file (rejected message "
+ "had interface \"%s\" member \"%s\" error name \"%s\" destination \"%s\" reply serial %u requested_reply=%d)";
const char *dest;
dest = dbus_message_get_destination (message);
- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
- "A security policy in place prevents this recipient "
- "from receiving this message from this sender, "
- "see message bus configuration file (rejected message "
- "had interface \"%s\" member \"%s\" error name \"%s\" destination \"%s\" reply serial %u requested_reply=%d)",
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, msg,
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) : "(unset)",
dbus_message_get_member (message) ?
@@ -1358,6 +1368,17 @@ bus_context_check_security_policy (BusContext *context,
dest ? dest : DBUS_SERVICE_DBUS,
dbus_message_get_reply_serial (message),
requested_reply);
+ /* Needs to be duplicated to avoid calling malloc and having to handle OOM */
+ _dbus_log_security (error, DBUS_ERROR_ACCESS_DENIED, msg,
+ dbus_message_get_interface (message) ?
+ dbus_message_get_interface (message) : "(unset)",
+ dbus_message_get_member (message) ?
+ dbus_message_get_member (message) : "(unset)",
+ dbus_message_get_error_name (message) ?
+ dbus_message_get_error_name (message) : "(unset)",
+ dest ? dest : DBUS_SERVICE_DBUS,
+ dbus_message_get_reply_serial (message),
+ requested_reply);
_dbus_verbose ("security policy disallowing message due to recipient policy\n");
return FALSE;
}
diff --git a/bus/main.c b/bus/main.c
index 51538fe..23ebb3e 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -178,6 +178,7 @@ handle_reload_watch (DBusWatch *watch,
dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY));
_dbus_warn ("Unable to reload configuration: %s\n",
error.message);
+ _dbus_log_info ("Unable to reload configuration: %s\n", error.message);
dbus_error_free (&error);
}
return TRUE;
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index fb40d5a..01516a1 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -2786,7 +2786,6 @@ _dbus_full_duplex_pipe (int *fd1,
#endif
}
-
/**
* Measure the length of the given format string and arguments,
* not including the terminating nul.
diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c
index d8718c2..0b0badd 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -456,6 +456,44 @@ _dbus_change_to_daemon_user (const char *user,
return FALSE;
}
+/**
+ * Log an informative message. Intended for use primarily by
+ * the system bus.
+ *
+ * @param msg a printf-style format string
+ * @param args arguments for the format string
+ */
+void
+_dbus_log_info (const char *msg, ...)
+{
+ va_list args;
+
+ va_start (args, msg);
+
+ vsyslog (LOG_DAEMON|LOG_NOTICE, msg, args);
+
+ va_end (args);
+}
+
+/**
+ * Log a security-related message. Intended for use primarily by
+ * the system bus.
+ *
+ * @param msg a printf-style format string
+ * @param args arguments for the format string
+ */
+void
+_dbus_log_security (const char *msg, ...)
+{
+ va_list args;
+
+ va_start (args, msg);
+
+ vsyslog (LOG_AUTH|LOG_NOTICE, msg, args);
+
+ va_end (args);
+}
+
/** Installs a UNIX signal handler
*
* @param sig the signal to handle
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index 469b5e5..1a67d0c 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -421,6 +421,9 @@ void _dbus_set_signal_handler (int sig,
dbus_bool_t _dbus_user_at_console (const char *username,
DBusError *error);
+void _dbus_log_info (const char *msg, ...);
+void _dbus_log_security (const char *msg, ...);
+
/* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
* config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
*/
--
1.6.0.4

View File

@ -1,27 +0,0 @@
diff -u -r dbus-1.2.14/bus/dir-watch-inotify.c dbus-1.2.14.fd-leak/bus/dir-watch-inotify.c
--- dbus-1.2.14/bus/dir-watch-inotify.c 2009-04-17 15:45:29.000000000 -0400
+++ dbus-1.2.14.fd-leak/bus/dir-watch-inotify.c 2009-06-27 18:38:54.966881736 -0400
@@ -98,7 +98,11 @@
_dbus_assert (dir != NULL);
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;
diff -u -r dbus-1.2.14/configure.in dbus-1.2.14.fd-leak/configure.in
--- dbus-1.2.14/configure.in 2009-05-06 12:51:19.000000000 -0400
+++ dbus-1.2.14.fd-leak/configure.in 2009-06-27 18:37:10.787645299 -0400
@@ -983,7 +983,7 @@
dnl check if inotify backend is enabled
if test x$have_inotify = xyes; then
AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify])
-
+ AC_CHECK_FUNCS(inotify_init1)
fi
AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes)

View File

@ -1,202 +0,0 @@
--- dbus-1.2.16.orig/bus/selinux.c 2009-11-01 09:58:22.000000000 -0500
+++ dbus-1.2.16.orig/bus/selinux.c 2009-11-01 11:30:45.000000000 -0500
@@ -1015,3 +1015,74 @@ bus_selinux_shutdown (void)
#endif /* HAVE_SELINUX */
}
+/**
+ * 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;
+ }
+
+#ifdef HAVE_LIBAUDIT
+ /* If we were root */
+ if (_dbus_geteuid () == 0)
+ {
+ int rc;
+
+ capng_clear(CAPNG_SELECT_BOTH);
+ capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
+ CAP_AUDIT_WRITE);
+ rc = capng_change_id(uid, gid, 0);
+ if (rc)
+ {
+ switch (rc) {
+ default:
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Failed to drop capabilities: %s\n",
+ _dbus_strerror (errno));
+ break;
+ case -4:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
+ "Failed to set GID to %lu: %s", gid,
+ _dbus_strerror (errno));
+ break;
+ case -5:
+ _dbus_warn ("Failed to drop supplementary groups: %s\n",
+ _dbus_strerror (errno));
+ break;
+ case -6:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
+ "Failed to set UID to %lu: %s", uid,
+ _dbus_strerror (errno));
+ break;
+ case -7:
+ dbus_set_error (error, _dbus_error_from_errno (errno),
+ "Failed to unset keep-capabilities: %s\n",
+ _dbus_strerror (errno));
+ break;
+ }
+ return FALSE;
+ }
+ }
+#endif /* HAVE_LIBAUDIT */
+
+ return TRUE;
+}
+
--- dbus-1.2.16.orig/bus/selinux.h 2009-11-01 09:58:22.000000000 -0500
+++ dbus-1.2.16.orig/bus/selinux.h 2009-11-01 11:33:15.000000000 -0500
@@ -68,5 +68,7 @@ BusSELinuxID* bus_selinux_init_connectio
void bus_selinux_audit_init(void);
+dbus_bool_t _dbus_change_to_daemon_user (const char *user,
+ DBusError *error);
#endif /* BUS_SELINUX_H */
--- dbus-1.2.16.orig/configure.in 2009-11-01 09:58:22.000000000 -0500
+++ dbus-1.2.16.orig/configure.in 2009-11-01 11:30:45.000000000 -0500
@@ -852,8 +852,7 @@ fi
AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)
if test x$have_libaudit = xyes ; then
- SELINUX_LIBS="$SELINUX_LIBS -laudit"
- LIBS="-lcap-ng $LIBS"
+ SELINUX_LIBS="$SELINUX_LIBS -laudit -lcap-ng"
AC_DEFINE(HAVE_LIBAUDIT,1,[audit daemon SELinux support])
fi
--- dbus-1.2.16.orig/dbus/dbus-sysdeps.h 2009-11-01 09:58:22.000000000 -0500
+++ dbus-1.2.16.orig/dbus/dbus-sysdeps.h 2009-11-01 11:33:08.000000000 -0500
@@ -418,8 +418,6 @@ dbus_bool_t _dbus_become_daemon (const
dbus_bool_t keep_umask);
dbus_bool_t _dbus_verify_daemon_user (const char *user);
-dbus_bool_t _dbus_change_to_daemon_user (const char *user,
- DBusError *error);
dbus_bool_t _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile,
DBusPipe *print_pid_pipe,
--- dbus-1.2.16.orig/dbus/dbus-sysdeps-util-unix.c 2009-11-01 09:58:22.000000000 -0500
+++ dbus-1.2.16.orig/dbus/dbus-sysdeps-util-unix.c 2009-11-01 11:30:45.000000000 -0500
@@ -45,10 +45,6 @@
#include <sys/un.h>
#include <syslog.h>
#include <syslog.h>
-#ifdef HAVE_LIBAUDIT
-#include <cap-ng.h>
-#include <libaudit.h>
-#endif /* HAVE_LIBAUDIT */
#ifdef HAVE_SYS_SYSLIMITS_H
#include <sys/syslimits.h>
@@ -308,77 +304,6 @@ _dbus_verify_daemon_user (const char *us
return _dbus_get_user_id_and_primary_group (&u, NULL, NULL);
}
-/**
- * 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;
- }
-
-#ifdef HAVE_LIBAUDIT
- /* If we were root */
- if (_dbus_geteuid () == 0)
- {
- int rc;
-
- capng_clear(CAPNG_SELECT_BOTH);
- capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
- CAP_AUDIT_WRITE);
- rc = capng_change_id(uid, gid, 0);
- if (rc)
- {
- switch (rc) {
- default:
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "Failed to drop capabilities: %s\n",
- _dbus_strerror (errno));
- break;
- case -4:
- dbus_set_error (error, _dbus_error_from_errno (errno),
- "Failed to set GID to %lu: %s", gid,
- _dbus_strerror (errno));
- break;
- case -5:
- _dbus_warn ("Failed to drop supplementary groups: %s\n",
- _dbus_strerror (errno));
- break;
- case -6:
- dbus_set_error (error, _dbus_error_from_errno (errno),
- "Failed to set UID to %lu: %s", uid,
- _dbus_strerror (errno));
- break;
- case -7:
- dbus_set_error (error, _dbus_error_from_errno (errno),
- "Failed to unset keep-capabilities: %s\n",
- _dbus_strerror (errno));
- break;
- }
- return FALSE;
- }
- }
-#endif /* HAVE_LIBAUDIT */
-
- return TRUE;
-}
-
void
_dbus_init_system_log (void)
{

View File

@ -1,310 +0,0 @@
From 949a64b127a32a3e5a4ce4278773f18e290c44c2 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 14 Dec 2009 23:12:24 +0000
Subject: Ignore exit code zero from activated services
A variety of system components have migrated from legacy init into DBus
service activation. Many of these system components "daemonize", which
involves forking. The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.
While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths. In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.
Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>
---
diff --git a/bus/activation.c b/bus/activation.c
index 782ffed..00caac2 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -1212,8 +1212,8 @@ pending_activation_failed (BusPendingActivation *pending_activation,
* Depending on the exit code of the helper, set the error accordingly
*/
static void
-handle_activation_exit_error (int exit_code,
- DBusError *error)
+handle_servicehelper_exit_error (int exit_code,
+ DBusError *error)
{
switch (exit_code)
{
@@ -1268,13 +1268,24 @@ babysitter_watch_callback (DBusWatch *watch,
BusPendingActivation *pending_activation = data;
dbus_bool_t retval;
DBusBabysitter *babysitter;
+ dbus_bool_t uses_servicehelper;
babysitter = pending_activation->babysitter;
-
+
_dbus_babysitter_ref (babysitter);
-
+
retval = dbus_watch_handle (watch, condition);
+ /* There are two major cases here; are we the system bus or the session? Here this
+ * is distinguished by whether or not we use a setuid helper launcher. With the launch helper,
+ * some process exit codes are meaningful, processed by handle_servicehelper_exit_error.
+ *
+ * In both cases though, just ignore when a process exits with status 0; it's possible for
+ * a program to (misguidedly) "daemonize", and that appears to us as an exit. This closes a race
+ * condition between this code and the child process claiming the bus name.
+ */
+ uses_servicehelper = bus_context_get_servicehelper (pending_activation->activation->context) != NULL;
+
/* FIXME this is broken in the same way that
* connection watches used to be; there should be
* a separate callback for status change, instead
@@ -1284,43 +1295,59 @@ babysitter_watch_callback (DBusWatch *watch,
* Fixing this lets us move dbus_watch_handle
* calls into dbus-mainloop.c
*/
-
if (_dbus_babysitter_get_child_exited (babysitter))
{
DBusError error;
DBusHashIter iter;
-
+ dbus_bool_t activation_failed;
+ int exit_code = 0;
+
dbus_error_init (&error);
+
_dbus_babysitter_set_child_exit_error (babysitter, &error);
- /* refine the error code if we got an exit code */
- if (dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED))
- {
- int exit_code = 0;
- if (_dbus_babysitter_get_child_exit_status (babysitter, &exit_code))
+ /* Explicitly check for SPAWN_CHILD_EXITED to avoid overwriting an
+ * exec error */
+ if (dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED)
+ && _dbus_babysitter_get_child_exit_status (babysitter, &exit_code))
+ {
+ activation_failed = exit_code != 0;
+
+ dbus_error_free(&error);
+
+ if (activation_failed)
{
- dbus_error_free (&error);
- handle_activation_exit_error (exit_code, &error);
+ if (uses_servicehelper)
+ handle_servicehelper_exit_error (exit_code, &error);
+ else
+ _dbus_babysitter_set_child_exit_error (babysitter, &error);
}
- }
-
- /* Destroy all pending activations with the same exec */
- _dbus_hash_iter_init (pending_activation->activation->pending_activations,
- &iter);
- while (_dbus_hash_iter_next (&iter))
+ }
+ else
{
- BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
-
- if (p != pending_activation && strcmp (p->exec, pending_activation->exec) == 0)
- pending_activation_failed (p, &error);
+ activation_failed = TRUE;
}
-
- /* Destroys the pending activation */
- pending_activation_failed (pending_activation, &error);
- dbus_error_free (&error);
+ if (activation_failed)
+ {
+ /* Destroy all pending activations with the same exec */
+ _dbus_hash_iter_init (pending_activation->activation->pending_activations,
+ &iter);
+ while (_dbus_hash_iter_next (&iter))
+ {
+ BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
+
+ if (p != pending_activation && strcmp (p->exec, pending_activation->exec) == 0)
+ pending_activation_failed (p, &error);
+ }
+
+ /* Destroys the pending activation */
+ pending_activation_failed (pending_activation, &error);
+
+ dbus_error_free (&error);
+ }
}
-
+
_dbus_babysitter_unref (babysitter);
return retval;
diff --git a/configure.in b/configure.in
index 7ef6632..1f2c896 100644
--- a/configure.in
+++ b/configure.in
@@ -1499,6 +1499,7 @@ test/data/valid-config-files-system/debug-allow-all-pass.conf
test/data/valid-config-files-system/debug-allow-all-fail.conf
test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service
test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service
test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service
test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service
test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service
diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in
new file mode 100644
index 0000000..49fcac3
--- a/dev/null
+++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.DBus.TestSuiteForkingEchoService
+Exec=@TEST_SERVICE_BINARY@ org.freedesktop.DBus.TestSuiteForkingEchoService fork
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am
index 1c73b87..d8e72d1 100644
--- a/test/name-test/Makefile.am
+++ b/test/name-test/Makefile.am
@@ -10,7 +10,7 @@ else
TESTS=
endif
-EXTRA_DIST=run-test.sh run-test-systemserver.sh test-wait-for-echo.py
+EXTRA_DIST=run-test.sh run-test-systemserver.sh test-wait-for-echo.py test-activation-forking.py
if DBUS_BUILD_TESTS
diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh
index fba4558..4eb2425 100755
--- a/test/name-test/run-test.sh
+++ b/test/name-test/run-test.sh
@@ -50,3 +50,9 @@ ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-
echo "running test-shutdown"
${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed"
+
+echo "running test activation forking"
+if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
+ echo "Failed test-activation-forking"
+ exit 1
+fi
diff --git a/test/name-test/test-activation-forking.py b/test/name-test/test-activation-forking.py
new file mode 100644
index 0000000..0d82075
--- a/dev/null
+++ b/test/name-test/test-activation-forking.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+import os,sys
+
+try:
+ import gobject
+ import dbus
+ import dbus.mainloop.glib
+except:
+ print "Failed import, aborting test"
+ sys.exit(0)
+
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+loop = gobject.MainLoop()
+
+exitcode = 0
+
+bus = dbus.SessionBus()
+bus_iface = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus')
+
+o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
+i = dbus.Interface(o, 'org.freedesktop.TestSuite')
+
+# Start it up
+reply = i.Echo("hello world")
+print "TestSuiteForkingEchoService initial reply OK"
+
+def ignore(*args, **kwargs):
+ pass
+
+# Now monitor for exits, when that happens, start it up again.
+# The goal here is to try to hit any race conditions in activation.
+counter = 0
+def on_forking_echo_owner_changed(name, old, new):
+ global counter
+ global o
+ global i
+ if counter > 10:
+ print "Activated 10 times OK, TestSuiteForkingEchoService pass"
+ loop.quit()
+ return
+ counter += 1
+ if new == '':
+ o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
+ i = dbus.Interface(o, 'org.freedesktop.TestSuite')
+ i.Echo("counter %r" % counter)
+ i.Exit(reply_handler=ignore, error_handler=ignore)
+
+bus_iface.connect_to_signal('NameOwnerChanged', on_forking_echo_owner_changed, arg0='org.freedesktop.DBus.TestSuiteForkingEchoService')
+
+i.Exit(reply_handler=ignore, error_handler=ignore)
+
+def check_counter():
+ if counter == 0:
+ print "Failed to get NameOwnerChanged for TestSuiteForkingEchoService"
+ sys.exit(1)
+gobject.timeout_add(15000, check_counter)
+
+loop.run()
+sys.exit(0)
diff --git a/test/test-service.c b/test/test-service.c
index c9f5839..a57bf9c 100644
--- a/test/test-service.c
+++ b/test/test-service.c
@@ -398,7 +398,33 @@ main (int argc,
DBusError error;
int result;
DBusConnection *connection;
-
+ const char *name;
+ dbus_bool_t do_fork;
+
+ if (argc != 3)
+ {
+ name = "org.freedesktop.DBus.TestSuiteEchoService";
+ do_fork = FALSE;
+ }
+ else
+ {
+ name = argv[1];
+ do_fork = strcmp (argv[2], "fork") == 0;
+ }
+
+ /* The bare minimum for simulating a program "daemonizing"; the intent
+ * is to test services which move from being legacy init scripts to
+ * activated services.
+ * https://bugzilla.redhat.com/show_bug.cgi?id=545267
+ */
+ if (do_fork)
+ {
+ pid_t pid = fork ();
+ if (pid != 0)
+ exit (0);
+ sleep (1);
+ }
+
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_STARTER, &error);
if (connection == NULL)
@@ -433,8 +459,8 @@ main (int argc,
if (d != (void*) 0xdeadbeef)
die ("dbus_connection_get_object_path_data() doesn't seem to work right\n");
}
-
- result = dbus_bus_request_name (connection, "org.freedesktop.DBus.TestSuiteEchoService",
+
+ result = dbus_bus_request_name (connection, name,
0, &error);
if (dbus_error_is_set (&error))
{
--
cgit v0.8.3-6-g21f6

View File

@ -1,12 +0,0 @@
diff -up dbus-1.2.16/bus/bus.c.policy-leak dbus-1.2.16/bus/bus.c
--- dbus-1.2.16/bus/bus.c.policy-leak 2009-12-17 19:18:50.966795963 -0500
+++ dbus-1.2.16/bus/bus.c 2009-12-17 19:17:36.023796405 -0500
@@ -438,6 +438,8 @@ process_config_every_time (BusContext
/* get our limits and timeout lengths */
bus_config_parser_get_limits (parser, &context->limits);
+ if (context->policy)
+ bus_policy_unref (context->policy);
context->policy = bus_config_parser_steal_policy (parser);
_dbus_assert (context->policy != NULL);

View File

@ -1,215 +0,0 @@
--- dbus-1.2.16/bus/dir-watch-inotify.c 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/dir-watch-inotify.c 2009-12-18 00:46:05.524818800 -0500
@@ -34,6 +34,7 @@
#include <errno.h>
#include <dbus/dbus-internals.h>
+#include <dbus/dbus-list.h>
#include <dbus/dbus-watch.h>
#include "dir-watch.h"
@@ -43,6 +44,7 @@
/* use a static array to avoid handling OOM */
static int wds[MAX_DIRS_TO_WATCH];
+static char *dirs[MAX_DIRS_TO_WATCH];
static int num_wds = 0;
static int inotify_fd = -1;
static DBusWatch *watch = NULL;
@@ -90,12 +92,10 @@
return TRUE;
}
-void
-bus_watch_directory (const char *dir, BusContext *context)
+static int
+_init_inotify (BusContext *context)
{
- int wd;
-
- _dbus_assert (dir != NULL);
+ int ret = 0;
if (inotify_fd == -1) {
#ifdef HAVE_INOTIFY_INIT1
@@ -112,22 +112,38 @@
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;
- }
+ 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;
+ }
}
+ ret = 1;
+
+out:
+ return ret;
+}
+
+void
+bus_watch_directory (const char *dir, BusContext *context)
+{
+ int wd;
+
+ _dbus_assert (dir != NULL);
+
+ if (!_init_inotify (context))
+ goto out;
+
if (num_wds >= MAX_DIRS_TO_WATCH )
{
_dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH);
@@ -141,6 +157,7 @@
goto out;
}
+ dirs[num_wds] = strdup (dir);
wds[num_wds++] = wd;
_dbus_verbose ("Added watch on config directory '%s'\n", dir);
@@ -148,7 +165,84 @@
;
}
-void
+void
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
+{
+ static int new_wds[MAX_DIRS_TO_WATCH];
+ static 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;
+ new_dirs[i] = NULL;
+ }
+
+ i = 0;
+ link = _dbus_list_get_first_link (directories);
+ while (link != NULL)
+ {
+ new_dirs[i++] = (char *)link->data;
+ link = _dbus_list_get_next_link (directories, link);
+ }
+
+ for (i = 0; new_dirs[i]; i++)
+ {
+ for (j = 0; j < num_wds; j++)
+ {
+ if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0)
+ {
+ new_wds[i] = wds[j];
+ new_dirs[i] = dirs[j];
+ wds[j] = -1;
+ dirs[j] = NULL;
+ break;
+ }
+ }
+ }
+
+ for (j = 0; j < num_wds; j++)
+ {
+ if (wds[j] != -1)
+ {
+ inotify_rm_watch (inotify_fd, wds[j]);
+ dbus_free (dirs[j]);
+ wds[j] = -1;
+ dirs[j] = NULL;
+ }
+ }
+
+ for (i = 0; new_dirs[i]; i++)
+ {
+ if (new_wds[i] == -1)
+ {
+ wd = inotify_add_watch (inotify_fd, new_dirs[i], IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM);
+ if (wd < 0)
+ {
+ _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+ goto out;
+ }
+ new_wds[i] = wd;
+ new_dirs[i] = strdup (new_dirs[i]);
+ }
+ }
+
+ num_wds = i;
+
+ for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+ {
+ wds[i] = new_wds[i];
+ dirs[i] = new_dirs[i];
+ }
+
+ out:;
+}
+
+void
bus_drop_all_directory_watches (void)
{
int ret;
--- dbus-1.2.16/bus/dir-watch.h 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/dir-watch.h 2009-12-18 00:45:47.437818936 -0500
@@ -32,4 +32,6 @@
/* drop all the watches previously set up by bus_config_watch_directory (OS dependent, may be a NOP) */
void bus_drop_all_directory_watches (void);
+void bus_set_watched_dirs (BusContext *context, DBusList **dirs);
+
#endif /* DIR_WATCH_H */
--- dbus-1.2.16/bus/bus.c 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/bus.c 2009-12-18 00:51:30.348481884 -0500
@@ -516,11 +516,6 @@
context->activation = new_activation;
- /* Drop existing conf-dir watches (if applicable) */
-
- if (is_reload)
- bus_drop_all_directory_watches ();
-
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
retval = TRUE;
@@ -551,9 +546,7 @@
_dbus_hash_table_unref (service_context_table);
/* Watch all conf directories */
- _dbus_list_foreach (bus_config_parser_get_conf_dirs (parser),
- (DBusForeachFunction) bus_watch_directory,
- context);
+ bus_set_watched_dirs (context, bus_config_parser_get_conf_dirs (parser));
return TRUE;
}

View File

@ -1,59 +0,0 @@
Index: dbus-1.2.16/dbus/dbus-connection.c
===================================================================
--- dbus-1.2.16.orig/dbus/dbus-connection.c 2009-10-01 14:10:21.000000000 +0100
+++ dbus-1.2.16/dbus/dbus-connection.c 2009-10-01 14:13:16.000000000 +0100
@@ -2386,7 +2386,7 @@
*/
_dbus_verbose ("dbus_connection_send_with_reply_and_block() waiting for more memory\n");
- _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
+ _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
}
else
{
@@ -2394,7 +2394,7 @@
_dbus_connection_do_iteration_unlocked (connection,
DBUS_ITERATION_DO_READING |
DBUS_ITERATION_BLOCK,
- timeout_milliseconds);
+ timeout_milliseconds - elapsed_milliseconds);
}
goto recheck_status;
@@ -2403,9 +2403,7 @@
_dbus_verbose ("dbus_connection_send_with_reply_and_block(): clock set backward\n");
else if (elapsed_milliseconds < timeout_milliseconds)
{
- timeout_milliseconds -= elapsed_milliseconds;
- _dbus_verbose ("dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n", timeout_milliseconds);
- _dbus_assert (timeout_milliseconds >= 0);
+ _dbus_verbose ("dbus_connection_send_with_reply_and_block(): %d milliseconds remain\n", timeout_milliseconds - elapsed_milliseconds);
if (status == DBUS_DISPATCH_NEED_MEMORY)
{
@@ -2415,7 +2413,7 @@
*/
_dbus_verbose ("dbus_connection_send_with_reply_and_block() waiting for more memory\n");
- _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
+ _dbus_memory_pause_based_on_timeout (timeout_milliseconds - elapsed_milliseconds);
}
else
{
@@ -2423,14 +2421,14 @@
_dbus_connection_do_iteration_unlocked (connection,
DBUS_ITERATION_DO_READING |
DBUS_ITERATION_BLOCK,
- timeout_milliseconds);
+ timeout_milliseconds - elapsed_milliseconds);
}
goto recheck_status;
}
_dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %ld milliseconds and got no reply\n",
- (tv_sec - start_tv_sec) * 1000 + (tv_usec - start_tv_usec) / 1000);
+ elapsed_milliseconds);
_dbus_assert (!_dbus_pending_call_get_completed_unlocked (pending));

View File

@ -1,147 +0,0 @@
diff -u -r dbus-1.2.16/bus/activation.c hacked/bus/activation.c
--- dbus-1.2.16/bus/activation.c 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/activation.c 2009-12-17 21:36:56.447546354 -0500
@@ -736,6 +736,101 @@
}
BusActivation*
+bus_activation_reload (BusActivation *activation,
+ const DBusString *address,
+ DBusList **directories,
+ DBusError *error)
+{
+ DBusList *link;
+ char *dir;
+
+ dbus_free (activation->server_address);
+ if (!_dbus_string_copy_data (address, &activation->server_address))
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ _dbus_hash_table_unref (activation->entries);
+ activation->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+ (DBusFreeFunction)bus_activation_entry_unref);
+ if (activation->entries == NULL)
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ _dbus_hash_table_unref (activation->directories);
+ activation->directories = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+ (DBusFreeFunction)bus_service_directory_unref);
+
+ if (activation->directories == NULL)
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ link = _dbus_list_get_first_link (directories);
+ while (link != NULL)
+ {
+ BusServiceDirectory *s_dir;
+
+ dir = _dbus_strdup ((const char *) link->data);
+ if (!dir)
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ s_dir = dbus_new0 (BusServiceDirectory, 1);
+ if (!s_dir)
+ {
+ dbus_free (dir);
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ s_dir->refcount = 1;
+ s_dir->dir_c = dir;
+
+ s_dir->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+ (DBusFreeFunction)bus_activation_entry_unref);
+
+ if (!s_dir->entries)
+ {
+ bus_service_directory_unref (s_dir);
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ if (!_dbus_hash_table_insert_string (activation->directories, s_dir->dir_c, s_dir))
+ {
+ bus_service_directory_unref (s_dir);
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ /* only fail on OOM, it is ok if we can't read the directory */
+ if (!update_directory (activation, s_dir, error))
+ {
+ if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
+ goto failed;
+ else
+ dbus_error_free (error);
+ }
+
+ link = _dbus_list_get_next_link (directories, link);
+ }
+
+ return activation;
+
+ failed:
+ if (activation)
+ bus_activation_unref (activation);
+ return NULL;
+}
+
+BusActivation*
bus_activation_new (BusContext *context,
const DBusString *address,
DBusList **directories,
diff -u -r dbus-1.2.16/bus/activation.h hacked/bus/activation.h
--- dbus-1.2.16/bus/activation.h 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/activation.h 2009-12-17 20:02:53.347545761 -0500
@@ -32,6 +32,10 @@
const DBusString *address,
DBusList **directories,
DBusError *error);
+BusActivation* bus_activation_reload (BusActivation *activation,
+ const DBusString *address,
+ DBusList **directories,
+ DBusError *error);
BusActivation* bus_activation_ref (BusActivation *activation);
void bus_activation_unref (BusActivation *activation);
diff -u -r dbus-1.2.16/bus/bus.c hacked/bus/bus.c
--- dbus-1.2.16/bus/bus.c 2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/bus.c 2009-12-17 20:04:08.006546566 -0500
@@ -503,19 +503,17 @@
}
/* Create activation subsystem */
- new_activation = bus_activation_new (context, &full_address,
- dirs, error);
- if (new_activation == NULL)
+ if (context->activation)
+ bus_activation_reload (context->activation, &full_address, dirs, error);
+ else
+ context->activation = bus_activation_new (context, &full_address, dirs, error);
+
+ if (context->activation == NULL)
{
_DBUS_ASSERT_ERROR_IS_SET (error);
goto failed;
}
- if (is_reload)
- bus_activation_unref (context->activation);
-
- context->activation = new_activation;
-
/* Drop existing conf-dir watches (if applicable) */

View File

@ -1 +1 @@
9cdae6a52442b62ffa4861757b1635b0 dbus-1.2.16.tar.gz
5c7e3e72e0ff0a3371eb310c6167fb87 dbus-1.2.18.tar.gz