Commit graph

1960 commits

Author SHA1 Message Date
Will Thompson
a8e620a0ff Print all-printable-ASCII byte arrays as strings
In practice, ay seems to be used mostly for binary data (in which case,
hex output is fine) or for Unix file paths (because they may be
non-UTF-8) and similar human-readable strings. So let's print the latter
similarly to strings.
2010-01-28 17:01:24 -05:00
Will Thompson
1a33efb54b Print byte arrays as nicely-formatted hex. 2010-01-28 17:01:23 -05:00
Will Thompson
3171383ce9 Add an accessor for the loader's corruption reason 2010-01-28 17:01:23 -05:00
Will Thompson
7cf332d34e Include reason when reporting corrupt messages
It would have been much easier to diagnose fd.o#19723 if the error
message had said more than just "Message is corrupted".
2010-01-28 17:01:23 -05:00
Will Thompson
ce87333cac Forbid zero serial numbers 2010-01-28 17:01:23 -05:00
Will Thompson
7a8fcdee22 Make array-printing code easier to follow
Previously dbus_message_iter_get_arg_type() was called twice: once in
the loop condition to update 'current_type', and once to check if the
loop will run again. This patch moves updating current_type to the end
of the loop body.
2010-01-28 17:01:23 -05:00
James Westby
e2aee8bdeb Correct timeout handling
The timeout handling code subtracts the elapsed time from the timeout
each time a message is received, which drastically reduces the timeout
in circumstances such as service activation.

Correct so that the timeout is never modified, and the elapsed time
instead subtracted where necessary.

Signed-off-by: James Westby <jw+debian@jameswestby.net>
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2010-01-28 17:01:23 -05:00
Hendrik Buschmeier
6067f88afd Bug 23502 - corrected wrong verbose-output 2010-01-28 11:22:32 +01:00
Matthias Clasen
8343c971cd Bug 25697 - Fix memory leak in policy reload
Signed-off-by: Colin Walters <walters@verbum.org>
2009-12-18 14:29:40 -05:00
Sascha Silbe
9b2c196ef3 Bug 23977 - dbus-launch --exit-with-session not killing dbus-daemon on SIGINT
Handle SIGINT in the same way we handle SIGTERM.
2009-10-16 15:20:43 -04:00
Colin Watson
be89ffacc9 Fix link order: system libraries should come after libdbus-convenience
libdbus-convenience may use system libraries, but not the other way
round. Most platforms don't care, but on some platforms this means that
system libraries need to be listed after libdbus-convenience.la on the
link line.
2009-09-18 21:12:39 +02:00
Lennart Poettering
43b1f91865 dbus-monitor: use unbuffered stdout instead of handling SIGINT
The current SIGINT handling of dbus-monitor ain't making too many people
happy since it defers the exit to the next msg received -- which might
be quite some time away often enough.

This patch replaces the SIGINT handling by simply enabling line-buffered
IO for STDOUT so that even if you redirect dbus-monitor into a file no
lines get accidently lost and the effect of C-c is still immediate.

halfline came up with the great idea to use setvbuf here instead of
fflush()ing after each printf().

(Oh and the old signal handler was broken anyway, the flag should have
been of type sigatomic_t and be marked volatile)

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-31 12:27:48 -04:00
Colin Walters
1116f210aa Bug 22805 - Fix build with -Wl,--as-needed
Explicitly link dbus_convenience.la against DBUS_CLIENT_LIBS
because it uses $THREAD_LIBS, just like the main library does.
2009-07-31 11:03:57 -04:00
Aurelien Jarno
ffa322b80f Bug 19432 followup - Fix Debian/FreeBSD CMSGCRED compilation 2009-07-16 09:35:27 -04:00
Brian Cameron
c6992fc56c 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>
2009-07-15 17:35:38 -04:00
Thiago Macieira
bb189fdb75 Update the HACKING file to contain instructions on how we develop with Git 2009-07-14 22:46:20 +02:00
Colin Walters
557968d8d6 Release 1.2.16 2009-07-14 16:11:27 -04:00
Colin Walters
3028841a74 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 70c5285eb4)
2009-07-14 15:42:38 -04:00
Hasso Tepper
5abb8aeb5e 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 7bf132c7d1)
2009-07-14 15:42:31 -04:00
Daniel Reed
fceaa7a153 Bug 2432 - Support --address option for dbus-monitor
Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit e4b271e242)
2009-07-14 15:42:25 -04:00
Grzegorz Dąbrowski
ddc553326e Bug 19446 - HaikuOS support
Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 97c58ace43)
2009-07-14 15:42:19 -04:00
Paul Bolle
3ee885f217 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 249f89181c)
2009-07-14 15:42:11 -04:00
Colin Walters
a96f2615c7 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 f908daed82)
2009-07-14 15:42:05 -04:00
Colin Walters
87ddff6b24 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 0e36cdd549)
2009-07-14 15:41:57 -04:00
Colin Walters
96e785bb06 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 6b163e95e7)
2009-07-14 15:41:48 -04:00
Colin Walters
44062b35af 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 6478ec6949)
2009-07-14 15:41:40 -04:00
Benjamin Reed
8420a5bb57 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 c71403ddde)
2009-07-14 15:41:33 -04:00
Kimmo Hämäläinen
93023eb6a4 Bug 12484 - Ensure initialized variable in dbus_connection_remove_filter
Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
(cherry picked from commit ccfa8e5154)
2009-07-14 15:40:31 -04:00
Colin Walters
2e286c8a27 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 ae24bb35e2)
2009-07-14 15:40:24 -04:00
Matthias Clasen
943b9d3944 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 f4e15893e5)
2009-07-14 15:40:17 -04:00
Colin Walters
a0db71ffb5 Bug 21545 - Move CFLAGS modification towards the end of configure
This prevents the flags from screwing up autoconf tests.
(cherry picked from commit 98bbe8c794)
2009-07-14 15:40:10 -04:00
Will Thompson
1c4e856396 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 9f825271f9)
2009-07-14 15:40:02 -04:00
Christian Persch (GNOME)
f412447c95 Bug 21657 - Fix configure checks for va_list in maintainer mode
Include the right headers.
(cherry picked from commit fe86222d10)
2009-07-14 15:39:56 -04:00
Tobias Mueller
dc33f4f774 Bug 21161 - Update the FSF address
No comment.

Signed-off-by: Colin Walters <walters@verbum.org>
(cherry picked from commit 5baf2f856a)
2009-07-14 15:39:47 -04:00
Colin Walters
7d6ca5493d 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 1f6ac4deef)
2009-07-14 15:39:40 -04:00
Colin Walters
576a87dc5a Add missing include for unistd.h in test-service.c
We use usleep here.
(cherry picked from commit e5310abd6c)
2009-07-14 15:39:33 -04:00
Kurt Miller
a8b1b8c0b2 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 644fc38b24)
2009-07-14 15:39:26 -04:00
Scott James Remnant
951b0c8007 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 3f07008823)
2009-07-14 15:39:19 -04:00
Scott James Remnant
2ff4bc2513 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 e57a368c44)
2009-07-14 15:39:11 -04:00
Scott James Remnant
bf2183345f 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 4bea3ca2b0)
2009-07-14 15:39:02 -04:00
Scott James Remnant
0539a23c66 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 c1f165261a)
2009-07-14 15:38:42 -04:00
Scott James Remnant
21b0ff273a 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 bd2063e17e)
2009-07-14 15:38:33 -04:00
Scott James Remnant
f68efe1e80 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 8f1d2a2fa8)
2009-07-14 15:38:25 -04:00
Scott James Remnant
ce326587c3 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 d672d03206)
2009-07-14 15:38:18 -04:00
Scott James Remnant
e296855e41 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 d33cfec625)
2009-07-14 15:38:11 -04:00
Scott James Remnant
5de455c0bb 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 7398ad7374)
2009-07-14 15:38:02 -04:00
Scott James Remnant
fc7b4fc9ec 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 1faa92114f)
2009-07-14 15:37:53 -04:00
Scott James Remnant
390aa03440 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 ce0d932d9b)
2009-07-14 15:37:44 -04:00
Scott James Remnant
ecea18c7b2 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 92dd55c903)
2009-07-14 15:37:32 -04:00
Scott James Remnant
1617081d91 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 e5eb472d11)
2009-07-14 15:36:25 -04:00