platform/upstream/dbus.git
10 years agoDefine WIN32_LEAN_AND_MEAN in Windows port
Matt Fischer [Fri, 8 Nov 2013 22:08:39 +0000 (16:08 -0600)]
Define WIN32_LEAN_AND_MEAN in Windows port

<windows.h> somewhat cloyingly attempts to include <winsock.h>
by default, which causes problems if the rest of the program
is trying to use the incompatible <winsock2.h>.  The Windows
sysdep header attempts to prevent this by forcibly defining
the winsock header guard macro, so that it will not be included.
However, this does not work on MinGW because it uses a different
guard macro name.

This patch changes the code to instead define WIN32_LEAN_AND_MEAN,
which is a more portable way to ensure that <winsock.h> will not
be included.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71405
Reviewed-By: Ralf Habacker <ralf.habacker@freenet.de>
10 years agodbus-daemon(1): align document about "bind" with DBus Spec
Chengwei Yang [Tue, 10 Dec 2013 02:06:23 +0000 (10:06 +0800)]
dbus-daemon(1): align document about "bind" with DBus Spec

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoDBus Spec: add document of bind for tcp/nonce-tcp transport
Chengwei Yang [Tue, 10 Dec 2013 02:02:27 +0000 (10:02 +0800)]
DBus Spec: add document of bind for tcp/nonce-tcp transport

tcp/nonce-tcp transport has a "bind" key, which can be specified a
hostname and will override hostname specified in "host" key.

"bind" has a special value "*" which means ip address 0.0.0.0 and will
cause dbus-daemon listen on all interfaces.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoDBus Spec: replace tab with 8 spaces
Chengwei Yang [Fri, 6 Dec 2013 03:15:12 +0000 (11:15 +0800)]
DBus Spec: replace tab with 8 spaces

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72301
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoEnsure DBusError is set if _dbus_read_nonce() fail
Chengwei Yang [Fri, 6 Dec 2013 02:53:28 +0000 (10:53 +0800)]
Ensure DBusError is set if _dbus_read_nonce() fail

In _dbus_send_nonce() which call in _dbus_read_nonce() and assert on an
error is set if _dbus_read_nonce() fail. However, in _dbus_read_nonce(),
it may fail on fopen() and left error is unset. This will crash us if
assertions hasn't been disabled.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72298
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agokqueue: open watched directories with close-on-exec flag
Chengwei Yang [Mon, 2 Dec 2013 04:47:47 +0000 (12:47 +0800)]
kqueue: open watched directories with close-on-exec flag

[FreeBSD and OpenBSD contributors clarified that O_CLOEXEC has been
supported for ~ 2 years on both, so for the moment we're assuming
that every platform with kqueue also has working O_CLOEXEC. Please reopen
the bug, with a tested patch that uses _dbus_fd_set_close_on_exec() instead,
if this assumption turns out to be false. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72213
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoBusTransaction: remove confusing getter of connections
Chengwei Yang [Thu, 28 Nov 2013 01:17:38 +0000 (09:17 +0800)]
BusTransaction: remove confusing getter of connections

There is a DBusList* member of BusTransaction named "connections", while
its getter function bus_transaction_get_connections() returns
context->connections which in fact is a BusConnections pointer, this is
quite confusing. Because this is what bus_context_get_connections()
returns.

This patch call out to bus_context_get_connections() directly and remove
the then unused bus_transaction_get_connections().

https://bugs.freedesktop.org/show_bug.cgi?id=71597
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years ago_dbus_auth_return_buffer(): remove unused argument
Chengwei Yang [Mon, 11 Nov 2013 09:52:26 +0000 (17:52 +0800)]
_dbus_auth_return_buffer(): remove unused argument

The argument bytes_read of _dbus_auth_return_buffer() function isn't
used at all, so remove it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71477
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years ago_dbus_listen_unix_socket: don't try to set SO_REUSEADDR
Simon McVittie [Fri, 1 Nov 2013 13:51:13 +0000 (13:51 +0000)]
_dbus_listen_unix_socket: don't try to set SO_REUSEADDR

On Hurd, the setsockopt() fails. Svante Signell confirmed that on
at least Linux and kFreeBSD, SO_REUSEADDR "succeeds" on Unix sockets,
but doesn't have any practical effect; so rather than making the
failure not issue a warning, we might as well not bother with the
syscall at all.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years ago_dbus_read_credentials_socket: look at all cmsg headers, not just the first
Simon McVittie [Mon, 6 Jan 2014 15:55:35 +0000 (15:55 +0000)]
_dbus_read_credentials_socket: look at all cmsg headers, not just the first

If there are no cmsg headers, don't fail: this fixes receiving credentials
on TCP sockets under at least GNU/kFreeBSD, and probably FreeBSD too.

If there's more than one cmsg header, ignore any that don't look like
valid SCM_CREDS.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492
Tested-by: Svante Signell
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[added break, altered indentation in response to review -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoIf sendmsg() with SCM_CREDS fails with EINVAL, retry with send()
Simon McVittie [Wed, 18 Sep 2013 16:51:53 +0000 (17:51 +0100)]
If sendmsg() with SCM_CREDS fails with EINVAL, retry with send()

Perhaps some OSs accept and ignore attempts to send a SCM_CREDS
message on a non-Unix socket, but GNU/kFreeBSD doesn't (and presumably
FreeBSD doesn't either).

Based on a patch by Svante Signell.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69492
Tested-by: Svante Signell
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoFix memory leak for kqueue: shutdown kqueue correctly
Chengwei Yang [Tue, 3 Dec 2013 12:47:54 +0000 (20:47 +0800)]
Fix memory leak for kqueue: shutdown kqueue correctly

There are memory blocks leak when doing bus-test, both dispatch-sha1 and
dispatch test cases complain memory blocks leak.

This patch also fix fd leaks.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69332
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agokqueue: replace tab with space
Chengwei Yang [Sun, 1 Dec 2013 11:40:21 +0000 (19:40 +0800)]
kqueue: replace tab with space

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69332
[altered commit message to not say it fixes memory leaks -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoMake sure tests run with a temporary XDG_RUNTIME_DIR
Simon McVittie [Tue, 19 Feb 2013 16:39:38 +0000 (16:39 +0000)]
Make sure tests run with a temporary XDG_RUNTIME_DIR

We don't want the regression tests' "session" getting mixed up in
system-wide "sessions". This doesn't actually matter yet, but it is
likely to matter in future.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[merged with earlier line-wrapping of TESTS_ENVIRONMENT -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoReload policy rules for completed connections
Chengwei Yang [Tue, 10 Dec 2013 09:11:25 +0000 (17:11 +0800)]
Reload policy rules for completed connections

The message bus which can monitor its conf dirs for changes and reload
confs immediately if dir monitor enabled, for example, inotify in Linux,
kqueue in *BSD.

However, it doesn't apply policy rules change for completed connections,
so to apply policy rules change, the client connection has to disconnect
first and then re-connect to message bus.

For imcomplete connections, it always has the latest review of policy
rules.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39463
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years ago_dbus_check_dir_is_private_to_user: check that we own it
Simon McVittie [Tue, 19 Feb 2013 15:40:06 +0000 (15:40 +0000)]
_dbus_check_dir_is_private_to_user: check that we own it

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agospecification: discuss "listenable" and "connectable" addresses
Simon McVittie [Tue, 19 Feb 2013 13:45:50 +0000 (13:45 +0000)]
specification: discuss "listenable" and "connectable" addresses

The --with-dbus-session-bus-connect-address configure option and the
DBUS_SESSION_BUS_CONNECT_ADDRESS CMake variable expect a connectable
address, while the --with-dbus-session-bus-listen-address option and
the DBUS_SESSION_BUS_LISTEN_ADDRESS variable expect a listenable address.

DBUS_SYSTEM_BUS_DEFAULT_ADDRESS currently has to be an address that
is simultaneously listenable and connectable.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61303
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
[fixed name of DBUS_SESSION_BUS_CONNECT_ADDRESS as per review -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoNEWS
Simon McVittie [Wed, 27 Nov 2013 16:40:22 +0000 (16:40 +0000)]
NEWS

10 years agocmake: update README.cmake a bit
Chengwei Yang [Tue, 2 Jul 2013 01:28:02 +0000 (09:28 +0800)]
cmake: update README.cmake a bit

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
10 years agocmake: fix code style
Chengwei Yang [Tue, 2 Jul 2013 01:27:48 +0000 (09:27 +0800)]
cmake: fix code style

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
10 years ago_dbus_append_address_from_socket(): escape value got from socket fd
Chengwei Yang [Wed, 20 Nov 2013 14:25:52 +0000 (22:25 +0800)]
_dbus_append_address_from_socket(): escape value got from socket fd

So far, this bug can be triggered in systemd environment, if the
configured ListenStream for dbus.socket has characters must be escaped
first. Then we'll get an error like
  "In D-Bus address, character '%c' should have been escaped\n"

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46013
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agospec: explicitly mention filtering messages with no INTERFACE
Simon McVittie [Mon, 16 Sep 2013 13:17:25 +0000 (14:17 +0100)]
spec: explicitly mention filtering messages with no INTERFACE

This is an important security measure. Without it, the system bus
would not deliver its intended security properties. The actual
implementation has always behaved like this, I think.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68597
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoDo not require messages without INTERFACE to be dispatched
Simon McVittie [Mon, 16 Sep 2013 13:16:13 +0000 (14:16 +0100)]
Do not require messages without INTERFACE to be dispatched

Previously, if we have interfaces:

    interface com.example.foo:
        method Ambiguous()
    interface com.example.bar:
        method Ambiguous()
        method Unambiguous()

implementations were required to deliver a message with no INTERFACE
and METHOD=Unambiguous to "bar". A message with no INTERFACE and
METHOD=Ambiguous could either be delivered to "foo", delivered to "bar"
or treated as an error.

Relax this to allow an error for the unambiguous case, too, and
strongly recommend specifying the interface (which is best-practice).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68597
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Vaguely-acked-by: Thiago Macieira, David Zeuthen
[and desrt objected that it didn't go far enough]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoSupport printing unix file descriptors in dbus-send/dbus-monitor
Robert Ancell [Fri, 18 Oct 2013 00:46:45 +0000 (13:46 +1300)]
Support printing unix file descriptors in dbus-send/dbus-monitor

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70592
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoRemove duplicate checking for pkg-config
Chengwei Yang [Mon, 25 Nov 2013 12:53:44 +0000 (20:53 +0800)]
Remove duplicate checking for pkg-config

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71985
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoFix api doc for _dbus_spawn_async_with_babysitter
Chengwei Yang [Tue, 19 Nov 2013 10:13:01 +0000 (18:13 +0800)]
Fix api doc for _dbus_spawn_async_with_babysitter

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71820
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoFix dbus_shutdown API document: returns --> frees
Chengwei Yang [Fri, 15 Nov 2013 01:20:31 +0000 (09:20 +0800)]
Fix dbus_shutdown API document: returns --> frees

https://bugs.freedesktop.org/show_bug.cgi?id=71627
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoFix for MinGW build
Matt Fischer [Fri, 8 Nov 2013 00:00:46 +0000 (18:00 -0600)]
Fix for MinGW build

dbus-sysdeps-win.c makes use of a constant called
PROCESS_QUERY_LIMITED_INFORMATION, which was added after Windows
XP.  There is code present to make sure the constant is not used
when running on an XP system, but the constant is still required
at build time.  Unfortunately, the Windows headers provided by
MinGW are old enough that they do not contain this constant, so
building with MinGW fails.

This patch adds a definition for the constant if one is not already
present.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71366
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[altered comment to specify MinGW32 < 4, since mingw-w64
and MinGW 4.0+ do have this constant -smcv]

10 years agoMerge branch 'dbus-1.6'
Simon McVittie [Tue, 12 Nov 2013 10:55:43 +0000 (10:55 +0000)]
Merge branch 'dbus-1.6'

10 years agoNEWS for the SELinux change
Simon McVittie [Tue, 12 Nov 2013 10:51:17 +0000 (10:51 +0000)]
NEWS for the SELinux change

10 years agoNEWS
Simon McVittie [Tue, 12 Nov 2013 10:47:55 +0000 (10:47 +0000)]
NEWS

10 years agofixed memory freeing if error during listing services
Radoslaw Pajak [Fri, 8 Nov 2013 12:51:32 +0000 (13:51 +0100)]
fixed memory freeing if error during listing services

Signed-off-by: Radoslaw Pajak <r.pajak@samsung.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71526

10 years agoselinux: Use selinux_set_mapping() to avoid hardcoded constants for policy
osmond sun [Tue, 5 Nov 2013 16:53:18 +0000 (00:53 +0800)]
selinux: Use selinux_set_mapping() to avoid hardcoded constants for policy

Previous to the introduction of selinux_set_mapping(), DBus pulled
constants generated from the system's policy at build time.  But this
means it's impossible to replace the system policy without rebuilding
userspace components.

This patch maps from arbitrary class/perm indices used by D-Bus and
the policy values and handles all the translation at runtime on
avc_has_perm() calls.

Bug: https://bugs.freedesktop.org/attachment.cgi?id=88719
Reviewed-By: Colin Walters <walters@verbum.org>
Tested-By: Colin Walters <walters@verbum.org>
10 years agoMerge branch 'dbus-1.6'
Simon McVittie [Mon, 4 Nov 2013 12:00:24 +0000 (12:00 +0000)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS

10 years agoNEWS
Simon McVittie [Mon, 4 Nov 2013 11:44:34 +0000 (11:44 +0000)]
NEWS

10 years agomake_and_run_test_nodes: avoid undefined behaviour
DreamNik [Sun, 29 Sep 2013 10:45:58 +0000 (14:45 +0400)]
make_and_run_test_nodes: avoid undefined behaviour

In code that looks like n[i] = v(&i), where v increments i, C leaves it
undefined whether the old or new value of i is used to locate n[i].
As it happens, gcc used the pre-increment value of i, but MSVC
used the post-increment value.

Fix this by inserting a sequence point to disambiguate the intended order.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69924
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[wrote commit message, fixed whitespace -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agostart on 1.7.10
Simon McVittie [Fri, 1 Nov 2013 20:17:52 +0000 (20:17 +0000)]
start on 1.7.10

10 years agostart dbus-specification 0.23
Simon McVittie [Thu, 10 Oct 2013 12:14:01 +0000 (13:14 +0100)]
start dbus-specification 0.23

10 years ago1.7.8
Simon McVittie [Fri, 1 Nov 2013 19:17:02 +0000 (19:17 +0000)]
1.7.8

10 years agobus/selinux: Fix previous commit for CAP_AUDIT_WRITE retention
Colin Walters [Sun, 27 Oct 2013 20:21:19 +0000 (16:21 -0400)]
bus/selinux: Fix previous commit for CAP_AUDIT_WRITE retention

As soon as capng_clear() is called, we won't appear to have
CAP_AUDIT_WRITE.  Fix this by checking for it before resetting the
libcap state.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49062
Tested-by: Laurent Bigonville <bigon@debian.org>
Reviewed-by: Laurent Bigonville <bigon@debian.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Lennart Poettering <lennart@poettering.net>
10 years agoRevert "start dbus-specification 0.23"
Simon McVittie [Fri, 1 Nov 2013 18:49:48 +0000 (18:49 +0000)]
Revert "start dbus-specification 0.23"

This reverts commit c8bc5f24b721bc03679c44669cf5e655c1e99b5f.
Nothing changed since 0.22.

10 years agoMerge branch 'dbus-1.6'
Simon McVittie [Fri, 1 Nov 2013 18:49:13 +0000 (18:49 +0000)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS
configure.ac

10 years agoStart on 1.6.20
Simon McVittie [Fri, 1 Nov 2013 18:44:21 +0000 (18:44 +0000)]
Start on 1.6.20

10 years ago1.6.18 dbus-1.6.18
Simon McVittie [Fri, 1 Nov 2013 16:24:22 +0000 (16:24 +0000)]
1.6.18

10 years agoClose unused inherited file descriptor
Chengwei Yang [Tue, 15 Oct 2013 05:23:09 +0000 (13:23 +0800)]
Close unused inherited file descriptor

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68559
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoAdd comments describing how "compile with journald, run without" works
Simon McVittie [Fri, 1 Nov 2013 12:43:07 +0000 (12:43 +0000)]
Add comments describing how "compile with journald, run without" works

10 years agoHandle activated child stdout/stderr correctly in systemd environment
Chengwei Yang [Tue, 15 Oct 2013 05:27:51 +0000 (13:27 +0800)]
Handle activated child stdout/stderr correctly in systemd environment

In systemd environment, dbus-daemon will run as no-fork mode since this
is the recommended practice of systemd.

In that scenario, child activated by dbus-daemon will inherit
dbus-daemon standard streams, includes stdin/stdout/stderr. stdin will
be redirected to /dev/null by systemd and stdout/stderr will be catched
by systemd log subsystem. Since the child inherit stdout/stderr from
dbus-daemon, so from systemd journal log, the child log output will be
identified with dbus-daemon identifier. So it's a little confusing.

This patch redirects the child stdout/stderr to systemd journal stream,
and with its owned service name as identifier. However, thing not fixed
perfectly due to the socket ucred of the child is owned by dbus-daemon,
so the pid isn't the real pid of the chile.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68559
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoDBusBabysitter: change executable to log_name
Chengwei Yang [Tue, 15 Oct 2013 05:04:53 +0000 (13:04 +0800)]
DBusBabysitter: change executable to log_name

DBusBabysitter->executable is defined as executable name to use in error
messages. However, if servicehelper used, then the executable name is
servicehelper. It's not much help because we couldn't figure out which
service we're trying to activated if error happens.

In the following patch, we'll use service name to be activated as the
child log identifier and add a parameter to
_dbus_spawn_async_with_babysitter() to pass the log identifier.  Since
this is not the case in test, so executable changed to log_name.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68559
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoUpdate configurable elements for dbus-daemon manual
Chengwei Yang [Fri, 13 Sep 2013 12:37:56 +0000 (20:37 +0800)]
Update configurable elements for dbus-daemon manual

Update three configurable elements for dbus-daemon manual, <syslog>,
<pidfile> and <allow_anonymous>, all of them are undocumented so far.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69125
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoRemove unnecessary dbus_setenv()
Chengwei Yang [Wed, 9 Oct 2013 01:39:43 +0000 (09:39 +0800)]
Remove unnecessary dbus_setenv()

DBUS_ACTIVATION_ADDRESS changed to DBUS_STARTER_ADDRESS and
DBUS_ACTIVATION_BUS_TYPE changed to DBUS_STARTER_BUS_TYPE since 2005 by
this commit - 8873c90

So the dbus_setenv() which used to unset the above two wrong environment
variables has no effect in fact. And giving that setenv(3) and putenv(3)
are not threadsafe, so it's better to remove them.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68308
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Acked-by: Colin Walters <walters@verbum.org>
10 years agotransaction_free: factor out
Simon McVittie [Wed, 28 Nov 2012 17:11:38 +0000 (17:11 +0000)]
transaction_free: factor out

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60859
Reviewed-by: Chengwei Yang
[removed unused variable based on review -smcv]

10 years agodbus-spawn: draw a diagram
Simon McVittie [Fri, 1 Nov 2013 11:43:57 +0000 (11:43 +0000)]
dbus-spawn: draw a diagram

There are enough pipes, fds and processes here that it's important to
keep track of them.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60859

10 years agoUse SIGHUP without check in UNIX environment
Chengwei Yang [Fri, 1 Nov 2013 08:23:27 +0000 (16:23 +0800)]
Use SIGHUP without check in UNIX environment

As Simon's comment
  https://bugs.freedesktop.org/show_bug.cgi?id=66068#c8
we can do this in UNIX environment.

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoTest: add test cases for message parsing
Chengwei Yang [Tue, 29 Oct 2013 02:27:11 +0000 (10:27 +0800)]
Test: add test cases for message parsing

Add test cases for testing:
  * If more arguments than requested are present, the requested
    arguments are returned and the extra arguments are ignored.
  * If arguments parse failed, ensure we didn't leak any memory or unix
    fd

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=21259
[added a check for fd leaks around verify_test_message_args_ignored() -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoFix memory or unix fd may leak in dbus_message_iter_get_args_valist
Chengwei Yang [Tue, 29 Oct 2013 14:20:00 +0000 (22:20 +0800)]
Fix memory or unix fd may leak in dbus_message_iter_get_args_valist

This is an aged bug since 2009, so let's fix it. Say if a previous
parsing for unix fd or array of string successfully but then a later
element parsing fail, then the unix fd or array of string leaked.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=21259
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoCorrectly set number of arguments already handled
Chengwei Yang [Fri, 11 Oct 2013 08:35:17 +0000 (16:35 +0800)]
Correctly set number of arguments already handled

At privous, which increments the number of arguments already handled in
the last of loop, however, if there is any invalid argument, then it
will "goto out" and the number of arguments already handled is now
incorrect.

A following patch will use the number of arguments already handled as a
loop terminate condition, so it's good to fix it before.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=21259
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agodbus-spawn: correct a comment that falsely claimed thread-safety
Simon McVittie [Mon, 3 Dec 2012 17:43:31 +0000 (17:43 +0000)]
dbus-spawn: correct a comment that falsely claimed thread-safety

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60859
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years ago_dbus_spawn_async_with_babysitter: correct documentation
Simon McVittie [Mon, 3 Dec 2012 17:31:37 +0000 (17:31 +0000)]
_dbus_spawn_async_with_babysitter: correct documentation

env is used as you'd expect now.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60859
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoMerge branch 'dbus-1.6'
Simon McVittie [Wed, 23 Oct 2013 16:15:56 +0000 (17:15 +0100)]
Merge branch 'dbus-1.6'

10 years agopath_namespace='/' should match everything
Simon McVittie [Wed, 23 Oct 2013 14:19:13 +0000 (15:19 +0100)]
path_namespace='/' should match everything

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70799
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Ryan Lortie <desrt@desrt.ca>
10 years ago$(in_data) is meant to contain the .in files
Simon McVittie [Thu, 10 Oct 2013 15:59:11 +0000 (16:59 +0100)]
$(in_data) is meant to contain the .in files

Reviewed-by: Colin Walters
10 years agotest: Update build for previous commit
Colin Walters [Thu, 10 Oct 2013 15:55:36 +0000 (11:55 -0400)]
test: Update build for previous commit

It should now be in in_data so we find it in $(srcdir).

10 years agoUse TEST_LISTEN in incoming-listen.conf.in instead of unix only hardcoded address
Ralf Habacker [Wed, 9 Oct 2013 22:45:15 +0000 (00:45 +0200)]
Use TEST_LISTEN in incoming-listen.conf.in instead of unix only hardcoded address

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agostart dbus-specification 0.23
Simon McVittie [Thu, 10 Oct 2013 12:14:01 +0000 (13:14 +0100)]
start dbus-specification 0.23

10 years agostart 1.7.8
Simon McVittie [Wed, 9 Oct 2013 17:47:14 +0000 (18:47 +0100)]
start 1.7.8

10 years agoD-Bus 1.7.6, spec 0.22
Simon McVittie [Wed, 9 Oct 2013 10:34:14 +0000 (11:34 +0100)]
D-Bus 1.7.6, spec 0.22

10 years agoyet more NEWS
Simon McVittie [Wed, 9 Oct 2013 10:27:55 +0000 (11:27 +0100)]
yet more NEWS

10 years agodbus-monitor: keep backwards compatibility
Chengwei Yang [Wed, 9 Oct 2013 02:44:12 +0000 (10:44 +0800)]
dbus-monitor: keep backwards compatibility

eavesdropping as a match rule key introduced in DBus 1.5.6, and the
privous implementation doesn't keep backwards compatibility with older
dbus-daemon.

And the reference dbus-daemon implementation just fail if unknwon key
found in match rule, this is undefined hehavior in DBus Sepcification.

Also there is a feature request for change this hehavior to
"ignore unknown key in match rule", See
https://bugs.freedesktop.org/show_bug.cgi?id=66114

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66107
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agodbus-send: replace --address with --peer and --bus.
Andrey Mazo [Tue, 8 Oct 2013 14:54:11 +0000 (15:54 +0100)]
dbus-send: replace --address with --peer and --bus.

--peer is a direct substitute for --address.
With --bus dbus-send registers on bus given by ADDRESS, thus allowing
messages to be sent to the bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
[adjusted to apply to current master -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoRevert "dbus-send: replace --address"... to fix attribution
Simon McVittie [Wed, 9 Oct 2013 10:17:20 +0000 (11:17 +0100)]
Revert "dbus-send: replace --address"... to fix attribution

This reverts commit 5b74af796c8f1d9f3f60594f22c6bfd4c097ad8b.

10 years agoRemove unused key-word of DBus .service file
Chengwei Yang [Wed, 9 Oct 2013 02:06:52 +0000 (10:06 +0800)]
Remove unused key-word of DBus .service file

Key-word "Group" of DBus .service file hasn't been used since it was
introduced in 2007, so it's fine to remove it.

https://bugs.freedesktop.org/show_bug.cgi?id=19158
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agolaunch-helper: fix error code parsing
Chengwei Yang [Wed, 9 Oct 2013 00:50:37 +0000 (08:50 +0800)]
launch-helper: fix error code parsing

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66728
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoMerge branch 'dbus-1.6'
Simon McVittie [Tue, 8 Oct 2013 17:42:12 +0000 (18:42 +0100)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS
configure.ac

10 years ago1.6.17
Simon McVittie [Tue, 8 Oct 2013 16:33:56 +0000 (17:33 +0100)]
1.6.17

10 years agoSpec: document multiple .service files own the same well known name
Chengwei Yang [Tue, 8 Oct 2013 12:55:03 +0000 (20:55 +0800)]
Spec: document multiple .service files own the same well known name

In current dbus-daemon(1) implement, system .serivce must named after
its owned name, but this is not the case for session .service.

For session service, the result of multiple .service files own the
same well known name is undefined since readdir(3) doesn't return
dirent in a defined sequence.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66608
[added some </para><para> -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoUnify the way to find dbus-daemon test binary
Chengwei Yang [Tue, 8 Oct 2013 13:59:37 +0000 (21:59 +0800)]
Unify the way to find dbus-daemon test binary

There are two ways to find the dbus-daemon for testing. The first one is
defined as string at compile stage and the second one is export it from
test environment.

The first way has limitation that after defined, it's static string, so
it's impossible to run installable check. So let's unify to the second
way.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849
[added missing "}" -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agodbus-send: replace --address with --peer and --bus.
Simon McVittie [Tue, 8 Oct 2013 14:54:11 +0000 (15:54 +0100)]
dbus-send: replace --address with --peer and --bus.

--peer is a direct substitute for --address.
With --bus dbus-send registers on bus given by ADDRESS, thus allowing
messages to be sent to the bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
[adjusted to apply to current master -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years ago1.6.14
Simon McVittie [Tue, 8 Oct 2013 12:26:17 +0000 (13:26 +0100)]
1.6.14

10 years agofix off by one error message (#13305)
Chengwei Yang [Sun, 29 Sep 2013 10:10:33 +0000 (18:10 +0800)]
fix off by one error message (#13305)

This patch is based on the patch created by John (J5) Palmieri
<johnp@redhat.com> plus to fix array of string assignment.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=13305
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agodbus-message.c: unused variable bytes_read in _dbus_message_loader_get_buffer
Vasiliy Balyasnyy [Tue, 8 Oct 2013 09:36:38 +0000 (13:36 +0400)]
dbus-message.c: unused variable bytes_read in _dbus_message_loader_get_buffer

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70218
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agodbus-monitor: remove redundant match rules
Chengwei Yang [Wed, 26 Jun 2013 02:21:31 +0000 (10:21 +0800)]
dbus-monitor: remove redundant match rules

Currently, DBus Specification only consists of four message types, so to
monitor all the types of message, no need to match all of them but just
left it empty is OK.

Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66107
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoNEWS
Simon McVittie [Tue, 8 Oct 2013 09:36:39 +0000 (10:36 +0100)]
NEWS

10 years agospec: briefly describe Name, Exec and User keys
Simon McVittie [Mon, 16 Sep 2013 13:36:21 +0000 (14:36 +0100)]
spec: briefly describe Name, Exec and User keys

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66608
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agospec: system services' service description files have constrained names
Simon McVittie [Mon, 16 Sep 2013 13:33:41 +0000 (14:33 +0100)]
spec: system services' service description files have constrained names

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66608
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoDo not suggest user the next step after executed autogen.sh
Chengwei Yang [Tue, 24 Sep 2013 13:25:01 +0000 (21:25 +0800)]
Do not suggest user the next step after executed autogen.sh

We assume that user/developer who building dbus from source code are
familiar with the standard 'autogen.sh, configure, make, make install'
build process, so print such a notice doesn't make a lot of sense.

In addition, on *BSD platform, the pre-installed 'make' doesn't work at
all since gnu make is required. However, it named to 'gmake' on *BSD
platform. So the notice will makes new comer confused.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65415
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoAdd support for configuring --with-valgrind=auto
Simon McVittie [Fri, 12 Oct 2012 12:53:25 +0000 (13:53 +0100)]
Add support for configuring --with-valgrind=auto

This is the configuration I'd like to use for the "debug build" of dbus
on Debian - if we use --with-valgrind=yes, we have to hard-code knowledge
of which architectures do and don't have Valgrind in two places instead
of just one.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=56925
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoWhen using dbus-launch for tests, fail hard if test binary is missing
Simon McVittie [Mon, 16 Sep 2013 12:47:19 +0000 (13:47 +0100)]
When using dbus-launch for tests, fail hard if test binary is missing

We want to test the version-under-test, not the system version.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agodbus-launch: avoid asprintf(), and die gracefully on out-of-memory
Simon McVittie [Mon, 16 Sep 2013 12:40:22 +0000 (13:40 +0100)]
dbus-launch: avoid asprintf(), and die gracefully on out-of-memory

asprintf() is a GNU extension (non-portable).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849
Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
10 years agoFix build on NetBSD 6.1.1 with gcc 4.5.3
Chengwei Yang [Thu, 26 Sep 2013 09:35:36 +0000 (17:35 +0800)]
Fix build on NetBSD 6.1.1 with gcc 4.5.3

There are two build failure on NetBSD 6.1.1 with gcc 4.5.3, the first
one is char to int, warning treated as error. The second one is a mismatch
between format string and arguments.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69842
[adjusted commit message -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoNEWS
Simon McVittie [Wed, 25 Sep 2013 12:43:22 +0000 (13:43 +0100)]
NEWS

10 years agoUse 'cp' instead of 'cp -av' to fix portable issue
Chengwei Yang [Wed, 25 Sep 2013 06:17:21 +0000 (14:17 +0800)]
Use 'cp' instead of 'cp -av' to fix portable issue

Neither '-a' nor '-v' of 'cp' is available on OpenBSD 5.3, so use 'cp'
instead to fix portable issue.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69789
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoUse 'chmod' instead of 'chmod -c'
Chengwei Yang [Wed, 25 Sep 2013 06:09:19 +0000 (14:09 +0800)]
Use 'chmod' instead of 'chmod -c'

chmod -c is not available on *BSD system, and '-v' is not available on
OpenBSD, so just execute chmod without any option.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35881
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
10 years agoNEWS
Simon McVittie [Mon, 23 Sep 2013 10:26:08 +0000 (11:26 +0100)]
NEWS

10 years ago_dbus_read_credentials_socket: warn or fail at compile time if no support
Simon McVittie [Fri, 13 Sep 2013 18:01:04 +0000 (19:01 +0100)]
_dbus_read_credentials_socket: warn or fail at compile time if no support

On a whitelist of OSs known to have working credentials-passing
(currently FreeBSD, Linux, OpenBSD and NetBSD), it would be a
regression for us to not have credentials-passing, so fail hard.

On other OSs, raise a warning, which is not normally fatal but
will alert developers on those platforms.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340
Reviewed-by: Colin Walters <walters@verbum.org>
10 years agoPrefer getpeerucred() over getpeereid() if a platform has both
Simon McVittie [Fri, 13 Sep 2013 17:51:34 +0000 (18:51 +0100)]
Prefer getpeerucred() over getpeereid() if a platform has both

We want the process ID, and getpeerucred() provides that.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340
Reviewed-by: Colin Walters <walters@verbum.org>
10 years agobus-test: only expect GetConnectionUnixProcessID to succeed sometimes
Simon McVittie [Fri, 13 Sep 2013 18:18:10 +0000 (19:18 +0100)]
bus-test: only expect GetConnectionUnixProcessID to succeed sometimes

On platforms that use getpeereid(), this can't work.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340
Reviewed-by: Colin Walters <walters@verbum.org>
10 years ago_dbus_read_credentials_socket: document where we use each mechanism
Simon McVittie [Fri, 13 Sep 2013 17:50:40 +0000 (18:50 +0100)]
_dbus_read_credentials_socket: document where we use each mechanism

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340
Reviewed-by: Colin Walters <walters@verbum.org>
10 years agoRemove BSD-style LOCAL_CREDS support
Simon McVittie [Fri, 13 Sep 2013 17:39:18 +0000 (18:39 +0100)]
Remove BSD-style LOCAL_CREDS support

It appears that this regressed back in 2009 (commit 7bf132c7)
and doesn't compile. Also, with patches from Matt Fischer to make
it compile again on QNX, it compiles but doesn't actually work
on NetBSD, which was the platform for which this code was added.
This might be for the reasons described in
<http://julipedia.meroh.net/2006/08/localcreds-socket-credentials.html>.
NetBSD pkgsrc has a large unsubmitted patch to use LOCAL_PEEREID, which
is analogous to Linux/OpenBSD SO_PEERCRED.

So, I think we can safely assume that nobody is relying on this:
either they implement one of our many other supported
credentials-passing mechanisms, or they're patching it locally
anyway.

LOCAL_CREDS is not actually very good - it's awkward to use, and
doesn't provide the pid, only the uid. Of the platforms known to
implement it, QNX and NetBSD both have getpeereid() which provides
just as much information, while FreeBSD and Dragonfly BSD both have
SCM_CREDS which provides the pid too. So, let's just get rid of it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60340
Reviewed-by: Colin Walters <walters@verbum.org>
10 years agoNEWS
Simon McVittie [Mon, 16 Sep 2013 14:30:13 +0000 (15:30 +0100)]
NEWS

10 years agoFix an incorrect sizeof.
Sviatoslav Chagaev [Mon, 16 Sep 2013 11:43:40 +0000 (12:43 +0100)]
Fix an incorrect sizeof.

Fix an incorrect sizeof which leads to allocation of more memory than
actually needed.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69329
[elide redundant "* sizeof (char)" which is 1 by definition -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>