summaryrefslogtreecommitdiff
path: root/dbus
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-01-21 15:56:42 -0500
committerColin Walters <walters@verbum.org>2009-01-21 15:56:42 -0500
commit6ca4b8c6bb0a04574373073cc8b3f59eaf8740fa (patch)
tree7e36a1b3423cbe7fffbb54fa5ca398b2f5bb9588 /dbus
parentf0cc56e1919cdc762e1ba4b3b53d377312f0c6c2 (diff)
downloaddbus-6ca4b8c6bb0a04574373073cc8b3f59eaf8740fa.tar.gz
Add syslog of security denials and configuration file reloads
We need to start logging denials so that they become more easily trackable and debuggable. Conflicts: bus/bus.c bus/config-parser-common.c bus/config-parser-common.h bus/config-parser.c test/name-test/tmp-session-like-system.conf
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-sysdeps-unix.c1
-rw-r--r--dbus/dbus-sysdeps-util-unix.c33
-rw-r--r--dbus/dbus-sysdeps.h4
3 files changed, 37 insertions, 1 deletions
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index f1ac5375..42816580 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -2307,7 +2307,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 f57b7807..439c93c2 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -36,6 +36,7 @@
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
+#include <syslog.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -287,6 +288,38 @@ _dbus_change_identity (dbus_uid_t uid,
return TRUE;
}
+void
+_dbus_init_system_log (void)
+{
+ openlog ("dbus", LOG_PID, LOG_DAEMON);
+}
+
+/**
+ * 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)
+{
+ vsyslog (LOG_DAEMON|LOG_NOTICE, msg, 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)
+{
+ vsyslog (LOG_AUTH|LOG_NOTICE, msg, 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 d3659f24..47db9fb0 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -382,6 +382,10 @@ void _dbus_set_signal_handler (int sig,
dbus_bool_t _dbus_user_at_console (const char *username,
DBusError *error);
+void _dbus_init_system_log (void);
+void _dbus_log_info (const char *msg, va_list args);
+void _dbus_log_security (const char *msg, va_list args);
+
/* 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.
*/