platform/upstream/dbus.git
15 years agoGetting ready for D-Bus 1.3 dbus-1.3.0
Thiago Macieira [Wed, 29 Jul 2009 11:46:23 +0000 (13:46 +0200)]
Getting ready for D-Bus 1.3

15 years agoFix the configure-check again: must use b.
Thiago Macieira [Sat, 25 Jul 2009 11:21:01 +0000 (13:21 +0200)]
Fix the configure-check again: must use b.

Otherwise, when compiling with optimisation, the compiler will detect
that b was unused, then use the instructions that i386 supports.

15 years agoLong live D-Bus 1.3.x / 1.4.x.
Thiago Macieira [Thu, 16 Jul 2009 14:44:53 +0000 (16:44 +0200)]
Long live D-Bus 1.3.x / 1.4.x.

Library Age = 5 / Current = 8 indicates this development
series. Revision will increase from 0 after 1.4.0 is released.

15 years agoFix running tests when builddir != srcdir.
Thiago Macieira [Thu, 16 Jul 2009 14:35:22 +0000 (16:35 +0200)]
Fix running tests when builddir != srcdir.

This script is not deployed to the builddir, so it cannot be
run with relative paths.

15 years agoMerge branch 'fd-passing'
Thiago Macieira [Thu, 16 Jul 2009 14:05:16 +0000 (16:05 +0200)]
Merge branch 'fd-passing'

Conflicts:
dbus/dbus-connection.c
dbus/dbus-message-util.c
dbus/dbus-sysdeps-unix.c

15 years agoFix detection of the GCC __sync intrinsics.
Thiago Macieira [Thu, 16 Jul 2009 13:17:25 +0000 (15:17 +0200)]
Fix detection of the GCC __sync intrinsics.

We have to use the return value, otherwise GCC optimises the code
by using instructions that don't return anything. That won't
match what we actually use in dbus-sysdeps-unix.c

15 years agoMerge branch 'dbus-1.2'
Colin Walters [Wed, 15 Jul 2009 21:39:17 +0000 (17:39 -0400)]
Merge branch 'dbus-1.2'

Conflicts:
configure.in

15 years agoBug 22788 - Fix detection of getpwnam_r on Solaris
Brian Cameron [Wed, 15 Jul 2009 21:35:38 +0000 (17:35 -0400)]
Bug 22788 - Fix detection of getpwnam_r on Solaris

Define POSIX_PTHREAD_SEMANTICS earlier so more things use it.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoUpdate the HACKING file to contain instructions on how we develop with Git
Thiago Macieira [Tue, 14 Jul 2009 20:35:11 +0000 (22:35 +0200)]
Update the HACKING file to contain instructions on how we develop with Git

15 years agoRelease 1.2.16 dbus-1.2.16
Colin Walters [Tue, 14 Jul 2009 20:11:27 +0000 (16:11 -0400)]
Release 1.2.16

15 years agoCope with dbus-launch not being in DBUS_BINDIR
Colin Walters [Tue, 14 Jul 2009 15:43:54 +0000 (11:43 -0400)]
Cope with dbus-launch not being in DBUS_BINDIR

This is a temporary hack for systems which use DBUS_BINDIR=/bin,
but then move dbus-launch back into /usr/bin.  Longer term,
we should explicitly support this in upstream code, or even better
figure out how to move dbus-launch into /bin (e.g. dynamically
load libX11 if available), or have a --with-x11-tools configure
option.
(cherry picked from commit 70c5285eb4b757fdd4e552e002c5d54072492152)

15 years agoBug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)
Hasso Tepper [Mon, 13 Jul 2009 18:23:40 +0000 (14:23 -0400)]
Bug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)

Fixes dbus on FreeBSD and DragonFly systems.

The patch is obtained from FreeBSD ports tree.

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 7bf132c7d15c1d8214b11442f053f7d53bca9a8f)

15 years agoBug 2432 - Support --address option for dbus-monitor
Daniel Reed [Mon, 13 Jul 2009 18:06:26 +0000 (14:06 -0400)]
Bug 2432 - Support --address option for dbus-monitor

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit e4b271e2425a36884b5e3e70e6a32d440b41d145)

15 years agoBug 19446 - HaikuOS support
Grzegorz Dąbrowski [Mon, 13 Jul 2009 17:53:38 +0000 (13:53 -0400)]
Bug 19446 - HaikuOS support

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 97c58ace430fb58cedfc1e5c83db9759063b6946)

15 years agoBug 16688 - typo in dbus-monitor.1
Paul Bolle [Mon, 13 Jul 2009 17:35:05 +0000 (13:35 -0400)]
Bug 16688 - typo in dbus-monitor.1

s/dbus_bus_add_watch/dbus_bus_add_match/

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 249f89181c4db5b15aab15472bb72402527434f5)

15 years agoBug 22415 - COYPING file should note we allow later versions of GPL
Colin Walters [Mon, 13 Jul 2009 17:11:20 +0000 (13:11 -0400)]
Bug 22415 - COYPING file should note we allow later versions of GPL

The canonical copyright information in the source file says we
allow later versions of the GPL.  So note that in COPYING too.
(cherry picked from commit f908daed82d61df44710a8ec681558c6d23b940d)

15 years agoBug 896 - Avoid race conditions reading message from exited process
Colin Walters [Sat, 11 Jul 2009 01:33:02 +0000 (21:33 -0400)]
Bug 896 - Avoid race conditions reading message from exited process

Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>,
thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>,
Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> and others.

The basic idea with this bug is that we effectively ignore errors
on write.  Only when we're done reading from a connection do we
close down a connection.  This avoids a race condition where
if a process (such as dbus-send) exited while we still had
data to read in the buffer, we'd miss that data.
(cherry picked from commit 0e36cdd54964c4012acec2bb8e598b85e82d2846)

15 years agoBug 14259 - Refactor _dbus_get_autolaunch_address
Colin Walters [Mon, 13 Jul 2009 17:02:21 +0000 (13:02 -0400)]
Bug 14259 - Refactor _dbus_get_autolaunch_address

Split out the process-launching code, which can be reused for
other applications; in particular, a forthcoming patch to parse
output from launchd for MacOS X.
(cherry picked from commit 6b163e95e7a2318a98c16c0d0944337e38e62efa)

15 years agoBug 14259 - Make session address lookup system-dependent
Colin Walters [Mon, 13 Jul 2009 16:47:19 +0000 (12:47 -0400)]
Bug 14259 - Make session address lookup system-dependent

On some platforms such as MacOS X and Windows, we can't depend
on an environment variable to determine the address of the
session bus.  Create a sysdep function dbus_lookup_session_address
which can be filled in with platform-specific code.
(cherry picked from commit 6478ec6949c6bb794237b43d03b68f80eba1288c)

15 years agoBug 14259 - Work around broken getgrouplist on MacOS X
Benjamin Reed [Mon, 13 Jul 2009 15:21:08 +0000 (11:21 -0400)]
Bug 14259 - Work around broken getgrouplist on MacOS X

We don't get the number of groups, so allocate an arbitrary
larger array.

Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
(cherry picked from commit c71403ddde230378e3beffee21a3d1fe6edc9bce)

15 years agoBug 12484 - Ensure initialized variable in dbus_connection_remove_filter
Kimmo Hämäläinen [Mon, 13 Jul 2009 10:30:48 +0000 (06:30 -0400)]
Bug 12484 - Ensure initialized variable in dbus_connection_remove_filter

Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
(cherry picked from commit ccfa8e51549f36e09f90a4f5822523a0f50201fc)

15 years agoBug 18121 - Use a monotonic clock for pthread timeouts
Colin Walters [Sat, 11 Jul 2009 02:27:55 +0000 (22:27 -0400)]
Bug 18121 - Use a monotonic clock for pthread timeouts

Patch based on one from Keith Mok <ek9852@gmail.com>, some
followup work from Janne Karhunen <Janne.Karhunen@gmail.com>.

We don't want condition variable timeouts to be affected by the system clock.
Use the POSIX CLOCK_MONOTONIC if available.
(cherry picked from commit ae24bb35e2ee3ecde990f55852982b573754ec43)

15 years agoBug 22516 - Ensure inotify fd is set close on exec
Matthias Clasen [Sat, 11 Jul 2009 00:10:12 +0000 (20:10 -0400)]
Bug 22516 - Ensure inotify fd is set close on exec

This prevents it leaking into spawned child processes.

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit f4e15893e5be6da6c7642bb7ef9b14d5531afe41)

15 years agoBug 21545 - Move CFLAGS modification towards the end of configure
Colin Walters [Sat, 11 Jul 2009 00:07:34 +0000 (20:07 -0400)]
Bug 21545 - Move CFLAGS modification towards the end of configure

This prevents the flags from screwing up autoconf tests.
(cherry picked from commit 98bbe8c7941f2c643dc55b4e7329c0da57d2c7bc)

15 years agoEnsure messages are locked while marshalling.
Will Thompson [Sun, 7 Jun 2009 16:44:26 +0000 (17:44 +0100)]
Ensure messages are locked while marshalling.

Locking a message has the side-effect of updating the message's length
header. Previously, if dbus_message_marshal() was called on an unlocked
message, it could yield an invalid message (as discovered by Ben
Schwartz in <http://bugs.freedesktop.org/show_bug.cgi?id=19723>).
(cherry picked from commit 9f825271f9106c23fe51ab54abdb5156b7751014)

15 years agoBug 21657 - Fix configure checks for va_list in maintainer mode
Christian Persch (GNOME) [Fri, 10 Jul 2009 23:40:00 +0000 (19:40 -0400)]
Bug 21657 - Fix configure checks for va_list in maintainer mode

Include the right headers.
(cherry picked from commit fe86222d10f0b2532be314a58841db82b1f5887e)

15 years agoBug 21161 - Update the FSF address
Tobias Mueller [Fri, 10 Jul 2009 23:32:38 +0000 (19:32 -0400)]
Bug 21161 - Update the FSF address

No comment.

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 5baf2f856a9c6625993234855b07680da1c8916f)

15 years agoBug 21646 - Fix a signed char comparison
Colin Walters [Fri, 10 Jul 2009 23:26:52 +0000 (19:26 -0400)]
Bug 21646 - Fix a signed char comparison

Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com>

Explicitly cast to unsigned char before we do comparisons.
(cherry picked from commit 1f6ac4deef91df3130c61525a2800e6b8a0ddcbf)

15 years agoAdd missing include for unistd.h in test-service.c
Colin Walters [Fri, 10 Jul 2009 23:22:54 +0000 (19:22 -0400)]
Add missing include for unistd.h in test-service.c

We use usleep here.
(cherry picked from commit e5310abd6cbc4c2e1a9df54f097d6642ad0833c6)

15 years agoBug 21347 - Don't fail autolaunching if process has SIGCHLD handler
Kurt Miller [Fri, 10 Jul 2009 23:14:10 +0000 (19:14 -0400)]
Bug 21347 - Don't fail autolaunching if process has SIGCHLD handler

If other code in the process set a global SIGCHLD handler, it
will make autolaunching fail spuriously due to waitpid() failing.

This fix will temporarily block SIGCHLD delivery.

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 644fc38b249b490981becda4b2de5261865bba23)

15 years agodbus_message_append_args_valist - abandon container
Scott James Remnant [Thu, 9 Jul 2009 15:35:13 +0000 (16:35 +0100)]
dbus_message_append_args_valist - abandon container

In case of OOM when constructing an array, we should abandon the
container to free the resources.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 3f070088232f82fafce97c4fb3015da098fe00bf)

15 years agobfo22316 - add dbus_message_iter_abandon_container()
Scott James Remnant [Thu, 9 Jul 2009 15:34:54 +0000 (16:34 +0100)]
bfo22316 - add dbus_message_iter_abandon_container()

It's not currently possible to abandon creation of a container without
either hitting asserts or leaking memory.  This new function allows
that.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit e57a368c440aec39caf6c3b491cf76ef615dc2e8)

15 years agoAdd test case for assert when unwinding a container.
Scott James Remnant [Thu, 9 Jul 2009 15:28:29 +0000 (16:28 +0100)]
Add test case for assert when unwinding a container.

* dbus/dbus-message-util.c: when constructing an array of structures,
it's not possible to unwind in case of an error part-way through.
This test will therefore assert.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 4bea3ca2b02098f2513a9902511e4de77ccf9b91)

15 years agoAdd tests for pending call timeouts
Scott James Remnant [Mon, 11 May 2009 22:29:52 +0000 (23:29 +0100)]
Add tests for pending call timeouts

* test/test-service.c (handle_delay_echo, path_message_func): Add a
  variant of the Echo method which sleeps for a short time.
* test/name-test/test-pending-call-timeout.c: Run tests with default,
  specified and infinite timeout to make sure we get the reply.
* test/name-test/run-test.sh: Run the new test
* test/name-test/Makefile.am: Build the new test

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit c1f165261afcc3bafa9b24ff916bb231628e3782)

15 years agoUnrestrict session bus timeout.
Scott James Remnant [Mon, 11 May 2009 21:54:44 +0000 (22:54 +0100)]
Unrestrict session bus timeout.

* bus/session.conf.in: Remove the reply_timeout stanza, previously
  intended to increase the reply timeout, this now reduces it.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit bd2063e17e1bb57dee1a5dfed76c9dde76d55ff3)

15 years agoChange default reply timeout.
Scott James Remnant [Mon, 11 May 2009 21:43:09 +0000 (22:43 +0100)]
Change default reply timeout.

* bus/config-parser.c (bus_config_parser_new): change the default reply
  timeout to "never"

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 8f1d2a2fa8ba2f25121465ad82289c0e09c9675a)

15 years agoExpire list timeout may be negative for no expiry.
Scott James Remnant [Mon, 11 May 2009 21:42:50 +0000 (22:42 +0100)]
Expire list timeout may be negative for no expiry.

* bus/expirelist.c (do_expiration_with_current_time): Don't check for
  expiry if expire_after is negative, will just disable the expiry timer
  after the call.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit d672d0320628e93a247eeff89945c81926a42163)

15 years agoExplicitly check for zero time fields.
Scott James Remnant [Mon, 11 May 2009 21:42:32 +0000 (22:42 +0100)]
Explicitly check for zero time fields.

* bus/expirelist.c (do_expiration_with_current_time): If the item added
  time fields are both zero, always expire.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit d33cfec625bf769384cc370ad0ea660c9993aa15)

15 years agoRemove 6 hour timeout restriction.
Scott James Remnant [Mon, 11 May 2009 21:42:13 +0000 (22:42 +0100)]
Remove 6 hour timeout restriction.

* dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): Now that
  the timeout math won't overflow, don't clamp to six hours.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 7398ad7374c0a9201d41397c956deee325f3593e)

15 years agoFix issue where timeouts can overflow.
Scott James Remnant [Mon, 11 May 2009 21:41:49 +0000 (22:41 +0100)]
Fix issue where timeouts can overflow.

* dbus/dbus-connection.c (_dbus_connection_block_pending_call): Rework
  the timeout math so instead of calculating an end time, which may
  overflow, we instead calculate the elapsed time which is always
  smaller than the boundaries.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 1faa92114f6489d286ad4cebe5e91b2145a4f7d1)

15 years agoUpdate documentation now that INT_MAX means no timeout.
Scott James Remnant [Mon, 11 May 2009 21:41:20 +0000 (22:41 +0100)]
Update documentation now that INT_MAX means no timeout.

* dbus/dbus-connection.c (dbus_connection_send_with_reply): Fix
  documentation now that INT_MAX will not be clamped.
  (dbus_connection_send_with_reply_and_block): Update documentation too.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit ce0d932d9be5adec22943dd7b268bd4a165ada64)

15 years agoDon't allocate DBusTimeout for pending call when passed INT_MAX
Scott James Remnant [Mon, 11 May 2009 21:40:38 +0000 (22:40 +0100)]
Don't allocate DBusTimeout for pending call when passed INT_MAX

* dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): When passed
  INT_MAX, do not clamp the value and do not allocate a timeout for the call
  (_dbus_pending_call_get_timeout_unlocked): Document that this may return
  NULL.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit 92dd55c903b440bc423f1f8f9aeb0bbbbcc11bac)

15 years agoAllow a pending call to block forever
Scott James Remnant [Mon, 11 May 2009 21:40:10 +0000 (22:40 +0100)]
Allow a pending call to block forever

* dbus/dbus-connection.c (_dbus_connection_block_pending_call): Allow the
  pending call to have no timeout, in which case we simply block until we
  complete, have data or get disconnected.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit e5eb472d11aa36c67e320edce41d66eb18cdf5d0)

15 years agoMake sure a pending call timeout isn't assumed.
Scott James Remnant [Mon, 11 May 2009 21:38:23 +0000 (22:38 +0100)]
Make sure a pending call timeout isn't assumed.

* dbus/dbus-connection.c (_dbus_connection_attach_pending_call_unlocked):
  Don't assume that the pending call has a timeout.
  (connection_timeout_and_complete_all_pending_call_unlocked): check that
  the timeout was actually added before removing it; this safeguards us
  if the pending call doesn't have a timeout.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
(cherry picked from commit ba22606c3b21c55c5c0af30d8f07edd71ded7213)

15 years agoCope with dbus-launch not being in DBUS_BINDIR
Colin Walters [Tue, 14 Jul 2009 15:43:54 +0000 (11:43 -0400)]
Cope with dbus-launch not being in DBUS_BINDIR

This is a temporary hack for systems which use DBUS_BINDIR=/bin,
but then move dbus-launch back into /usr/bin.  Longer term,
we should explicitly support this in upstream code, or even better
figure out how to move dbus-launch into /bin (e.g. dynamically
load libX11 if available), or have a --with-x11-tools configure
option.

15 years agoBug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)
Hasso Tepper [Mon, 13 Jul 2009 18:23:40 +0000 (14:23 -0400)]
Bug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)

Fixes dbus on FreeBSD and DragonFly systems.

The patch is obtained from FreeBSD ports tree.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 2432 - Support --address option for dbus-monitor
Daniel Reed [Mon, 13 Jul 2009 18:06:26 +0000 (14:06 -0400)]
Bug 2432 - Support --address option for dbus-monitor

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 19446 - HaikuOS support
Grzegorz Dąbrowski [Mon, 13 Jul 2009 17:53:38 +0000 (13:53 -0400)]
Bug 19446 - HaikuOS support

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 16688 - typo in dbus-monitor.1
Paul Bolle [Mon, 13 Jul 2009 17:35:05 +0000 (13:35 -0400)]
Bug 16688 - typo in dbus-monitor.1

s/dbus_bus_add_watch/dbus_bus_add_match/

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 22415 - COYPING file should note we allow later versions of GPL
Colin Walters [Mon, 13 Jul 2009 17:11:20 +0000 (13:11 -0400)]
Bug 22415 - COYPING file should note we allow later versions of GPL

The canonical copyright information in the source file says we
allow later versions of the GPL.  So note that in COPYING too.

15 years agoBug 896 - Avoid race conditions reading message from exited process
Colin Walters [Sat, 11 Jul 2009 01:33:02 +0000 (21:33 -0400)]
Bug 896 - Avoid race conditions reading message from exited process

Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>,
thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>,
Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> and others.

The basic idea with this bug is that we effectively ignore errors
on write.  Only when we're done reading from a connection do we
close down a connection.  This avoids a race condition where
if a process (such as dbus-send) exited while we still had
data to read in the buffer, we'd miss that data.

15 years agoBug 14259 - Refactor _dbus_get_autolaunch_address
Colin Walters [Mon, 13 Jul 2009 17:02:21 +0000 (13:02 -0400)]
Bug 14259 - Refactor _dbus_get_autolaunch_address

Split out the process-launching code, which can be reused for
other applications; in particular, a forthcoming patch to parse
output from launchd for MacOS X.

15 years agoBug 14259 - Make session address lookup system-dependent
Colin Walters [Mon, 13 Jul 2009 16:47:19 +0000 (12:47 -0400)]
Bug 14259 - Make session address lookup system-dependent

On some platforms such as MacOS X and Windows, we can't depend
on an environment variable to determine the address of the
session bus.  Create a sysdep function dbus_lookup_session_address
which can be filled in with platform-specific code.

15 years agoBug 14259 - Work around broken getgrouplist on MacOS X
Benjamin Reed [Mon, 13 Jul 2009 15:21:08 +0000 (11:21 -0400)]
Bug 14259 - Work around broken getgrouplist on MacOS X

We don't get the number of groups, so allocate an arbitrary
larger array.

Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
15 years agoBug 12484 - Ensure initialized variable in dbus_connection_remove_filter
Kimmo Hämäläinen [Mon, 13 Jul 2009 10:30:48 +0000 (06:30 -0400)]
Bug 12484 - Ensure initialized variable in dbus_connection_remove_filter

Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
15 years agoBug 18121 - Use a monotonic clock for pthread timeouts
Colin Walters [Sat, 11 Jul 2009 02:27:55 +0000 (22:27 -0400)]
Bug 18121 - Use a monotonic clock for pthread timeouts

Patch based on one from Keith Mok <ek9852@gmail.com>, some
followup work from Janne Karhunen <Janne.Karhunen@gmail.com>.

We don't want condition variable timeouts to be affected by the system clock.
Use the POSIX CLOCK_MONOTONIC if available.

15 years agoBug 22516 - Ensure inotify fd is set close on exec
Matthias Clasen [Sat, 11 Jul 2009 00:10:12 +0000 (20:10 -0400)]
Bug 22516 - Ensure inotify fd is set close on exec

This prevents it leaking into spawned child processes.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 21545 - Move CFLAGS modification towards the end of configure
Colin Walters [Sat, 11 Jul 2009 00:07:34 +0000 (20:07 -0400)]
Bug 21545 - Move CFLAGS modification towards the end of configure

This prevents the flags from screwing up autoconf tests.

15 years agoEnsure messages are locked while marshalling.
Will Thompson [Sun, 7 Jun 2009 16:44:26 +0000 (17:44 +0100)]
Ensure messages are locked while marshalling.

Locking a message has the side-effect of updating the message's length
header. Previously, if dbus_message_marshal() was called on an unlocked
message, it could yield an invalid message (as discovered by Ben
Schwartz in <http://bugs.freedesktop.org/show_bug.cgi?id=19723>).

15 years agoBug 21657 - Fix configure checks for va_list in maintainer mode
Christian Persch (GNOME) [Fri, 10 Jul 2009 23:40:00 +0000 (19:40 -0400)]
Bug 21657 - Fix configure checks for va_list in maintainer mode

Include the right headers.

15 years agoBug 21161 - Update the FSF address
Tobias Mueller [Fri, 10 Jul 2009 23:32:38 +0000 (19:32 -0400)]
Bug 21161 - Update the FSF address

No comment.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 21646 - Fix a signed char comparison
Colin Walters [Fri, 10 Jul 2009 23:26:52 +0000 (19:26 -0400)]
Bug 21646 - Fix a signed char comparison

Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com>

Explicitly cast to unsigned char before we do comparisons.

15 years agoAdd missing include for unistd.h in test-service.c
Colin Walters [Fri, 10 Jul 2009 23:22:54 +0000 (19:22 -0400)]
Add missing include for unistd.h in test-service.c

We use usleep here.

15 years agoBug 21347 - Don't fail autolaunching if process has SIGCHLD handler
Kurt Miller [Fri, 10 Jul 2009 23:14:10 +0000 (19:14 -0400)]
Bug 21347 - Don't fail autolaunching if process has SIGCHLD handler

If other code in the process set a global SIGCHLD handler, it
will make autolaunching fail spuriously due to waitpid() failing.

This fix will temporarily block SIGCHLD delivery.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agodbus_message_append_args_valist - abandon container
Scott James Remnant [Thu, 9 Jul 2009 15:35:13 +0000 (16:35 +0100)]
dbus_message_append_args_valist - abandon container

In case of OOM when constructing an array, we should abandon the
container to free the resources.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agobfo22316 - add dbus_message_iter_abandon_container()
Scott James Remnant [Thu, 9 Jul 2009 15:34:54 +0000 (16:34 +0100)]
bfo22316 - add dbus_message_iter_abandon_container()

It's not currently possible to abandon creation of a container without
either hitting asserts or leaking memory.  This new function allows
that.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoAdd test case for assert when unwinding a container.
Scott James Remnant [Thu, 9 Jul 2009 15:28:29 +0000 (16:28 +0100)]
Add test case for assert when unwinding a container.

* dbus/dbus-message-util.c: when constructing an array of structures,
it's not possible to unwind in case of an error part-way through.
This test will therefore assert.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoBump configure.in for GIT
Scott James Remnant [Thu, 9 Jul 2009 15:23:43 +0000 (16:23 +0100)]
Bump configure.in for GIT

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoAdd tests for pending call timeouts
Scott James Remnant [Mon, 11 May 2009 22:29:52 +0000 (23:29 +0100)]
Add tests for pending call timeouts

* test/test-service.c (handle_delay_echo, path_message_func): Add a
  variant of the Echo method which sleeps for a short time.
* test/name-test/test-pending-call-timeout.c: Run tests with default,
  specified and infinite timeout to make sure we get the reply.
* test/name-test/run-test.sh: Run the new test
* test/name-test/Makefile.am: Build the new test

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoUnrestrict session bus timeout.
Scott James Remnant [Mon, 11 May 2009 21:54:44 +0000 (22:54 +0100)]
Unrestrict session bus timeout.

* bus/session.conf.in: Remove the reply_timeout stanza, previously
  intended to increase the reply timeout, this now reduces it.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoChange default reply timeout.
Scott James Remnant [Mon, 11 May 2009 21:43:09 +0000 (22:43 +0100)]
Change default reply timeout.

* bus/config-parser.c (bus_config_parser_new): change the default reply
  timeout to "never"

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoExpire list timeout may be negative for no expiry.
Scott James Remnant [Mon, 11 May 2009 21:42:50 +0000 (22:42 +0100)]
Expire list timeout may be negative for no expiry.

* bus/expirelist.c (do_expiration_with_current_time): Don't check for
  expiry if expire_after is negative, will just disable the expiry timer
  after the call.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoExplicitly check for zero time fields.
Scott James Remnant [Mon, 11 May 2009 21:42:32 +0000 (22:42 +0100)]
Explicitly check for zero time fields.

* bus/expirelist.c (do_expiration_with_current_time): If the item added
  time fields are both zero, always expire.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoRemove 6 hour timeout restriction.
Scott James Remnant [Mon, 11 May 2009 21:42:13 +0000 (22:42 +0100)]
Remove 6 hour timeout restriction.

* dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): Now that
  the timeout math won't overflow, don't clamp to six hours.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoFix issue where timeouts can overflow.
Scott James Remnant [Mon, 11 May 2009 21:41:49 +0000 (22:41 +0100)]
Fix issue where timeouts can overflow.

* dbus/dbus-connection.c (_dbus_connection_block_pending_call): Rework
  the timeout math so instead of calculating an end time, which may
  overflow, we instead calculate the elapsed time which is always
  smaller than the boundaries.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoUpdate documentation now that INT_MAX means no timeout.
Scott James Remnant [Mon, 11 May 2009 21:41:20 +0000 (22:41 +0100)]
Update documentation now that INT_MAX means no timeout.

* dbus/dbus-connection.c (dbus_connection_send_with_reply): Fix
  documentation now that INT_MAX will not be clamped.
  (dbus_connection_send_with_reply_and_block): Update documentation too.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoDon't allocate DBusTimeout for pending call when passed INT_MAX
Scott James Remnant [Mon, 11 May 2009 21:40:38 +0000 (22:40 +0100)]
Don't allocate DBusTimeout for pending call when passed INT_MAX

* dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): When passed
  INT_MAX, do not clamp the value and do not allocate a timeout for the call
  (_dbus_pending_call_get_timeout_unlocked): Document that this may return
  NULL.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoAllow a pending call to block forever
Scott James Remnant [Mon, 11 May 2009 21:40:10 +0000 (22:40 +0100)]
Allow a pending call to block forever

* dbus/dbus-connection.c (_dbus_connection_block_pending_call): Allow the
  pending call to have no timeout, in which case we simply block until we
  complete, have data or get disconnected.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agoMake sure a pending call timeout isn't assumed.
Scott James Remnant [Mon, 11 May 2009 21:38:23 +0000 (22:38 +0100)]
Make sure a pending call timeout isn't assumed.

* dbus/dbus-connection.c (_dbus_connection_attach_pending_call_unlocked):
  Don't assume that the pending call has a timeout.
  (connection_timeout_and_complete_all_pending_call_unlocked): check that
  the timeout was actually added before removing it; this safeguards us
  if the pending call doesn't have a timeout.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
15 years agobus: don't forward messages with unix fds on connections that don't support it
Lennart Poettering [Wed, 20 May 2009 23:00:52 +0000 (01:00 +0200)]
bus: don't forward messages with unix fds on connections that don't support it

This simply verifies that we forward unix fds only on connection that
support it. We willr eturn an error if a client attempts to send a
message with unix fds to another client that cannot do it.

15 years agodoxygen: document that we don't support reading/writing arrays of unix fds in once...
Lennart Poettering [Wed, 20 May 2009 21:48:46 +0000 (23:48 +0200)]
doxygen: document that we don't support reading/writing arrays of unix fds in once piece right now

15 years agodoc: document Unix FD passing in the specification
Lennart Poettering [Wed, 20 May 2009 01:01:37 +0000 (03:01 +0200)]
doc: document Unix FD passing in the specification

15 years agobus: make use of new unix fd limits
Lennart Poettering [Tue, 19 May 2009 23:33:17 +0000 (01:33 +0200)]
bus: make use of new unix fd limits

Create configuration settings and enforce message unix fd limits the
same way we do for allocated message memory.

15 years agounix-fd: add logic to count unix fds the same way as allocated memory
Lennart Poettering [Tue, 19 May 2009 23:32:46 +0000 (01:32 +0200)]
unix-fd: add logic to count unix fds the same way as allocated memory

This make all counters count both bytes of memory and unix fds.

15 years agobyteswap: make use of glibc specific bytswap primitives
Lennart Poettering [Tue, 19 May 2009 20:34:43 +0000 (22:34 +0200)]
byteswap: make use of glibc specific bytswap primitives

glibc knows three bswap_{16|32|64}() calls that internally make use of a
gcc extension to implement faster byteswapping. We should make use of it
if we can.

15 years agoatomic: implement atomic operations based on gcc's __sync extension
Lennart Poettering [Tue, 19 May 2009 20:30:14 +0000 (22:30 +0200)]
atomic: implement atomic operations based on gcc's __sync extension

Newer gccs and intel ccs support a __sync extension for making use of
atomic operations. This patch replaces the handcrafted x86 atomic
operation support with usage of __sync.

__sync is supported by more processors and by more compilers than the
old assembler code. Also, this extension has been available on gcc for
quite a while now for x86, so replacing the old assembler code should
only be a loss when very old compiilers are used.

15 years agogit: enable whitespace checking commit hook during in autogen.sh
Lennart Poettering [Tue, 12 May 2009 23:56:54 +0000 (01:56 +0200)]
git: enable whitespace checking commit hook during in autogen.sh

Trailing whitespace sucks. This change modifies autogen.sh to activate
the example pre-commit that ships with git. It will make sure that from
then on no further commits with trailing whitespace can be made

15 years agomemset: replace memset() by _DBUS_ZERO where applicable
Lennart Poettering [Mon, 4 May 2009 22:01:50 +0000 (00:01 +0200)]
memset: replace memset() by _DBUS_ZERO where applicable

15 years agoauth: add fd passing negotiation support
Lennart Poettering [Fri, 24 Apr 2009 02:38:27 +0000 (04:38 +0200)]
auth: add fd passing negotiation support

This adds two new directives to the auth protocol:

NEGOTIATE_UNIX_FD is sent by the client after the authentication was
sucessful, i.e. OK was received.

AGREE_UNIX_FD is then sent by the server if it can do unix fd passing as
well.

ERROR is returned when the server cannot or is unwilling to do unix fd
passing.

This should be compatible with existing D-Bus implementations which will
naturally return ERROR on NEGOTIATE_UNIX_FD.

15 years agocloexec: set all sockets that are created with SOCK_CLOEXEC
Lennart Poettering [Wed, 6 May 2009 01:41:50 +0000 (03:41 +0200)]
cloexec: set all sockets that are created with SOCK_CLOEXEC

Since all socket users enable FD_CLOEXEC anyway we can just do that in
_dbus_open_socket() and be done with it for all cases. By side effect
this allows us to use SOCK_CLOEXEC and hence close the CLOEXEC race.

15 years agocloexec: make use of pipe2(O_CLOEXEC) when available
Lennart Poettering [Wed, 22 Apr 2009 02:45:46 +0000 (04:45 +0200)]
cloexec: make use of pipe2(O_CLOEXEC) when available

This should fix another CLOEXEC race.

15 years agobuild-system: define _GNU_SOURCE centrally
Lennart Poettering [Wed, 22 Apr 2009 02:43:31 +0000 (04:43 +0200)]
build-system: define _GNU_SOURCE centrally

Instead of having everyone define _GNU_SOURCE and similar macros
seperately, simply do so centrally by using AC_USE_SYSTEM_EXTENSIONS

15 years agocloexec: set FD_CLOEXEC for all full duplex pipes
Lennart Poettering [Wed, 22 Apr 2009 02:22:51 +0000 (04:22 +0200)]
cloexec: set FD_CLOEXEC for all full duplex pipes

All users of full duplex pipes enable FD_CLOEXEC later anyway so let's
just do it as part of _dbus_full_duplex_pipe. By side effect this allows
to make use of SOCK_CLOEXEC which fixes a race when forking/execing from
a different thread at the same time as we ar in this function.

15 years agounix-fd: add test for passing unix fds
Lennart Poettering [Wed, 22 Apr 2009 02:07:01 +0000 (04:07 +0200)]
unix-fd: add test for passing unix fds

This adds a full test for passing multiple fds across a D-Bus
connection.

15 years agounix-fd: when sending a message with unix fds verify that the connection can do it
Lennart Poettering [Wed, 22 Apr 2009 02:01:01 +0000 (04:01 +0200)]
unix-fd: when sending a message with unix fds verify that the connection can do it

Not all of the send function flavours allow returning proper error
codes. For the cases where this is not easily possible the client should
call dbus_connection_can_send_type() first.

15 years agounix-fd: introduce dbus_connection_can_send_type()
Lennart Poettering [Wed, 22 Apr 2009 01:56:18 +0000 (03:56 +0200)]
unix-fd: introduce dbus_connection_can_send_type()

This is just a wrapper around _dbus_transport_can_pass_unix_fd() however
it is more generic.

The reason for keeping this generic is to ease later addition of more
types without having to add a new API for that.

15 years agounix-fd: add message encoding/decoding for unix fds
Lennart Poettering [Wed, 22 Apr 2009 01:41:05 +0000 (03:41 +0200)]
unix-fd: add message encoding/decoding for unix fds

When appending unix fds to the message a new entry in the fd array will
be allocated and the index to it will be written to the message payload.

When parsing unix fds from the message the index will be read from the
payload and then looked up in the fd array.

When we read fds we put them in a queue first. Since each message knows
how many fds are attached to it we will then pop enough fds from this
queue each time we decode a message from the stream.

This should make sending and receiving more portable since we don't make
any strong requirements on the exact semantics of the SCM_RIGHTS
implementation: as long as fds are recieved in order, none or lost and
the arrive at the same time as at least one byte from the actual message
dat we should be able to handle them correctly.

15 years agounix-fd: add basic marshalling code for unix fds
Lennart Poettering [Wed, 22 Apr 2009 01:31:20 +0000 (03:31 +0200)]
unix-fd: add basic marshalling code for unix fds

This is actually pretty boring since we store our fds as indexes that
are stored as uint32_t's.

15 years agounix-fd: introduce basic protocol definitions
Lennart Poettering [Wed, 22 Apr 2009 01:32:35 +0000 (03:32 +0200)]
unix-fd: introduce basic protocol definitions

We introduce a new type code for the unix fds. The data stored in unix
fd fields will be an integer index into the array of fds that are
attached to a specific message. We also introduce a new header field
that stores how many fds belong to the message. And finally we introduce
a new error for messages where the payload and the meta data (i.e. unix
fds read for it) don't match up.

15 years agosysdeps-unix: add basic IO primitives for unix fd passing
Lennart Poettering [Wed, 22 Apr 2009 01:20:27 +0000 (03:20 +0200)]
sysdeps-unix: add basic IO primitives for unix fd passing

This introduces three new functions:

_dbus_read_socket_with_unix_fds
_dbus_write_socket_with_unix_fds
_dbus_read_socket_with_unix_fds_two

These work exactly like their counterpart sans 'with_unix_fds' except
that they also send/recieve file descriptors along with the actual
payload data.