summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-connection.c4
-rw-r--r--dbus/dbus-credentials.h3
-rw-r--r--dbus/dbus-marshal-basic.c42
-rw-r--r--dbus/dbus-marshal-recursive.c2
-rw-r--r--dbus/dbus-marshal-validate-util.c3
-rw-r--r--dbus/dbus-marshal-validate.c83
-rw-r--r--dbus/dbus-message.c2
-rw-r--r--dbus/dbus-spawn.c4
-rw-r--r--dbus/dbus-sysdeps-unix.c48
-rw-r--r--dbus/dbus-sysdeps-util-unix.c149
-rw-r--r--dbus/dbus-sysdeps-util-win.c4
-rw-r--r--dbus/dbus-sysdeps.c4
-rw-r--r--dbus/dbus-sysdeps.h12
13 files changed, 300 insertions, 60 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index a960a991..ae07adf0 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -448,7 +448,7 @@ _dbus_connection_queue_received_message_link (DBusConnection *connection,
DBusList *link)
{
DBusPendingCall *pending;
- dbus_int32_t reply_serial;
+ dbus_uint32_t reply_serial;
DBusMessage *message;
_dbus_assert (_dbus_transport_get_is_authenticated (connection->transport));
@@ -459,7 +459,7 @@ _dbus_connection_queue_received_message_link (DBusConnection *connection,
/* If this is a reply we're waiting on, remove timeout for it */
reply_serial = dbus_message_get_reply_serial (message);
- if (reply_serial != -1)
+ if (reply_serial != 0)
{
pending = _dbus_hash_table_lookup_int (connection->pending_replies,
reply_serial);
diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h
index d4c8d160..8eed2bd2 100644
--- a/dbus/dbus-credentials.h
+++ b/dbus/dbus-credentials.h
@@ -47,6 +47,9 @@ dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials
dbus_uid_t uid);
dbus_bool_t _dbus_credentials_add_windows_sid (DBusCredentials *credentials,
const char *windows_sid);
+dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials *credentials,
+ void *audit_data,
+ dbus_int32_t size);
dbus_bool_t _dbus_credentials_include (DBusCredentials *credentials,
DBusCredentialType type);
dbus_pid_t _dbus_credentials_get_unix_pid (DBusCredentials *credentials);
diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c
index 0a33ff15..38fbe2d6 100644
--- a/dbus/dbus-marshal-basic.c
+++ b/dbus/dbus-marshal-basic.c
@@ -508,59 +508,74 @@ _dbus_marshal_read_basic (const DBusString *str,
int *new_pos)
{
const char *str_data;
- DBusBasicValue *vp;
_dbus_assert (dbus_type_is_basic (type));
str_data = _dbus_string_get_const_data (str);
- vp = value;
+ /* Below we volatile types to avoid aliasing issues;
+ * see http://bugs.freedesktop.org/show_bug.cgi?id=20137
+ */
+
switch (type)
{
case DBUS_TYPE_BYTE:
- vp->byt = _dbus_string_get_byte (str, pos);
+ {
+ volatile unsigned char *vp = value;
+ *vp = (unsigned char) _dbus_string_get_byte (str, pos);
(pos)++;
+ }
break;
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
+ {
+ volatile dbus_uint16_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 2);
- vp->u16 = *(dbus_uint16_t *)(str_data + pos);
+ *vp = *(dbus_uint16_t *)(str_data + pos);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
- vp->u16 = DBUS_UINT16_SWAP_LE_BE (vp->u16);
+ *vp = DBUS_UINT16_SWAP_LE_BE (*vp);
pos += 2;
+ }
break;
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
case DBUS_TYPE_BOOLEAN:
+ {
+ volatile dbus_uint32_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 4);
- vp->u32 = *(dbus_uint32_t *)(str_data + pos);
+ *vp = *(dbus_uint32_t *)(str_data + pos);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
- vp->u32 = DBUS_UINT32_SWAP_LE_BE (vp->u32);
+ *vp = DBUS_UINT32_SWAP_LE_BE (*vp);
pos += 4;
+ }
break;
case DBUS_TYPE_INT64:
case DBUS_TYPE_UINT64:
case DBUS_TYPE_DOUBLE:
+ {
+ volatile dbus_uint64_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 8);
#ifdef DBUS_HAVE_INT64
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
- vp->u64 = DBUS_UINT64_SWAP_LE_BE (*(dbus_uint64_t*)(str_data + pos));
+ *vp = DBUS_UINT64_SWAP_LE_BE (*(dbus_uint64_t*)(str_data + pos));
else
- vp->u64 = *(dbus_uint64_t*)(str_data + pos);
+ *vp = *(dbus_uint64_t*)(str_data + pos);
#else
- vp->u64 = *(DBus8ByteStruct*) (str_data + pos);
+ *vp = *(DBus8ByteStruct*) (str_data + pos);
swap_8_octets (vp, byte_order);
#endif
pos += 8;
+ }
break;
case DBUS_TYPE_STRING:
case DBUS_TYPE_OBJECT_PATH:
{
int len;
+ volatile char **vp = value;
len = _dbus_marshal_read_uint32 (str, pos, byte_order, &pos);
- vp->str = (char*) str_data + pos;
+ *vp = (char*) str_data + pos;
pos += len + 1; /* length plus nul */
}
@@ -568,11 +583,12 @@ _dbus_marshal_read_basic (const DBusString *str,
case DBUS_TYPE_SIGNATURE:
{
int len;
+ volatile char **vp = value;
len = _dbus_string_get_byte (str, pos);
pos += 1;
- vp->str = (char*) str_data + pos;
+ *vp = (char*) str_data + pos;
pos += len + 1; /* length plus nul */
}
@@ -1333,7 +1349,7 @@ _dbus_verbose_bytes (const unsigned char *data,
if (aligned != data)
{
- _dbus_verbose ("%4d\t%p: ", - (data - aligned), aligned);
+ _dbus_verbose ("%4ld\t%p: ", - (long)(data - aligned), aligned);
while (aligned != data)
{
_dbus_verbose (" ");
diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c
index 6c2902e2..76ee344f 100644
--- a/dbus/dbus-marshal-recursive.c
+++ b/dbus/dbus-marshal-recursive.c
@@ -1654,7 +1654,7 @@ writer_recurse_init_and_check (DBusTypeWriter *writer,
_dbus_type_to_string (expected),
_dbus_string_get_const_data (writer->type_str), writer->type_pos);
else
- _dbus_warn_check_failed ("Writing an element of type %s, but no value is expected here\n",
+ _dbus_warn_check_failed ("Writing an element of type %s, but no value is expected here\n"
"The overall signature expected here was '%s' and we are on byte %d of that signature.\n",
_dbus_type_to_string (sub->container_type),
_dbus_string_get_const_data (writer->type_str), writer->type_pos);
diff --git a/dbus/dbus-marshal-validate-util.c b/dbus/dbus-marshal-validate-util.c
index f2901d74..ac901c38 100644
--- a/dbus/dbus-marshal-validate-util.c
+++ b/dbus/dbus-marshal-validate-util.c
@@ -227,7 +227,8 @@ _dbus_marshal_validate_test (void)
"not a valid signature",
"123",
".",
- "("
+ "(",
+ "a{(ii)i}" /* https://bugs.freedesktop.org/show_bug.cgi?id=17803 */
};
/* Signature with reason */
diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
index e63a463b..ee955485 100644
--- a/dbus/dbus-marshal-validate.c
+++ b/dbus/dbus-marshal-validate.c
@@ -246,13 +246,15 @@ _dbus_validate_signature_with_reason (const DBusString *type_str,
}
}
- if (last == DBUS_DICT_ENTRY_BEGIN_CHAR &&
- !dbus_type_is_basic (*p))
+ if (last == DBUS_DICT_ENTRY_BEGIN_CHAR)
{
- result = DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
- goto out;
+ if (!(_dbus_type_is_valid (*p) && dbus_type_is_basic (*p)))
+ {
+ result = DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
+ goto out;
+ }
}
-
+
last = *p;
++p;
}
@@ -369,12 +371,30 @@ validate_body_helper (DBusTypeReader *reader,
/* p may now be == end */
_dbus_assert (p <= end);
-
+
if (current_type == DBUS_TYPE_ARRAY)
{
int array_elem_type = _dbus_type_reader_get_element_type (reader);
+
+ if (!_dbus_type_is_valid (array_elem_type))
+ {
+ return DBUS_INVALID_UNKNOWN_TYPECODE;
+ }
+
alignment = _dbus_type_get_alignment (array_elem_type);
- p = _DBUS_ALIGN_ADDRESS (p, alignment);
+
+ a = _DBUS_ALIGN_ADDRESS (p, alignment);
+
+ /* a may now be == end */
+ if (a > end)
+ return DBUS_INVALID_NOT_ENOUGH_DATA;
+
+ while (p != a)
+ {
+ if (*p != '\0')
+ return DBUS_INVALID_ALIGNMENT_PADDING_NOT_NUL;
+ ++p;
+ }
}
if (claimed_len > (unsigned long) (end - p))
@@ -405,6 +425,7 @@ validate_body_helper (DBusTypeReader *reader,
DBusTypeReader sub;
DBusValidity validity;
const unsigned char *array_end;
+ int array_elem_type;
if (claimed_len > DBUS_MAXIMUM_ARRAY_LENGTH)
return DBUS_INVALID_ARRAY_LENGTH_EXCEEDS_MAXIMUM;
@@ -417,16 +438,46 @@ validate_body_helper (DBusTypeReader *reader,
array_end = p + claimed_len;
- while (p < array_end)
+ array_elem_type = _dbus_type_reader_get_element_type (reader);
+
+ /* avoid recursive call to validate_body_helper if this is an array
+ * of fixed-size elements
+ */
+ if (dbus_type_is_fixed (array_elem_type))
+ {
+ /* bools need to be handled differently, because they can
+ * have an invalid value
+ */
+ if (array_elem_type == DBUS_TYPE_BOOLEAN)
+ {
+ dbus_uint32_t v;
+ alignment = _dbus_type_get_alignment (array_elem_type);
+
+ while (p < array_end)
+ {
+ v = _dbus_unpack_uint32 (byte_order, p);
+
+ if (!(v == 0 || v == 1))
+ return DBUS_INVALID_BOOLEAN_NOT_ZERO_OR_ONE;
+
+ p += alignment;
+ }
+ }
+
+ else
+ {
+ p = array_end;
+ }
+ }
+
+ else
{
- /* FIXME we are calling a function per array element! very bad
- * need if (dbus_type_is_fixed(elem_type)) here to just skip
- * big blocks of ints/bytes/etc.
- */
-
- validity = validate_body_helper (&sub, byte_order, FALSE, p, end, &p);
- if (validity != DBUS_VALID)
- return validity;
+ while (p < array_end)
+ {
+ validity = validate_body_helper (&sub, byte_order, FALSE, p, end, &p);
+ if (validity != DBUS_VALID)
+ return validity;
+ }
}
if (p != array_end)
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index cd447985..e2c4771e 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -1726,7 +1726,7 @@ _dbus_message_iter_init_common (DBusMessage *message,
*
* The easiest way to iterate is like this:
* @code
- * dbus_message_iter_init (&iter);
+ * dbus_message_iter_init (message, &iter);
* while ((current_type = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID)
* dbus_message_iter_next (&iter);
* @endcode
diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c
index 35ccba6c..f4e3b587 100644
--- a/dbus/dbus-spawn.c
+++ b/dbus/dbus-spawn.c
@@ -36,6 +36,8 @@
#include <errno.h>
#endif
+extern char **environ;
+
/**
* @addtogroup DBusInternalsUtils
* @{
@@ -914,8 +916,6 @@ do_exec (int child_err_report_fd,
if (envp == NULL)
{
- extern char **environ;
-
_dbus_assert (environ != NULL);
envp = environ;
diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
index 1e45649f..29d234a4 100644
--- a/dbus/dbus-sysdeps-unix.c
+++ b/dbus/dbus-sysdeps-unix.c
@@ -79,8 +79,8 @@
#define O_BINARY 0
#endif
-#ifndef _AI_ADDRCONFIG
-#define _AI_ADDRCONFIG 0
+#ifndef AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0
#endif
#ifndef HAVE_SOCKLEN_T
@@ -758,6 +758,7 @@ _dbus_connect_tcp_socket (const char *host,
const char *family,
DBusError *error)
{
+ int saved_errno = 0;
int fd = -1, res;
struct addrinfo hints;
struct addrinfo *ai, *tmp;
@@ -783,7 +784,7 @@ _dbus_connect_tcp_socket (const char *host,
else
{
dbus_set_error (error,
- _dbus_error_from_errno (errno),
+ DBUS_ERROR_BAD_ADDRESS,
"Unknown address family %s", family);
return -1;
}
@@ -814,6 +815,7 @@ _dbus_connect_tcp_socket (const char *host,
if (connect (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0)
{
+ saved_errno = errno;
_dbus_close(fd, NULL);
fd = -1;
tmp = tmp->ai_next;
@@ -827,9 +829,9 @@ _dbus_connect_tcp_socket (const char *host,
if (fd == -1)
{
dbus_set_error (error,
- _dbus_error_from_errno (errno),
+ _dbus_error_from_errno (saved_errno),
"Failed to connect to socket \"%s:%s\" %s",
- host, port, _dbus_strerror(errno));
+ host, port, _dbus_strerror(saved_errno));
return -1;
}
@@ -867,6 +869,7 @@ _dbus_listen_tcp_socket (const char *host,
int **fds_p,
DBusError *error)
{
+ int saved_errno;
int nlisten_fd = 0, *listen_fd = NULL, res, i;
struct addrinfo hints;
struct addrinfo *ai, *tmp;
@@ -885,7 +888,7 @@ _dbus_listen_tcp_socket (const char *host,
else
{
dbus_set_error (error,
- _dbus_error_from_errno (errno),
+ DBUS_ERROR_BAD_ADDRESS,
"Unknown address family %s", family);
return -1;
}
@@ -917,8 +920,9 @@ _dbus_listen_tcp_socket (const char *host,
if (bind (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0)
{
+ saved_errno = errno;
_dbus_close(fd, NULL);
- if (errno == EADDRINUSE)
+ if (saved_errno == EADDRINUSE)
{
/* Depending on kernel policy, it may or may not
be neccessary to bind to both IPv4 & 6 addresses
@@ -926,28 +930,30 @@ _dbus_listen_tcp_socket (const char *host,
tmp = tmp->ai_next;
continue;
}
- dbus_set_error (error, _dbus_error_from_errno (errno),
+ dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to bind socket \"%s:%s\": %s",
- host ? host : "*", port, _dbus_strerror (errno));
+ host ? host : "*", port, _dbus_strerror (saved_errno));
goto failed;
}
if (listen (fd, 30 /* backlog */) < 0)
{
+ saved_errno = errno;
_dbus_close (fd, NULL);
- dbus_set_error (error, _dbus_error_from_errno (errno),
+ dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to listen on socket \"%s:%s\": %s",
- host ? host : "*", port, _dbus_strerror (errno));
+ host ? host : "*", port, _dbus_strerror (saved_errno));
goto failed;
}
newlisten_fd = dbus_realloc(listen_fd, sizeof(int)*(nlisten_fd+1));
if (!newlisten_fd)
{
+ saved_errno = errno;
_dbus_close (fd, NULL);
- dbus_set_error (error, _dbus_error_from_errno (errno),
+ dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to allocate file handle array: %s",
- _dbus_strerror (errno));
+ _dbus_strerror (saved_errno));
goto failed;
}
listen_fd = newlisten_fd;
@@ -1493,7 +1499,11 @@ fill_user_info (DBusUserInfo *info,
/* retrieve maximum needed size for buf */
buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
- if (buflen <= 0)
+ /* sysconf actually returns a long, but everything else expects size_t,
+ * so just recast here.
+ * https://bugs.freedesktop.org/show_bug.cgi?id=17061
+ */
+ if ((long) buflen <= 0)
buflen = 1024;
result = -1;
@@ -2224,6 +2234,15 @@ _dbus_string_save_to_file (const DBusString *str,
total += bytes_written;
}
+ if (fsync(fd))
+ {
+ dbus_set_error (error, _dbus_error_from_errno (errno),
+ "Could not synchronize file %s: %s",
+ tmp_filename_c, _dbus_strerror (errno));
+
+ goto out;
+ }
+
if (!_dbus_close (fd, NULL))
{
dbus_set_error (error, _dbus_error_from_errno (errno),
@@ -2767,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 55eb9346..df9f7116 100644
--- a/dbus/dbus-sysdeps-util-unix.c
+++ b/dbus/dbus-sysdeps-util-unix.c
@@ -43,6 +43,8 @@
#include <sys/socket.h>
#include <dirent.h>
#include <sys/un.h>
+#include <syslog.h>
+#include <syslog.h>
#ifdef HAVE_LIBAUDIT
#include <sys/prctl.h>
#include <sys/capability.h>
@@ -69,12 +71,14 @@
* @param pidfile #NULL, or pidfile to create
* @param print_pid_pipe pipe to print daemon's pid to, or -1 for none
* @param error return location for errors
+ * @param keep_umask #TRUE to keep the original umask
* @returns #FALSE on failure
*/
dbus_bool_t
_dbus_become_daemon (const DBusString *pidfile,
DBusPipe *print_pid_pipe,
- DBusError *error)
+ DBusError *error,
+ dbus_bool_t keep_umask)
{
const char *s;
pid_t child_pid;
@@ -121,9 +125,12 @@ _dbus_become_daemon (const DBusString *pidfile,
_dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n");
}
- /* Get a predictable umask */
- _dbus_verbose ("setting umask\n");
- umask (022);
+ if (!keep_umask)
+ {
+ /* Get a predictable umask */
+ _dbus_verbose ("setting umask\n");
+ umask (022);
+ }
_dbus_verbose ("calling setsid()\n");
if (setsid () == -1)
@@ -451,6 +458,38 @@ _dbus_change_to_daemon_user (const char *user,
return FALSE;
}
+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
@@ -836,7 +875,11 @@ fill_group_info (DBusGroupInfo *info,
/* retrieve maximum needed size for buf */
buflen = sysconf (_SC_GETGR_R_SIZE_MAX);
- if (buflen <= 0)
+ /* sysconf actually returns a long, but everything else expects size_t,
+ * so just recast here.
+ * https://bugs.freedesktop.org/show_bug.cgi?id=17061
+ */
+ if ((long) buflen <= 0)
buflen = 1024;
result = -1;
@@ -1096,3 +1139,99 @@ _dbus_string_get_dirname (const DBusString *filename,
}
/** @} */ /* DBusString stuff */
+static void
+string_squash_nonprintable (DBusString *str)
+{
+ char *buf;
+ int i, len;
+
+ buf = _dbus_string_get_data (str);
+ len = _dbus_string_get_length (str);
+
+ for (i = 0; i < len; i++)
+ if (buf[i] == '\0')
+ buf[i] = ' ';
+ else if (buf[i] < 0x20 || buf[i] > 127)
+ buf[i] = '?';
+}
+
+/**
+ * Get a printable string describing the command used to execute
+ * the process with pid. This string should only be used for
+ * informative purposes such as logging; it may not be trusted.
+ *
+ * The command is guaranteed to be printable ASCII and no longer
+ * than max_len.
+ *
+ * @param pid Process id
+ * @param str Append command to this string
+ * @param max_len Maximum length of returned command
+ * @param error return location for errors
+ * @returns #FALSE on error
+ */
+dbus_bool_t
+_dbus_command_for_pid (unsigned long pid,
+ DBusString *str,
+ int max_len,
+ DBusError *error)
+{
+ /* This is all Linux-specific for now */
+ DBusString path;
+ DBusString cmdline;
+ int fd;
+
+ if (!_dbus_string_init (&path))
+ {
+ _DBUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ if (!_dbus_string_init (&cmdline))
+ {
+ _DBUS_SET_OOM (error);
+ _dbus_string_free (&path);
+ return FALSE;
+ }
+
+ if (!_dbus_string_append_printf (&path, "/proc/%ld/cmdline", pid))
+ goto oom;
+
+ fd = open (_dbus_string_get_const_data (&path), O_RDONLY);
+ if (fd < 0)
+ {
+ dbus_set_error (error,
+ _dbus_error_from_errno (errno),
+ "Failed to open \"%s\": %s",
+ _dbus_string_get_const_data (&path),
+ _dbus_strerror (errno));
+ goto fail;
+ }
+
+ if (!_dbus_read (fd, &cmdline, max_len))
+ {
+ dbus_set_error (error,
+ _dbus_error_from_errno (errno),
+ "Failed to read from \"%s\": %s",
+ _dbus_string_get_const_data (&path),
+ _dbus_strerror (errno));
+ goto fail;
+ }
+
+ if (!_dbus_close (fd, error))
+ goto fail;
+
+ string_squash_nonprintable (&cmdline);
+
+ if (!_dbus_string_copy (&cmdline, 0, str, _dbus_string_get_length (str)))
+ goto oom;
+
+ _dbus_string_free (&cmdline);
+ _dbus_string_free (&path);
+ return TRUE;
+oom:
+ _DBUS_SET_OOM (error);
+fail:
+ _dbus_string_free (&cmdline);
+ _dbus_string_free (&path);
+ return FALSE;
+} \ No newline at end of file
diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c
index 8608ad0e..6358531b 100644
--- a/dbus/dbus-sysdeps-util-win.c
+++ b/dbus/dbus-sysdeps-util-win.c
@@ -70,12 +70,14 @@ errno_t strcpy_s(char *dest, size_t size, char *src)
* @param pidfile #NULL, or pidfile to create
* @param print_pid_fd file descriptor to print daemon's pid to, or -1 for none
* @param error return location for errors
+ * @param keep_umask #TRUE to keep the original umask
* @returns #FALSE on failure
*/
dbus_bool_t
_dbus_become_daemon (const DBusString *pidfile,
DBusPipe *print_pid_pipe,
- DBusError *error)
+ DBusError *error,
+ dbus_bool_t keep_umask)
{
return TRUE;
}
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index d740f875..00a1a3de 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -51,6 +51,8 @@ _DBUS_DEFINE_GLOBAL_LOCK (win_fds);
_DBUS_DEFINE_GLOBAL_LOCK (sid_atom_cache);
_DBUS_DEFINE_GLOBAL_LOCK (system_users);
+extern char **environ;
+
/**
* @defgroup DBusSysdeps Internal system-dependent API
* @ingroup DBusInternals
@@ -191,7 +193,6 @@ _dbus_clearenv (void)
if (clearenv () != 0)
rc = FALSE;
#else
- extern char **environ;
if (environ != NULL)
environ[0] = NULL;
@@ -210,7 +211,6 @@ char **
_dbus_get_environment (void)
{
int i, length;
- extern char **environ;
char **environment;
_dbus_assert (environ != NULL);
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index 80236f05..b766f3f9 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -400,7 +400,8 @@ void _dbus_print_backtrace (void);
dbus_bool_t _dbus_become_daemon (const DBusString *pidfile,
DBusPipe *print_pid_pipe,
- DBusError *error);
+ DBusError *error,
+ 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,
@@ -411,6 +412,11 @@ dbus_bool_t _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile,
dbus_pid_t pid_to_write,
DBusError *error);
+dbus_bool_t _dbus_command_for_pid (unsigned long pid,
+ DBusString *str,
+ int max_len,
+ DBusError *error);
+
/** A UNIX signal handler */
typedef void (* DBusSignalHandler) (int sig);
@@ -420,6 +426,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.
*/