platform/upstream/dbus.git
14 years agoFix inotify shutdown
Colin Walters [Tue, 2 Feb 2010 17:37:17 +0000 (12:37 -0500)]
Fix inotify shutdown

We were incorrectly passing NULL for a DBusList when the usage expected
is a pointer to a NULL DBusList pointer.  Also during dbus_shutdown
we need to actually close the inotify fd, and remove our watch.

Move the shutdown handler out of bus.c and into inotify where we
can do all of this cleanly.

14 years agoRelease 1.2.18 dbus-1.2.18
Colin Walters [Tue, 2 Feb 2010 15:31:28 +0000 (10:31 -0500)]
Release 1.2.18

14 years agoUse monotonic clock for _dbus_get_current_time() if it's available.
Tom Hughes [Sun, 13 Dec 2009 21:30:09 +0000 (13:30 -0800)]
Use monotonic clock for _dbus_get_current_time() if it's available.

_dbus_get_current_time() is used for timeouts, but uses gettimeofday(), which
relies on the wall clock time, which can change. If the time is changed forwards
or backwards, the timeouts are no longer valid, so the monotonic clock must be used.

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

Signed-off-by: Colin Walters <walters@verbum.org>
14 years agoDon't crash when reloading if we haven't loaded user database yet
Colin Walters [Mon, 1 Feb 2010 22:38:25 +0000 (17:38 -0500)]
Don't crash when reloading if we haven't loaded user database yet

The user database is populated on-demand, but the cache dropping
code assumed it had been initialized.  Simply check for NULL.

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

14 years agoMove system-activation.txt into non-conditional EXTRA_DIST
Colin Walters [Mon, 1 Feb 2010 21:45:48 +0000 (16:45 -0500)]
Move system-activation.txt into non-conditional EXTRA_DIST

It doesn't depend on the XML doc generation.

14 years agoClean up inotify watch handling
Colin Walters [Thu, 28 Jan 2010 21:26:39 +0000 (16:26 -0500)]
Clean up inotify watch handling

Substantially based on a patch by Matthias Clasen <mclasen@redhat.com>
kqueue implementation by Joe Marcus Clarke <marcus@freebsd.org>

Previously, when we detected a configuration change (which included
the set of config directories to monitor for changes), we would
simply drop all watches, then readd them.

The problem with this is that it introduced a race condition where
we might not be watching one of the config directories for changes.

Rather than dropping and readding, change the OS-dependent monitoring
API to simply take a new set of directories to monitor.  Implicit
in this is that the OS-specific layer needs to keep track of the
previously monitored set.

14 years agoUpdate messagebus.in init script to start earlier
Colin Walters [Thu, 28 Jan 2010 22:31:36 +0000 (17:31 -0500)]
Update messagebus.in init script to start earlier

Patch from Fedora.

14 years ago[doc] diagram.[svg,png] to EXTRA_DIST
Colin Walters [Thu, 28 Jan 2010 22:28:25 +0000 (17:28 -0500)]
[doc] diagram.[svg,png] to EXTRA_DIST

These files are part of the docs and should appear in tarballs.

14 years agoDon't drop pending activations when reloading configuration
Colin Walters [Thu, 28 Jan 2010 20:04:14 +0000 (15:04 -0500)]
Don't drop pending activations when reloading configuration

The reload handling for activation simply dropped all knowledge
of pending activations, which was clearly wrong.  Refactor things
so that reload only reloads directories, server address etc.

Based on a patch originally from Matthias Clasen <mclasen@redhat.com>

14 years agoSwitch to libcap-ng, avoid linking libdbus against libcap[-ng]
Colin Walters [Thu, 28 Jan 2010 00:38:44 +0000 (19:38 -0500)]
Switch to libcap-ng, avoid linking libdbus against libcap[-ng]

(Commit message written by Colin Walters <walters@verbum.org>)

A current Fedora goal is to convert projects to libcap-ng which
more easily allows dropping Linux capabilities.  For software
which also links to libdbus, it's problematic to link against
libcap as well.

Though really, libdbus should have never linked against libcap
in the first place, which is another thing this patch changes
by moving the libcap-using bits out of dbus/ and into bus/.

https://bugzilla.redhat.com/show_bug.cgi?id=518541

14 years agoAdd Will Thompson and Simon McVittie to reviewers, add emails to all
Colin Walters [Fri, 15 Jan 2010 21:57:39 +0000 (16:57 -0500)]
Add Will Thompson and Simon McVittie to reviewers, add emails to all

The reviewer list was sorely lacking actual email addresses; fix this.
Also add Will and Simon.

14 years agoIgnore exit code zero from activated services
Colin Walters [Mon, 14 Dec 2009 23:12:24 +0000 (18:12 -0500)]
Ignore exit code zero from activated services

A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode@redhat.com>

14 years agoPrint all-printable-ASCII byte arrays as strings
Will Thompson [Wed, 28 Oct 2009 19:40:38 +0000 (19:40 +0000)]
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.

14 years agoPrint byte arrays as nicely-formatted hex.
Will Thompson [Wed, 9 Sep 2009 19:58:53 +0000 (20:58 +0100)]
Print byte arrays as nicely-formatted hex.

14 years agoAdd an accessor for the loader's corruption reason
Will Thompson [Sat, 8 Aug 2009 13:29:12 +0000 (14:29 +0100)]
Add an accessor for the loader's corruption reason

14 years agoInclude reason when reporting corrupt messages
Will Thompson [Sat, 8 Aug 2009 12:57:11 +0000 (13:57 +0100)]
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".

14 years agoForbid zero serial numbers
Will Thompson [Sat, 8 Aug 2009 13:03:46 +0000 (14:03 +0100)]
Forbid zero serial numbers

14 years agoMake array-printing code easier to follow
Will Thompson [Wed, 9 Sep 2009 19:35:13 +0000 (20:35 +0100)]
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.

14 years agoCorrect timeout handling
James Westby [Thu, 1 Oct 2009 14:09:54 +0000 (15:09 +0100)]
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>
14 years agoBug 23502 - corrected wrong verbose-output
Hendrik Buschmeier [Thu, 28 Jan 2010 10:22:32 +0000 (11:22 +0100)]
Bug 23502 - corrected wrong verbose-output

14 years agoBug 25697 - Fix memory leak in policy reload
Matthias Clasen [Fri, 18 Dec 2009 19:29:40 +0000 (14:29 -0500)]
Bug 25697 - Fix memory leak in policy reload

Signed-off-by: Colin Walters <walters@verbum.org>
14 years agoBug 23977 - dbus-launch --exit-with-session not killing dbus-daemon on SIGINT
Sascha Silbe [Fri, 16 Oct 2009 19:20:43 +0000 (15:20 -0400)]
Bug 23977 - dbus-launch --exit-with-session not killing dbus-daemon on SIGINT

Handle SIGINT in the same way we handle SIGTERM.

14 years agoFix link order: system libraries should come after libdbus-convenience
Colin Watson [Fri, 18 Sep 2009 17:23:39 +0000 (18:23 +0100)]
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.

14 years agodbus-monitor: use unbuffered stdout instead of handling SIGINT
Lennart Poettering [Fri, 31 Jul 2009 16:26:57 +0000 (12:26 -0400)]
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>
14 years agoBug 22805 - Fix build with -Wl,--as-needed
Colin Walters [Thu, 30 Jul 2009 13:48:20 +0000 (09:48 -0400)]
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.

15 years agoBug 19432 followup - Fix Debian/FreeBSD CMSGCRED compilation
Aurelien Jarno [Thu, 16 Jul 2009 13:35:27 +0000 (09:35 -0400)]
Bug 19432 followup - Fix Debian/FreeBSD CMSGCRED compilation

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 agoconfigure.in: fail abstract socket test gracefully when cross-compiling
Marc Mutz [Wed, 7 Jan 2009 11:46:53 +0000 (12:46 +0100)]
configure.in: fail abstract socket test gracefully when cross-compiling

 * configure.in: only run AC_CACHE_CHECK if enable_abstract_sockets=auto
 * configure.in: warn that, when cross-compiling, we're unable to detect
                 abstract sockets availability automatically

Signed-off-by: Thiago Macieira <thiago@kde.org>
15 years agoconfigure.in: not all gccs support -Wno-pointer-sign
Marc Mutz [Fri, 17 Apr 2009 14:23:42 +0000 (16:23 +0200)]
configure.in: not all gccs support -Wno-pointer-sign

Signed-off-by: Thiago Macieira <thiago@kde.org>
15 years agoRelease 1.2.14 dbus-1.2.14
Colin Walters [Mon, 27 Apr 2009 16:13:25 +0000 (12:13 -0400)]
Release 1.2.14

15 years agolibselinux behavior in permissive mode wrt invalid domains
Eamon Walsh [Tue, 21 Apr 2009 23:11:22 +0000 (19:11 -0400)]
libselinux behavior in permissive mode wrt invalid domains

Stephen Smalley wrote:
> On Tue, 2009-04-21 at 16:32 -0400, Joshua Brindle wrote:
>
>> Stephen Smalley wrote:
>>
>>> On Thu, 2009-04-16 at 20:47 -0400, Eamon Walsh wrote:
>>>
>>>> Stephen Smalley wrote:
>>>>
>> <snip>
>>
>>
>>> No, I don't want to change the behavior upon context_to_sid calls in
>>> general, as we otherwise lose all context validity checking in
>>> permissive mode.
>>>
>>> I think I'd rather change compute_sid behavior to preclude the situation
>>> from arising in the first place, possibly altering the behavior in
>>> permissive mode upon an invalid context to fall back on the ssid
>>> (process) or the tsid (object).  But I'm not entirely convinced any
>>> change is required here.
>>>
>>>
>> I just want to follow up to make sure we are all on the same page here. Was the
>> suggestion to change avc_has_perm in libselinux or context_to_sid in the kernel
>> or leave the code as is and fix the callers of avc_has_perm to correctly handle
>> error codes?
>>
>> I prefer the last approach because of Eamon's explanation, EINVAL is already
>> passed in errno to specify the context was invalid (and if object managers
>> aren't handling that correctly now there is a good chance they aren't handling
>> the ENOMEM case either).
>>
>
> I'd be inclined to change compute_sid (not context_to_sid) in the kernel
> to prevent invalid contexts from being formed even in permissive mode
> (scenario is a type transition where role is not authorized for the new
> type).  That was originally to allow the system to boot in permissive
> mode.  But an alternative would be to just stay in the caller's context
> (ssid) in that situation.
>
> Changing the callers of avc_has_perm() to handle EINVAL and/or ENOMEM
> may make sense, but that logic should not depend on enforcing vs.
> permissive mode.
>
>

FWIW, the following patch to D-Bus should help:

bfo21072 - Log SELinux denials better by checking errno for the cause

    Note that this does not fully address the bug report since
    EINVAL can still be returned in permissive mode.  However the log
    messages will now reflect the proper cause of the denial.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Colin Walters <walters@verbum.org>
15 years agobfo20738 - Return a useful error message from dbus_signature_validate()
Federico Mena Quintero [Wed, 18 Mar 2009 22:17:00 +0000 (16:17 -0600)]
bfo20738 - Return a useful error message from dbus_signature_validate()

Signed-off-by: Federico Mena Quintero <federico@novell.com>
15 years agobfo20738 - Translate DBusValidity into error message
Federico Mena Quintero [Wed, 18 Mar 2009 22:15:23 +0000 (16:15 -0600)]
bfo20738 - Translate DBusValidity into error message

Signed-off-by: Federico Mena Quintero <federico@novell.com>
15 years agoBug 19567 - Make marshaling code usable without DBusConnection
William Lachance [Tue, 21 Apr 2009 17:51:46 +0000 (13:51 -0400)]
Bug 19567 - Make marshaling code usable without DBusConnection

Some projects want to reuse the DBus message format, without
actually going through a DBusConnection.  This set of changes
makes a few functions from DBusMessage public, and adds a new
function to determine the number of bytes needed to demarshal
a message.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoFollowup Bug 19502 - Don't attempt to init va_list, not portable
Colin Walters [Tue, 21 Apr 2009 17:11:54 +0000 (13:11 -0400)]
Followup Bug 19502 - Don't attempt to init va_list, not portable

15 years agoBug 19502 - Sparse warning cleanups
Kjartan Maraas [Tue, 21 Apr 2009 16:52:22 +0000 (12:52 -0400)]
Bug 19502 - Sparse warning cleanups

This patch makes various things that should be static static,
corrects some "return FALSE" where it should be NULL, etc.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agodbus-launch: use InputOnly X window
Eamon Walsh [Fri, 20 Mar 2009 04:26:42 +0000 (00:26 -0400)]
dbus-launch: use InputOnly X window

Working on SELinux policy for X, and came across this issue in dbus-launch:

Windows created for use as property/selection placeholders should be of
class InputOnly, since no drawing is ever done to them.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Thiago Macieira <thiago@kde.org>
15 years agoBug 20494 - Fix signed confusion for dbus_message_get_reply_serial return
Johan Gyllenspetz [Tue, 17 Mar 2009 21:26:03 +0000 (17:26 -0400)]
Bug 20494 - Fix signed confusion for dbus_message_get_reply_serial return

We were incorrectly converting the serial to a signed integer
and comparing it to -1.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 20137 - Fix alignment usage when demarshaling basics
Colin Walters [Wed, 25 Feb 2009 16:10:15 +0000 (11:10 -0500)]
Bug 20137 - Fix alignment usage when demarshaling basics

We can't safely type-pun from e.g. char * to DBusBasicValue *, because
the latter has higher alignment requirements.  Instead, create an
explicit pointer for each case.

Also, we mark each one volatile to sidestep strict aliasing issues, for
the future when we turn on strict aliasing support.

Original patch and review from Jay Estabrook <jay.estabrook@hp.com>.

15 years agoAlways append closing quote in log command
Colin Walters [Thu, 12 Mar 2009 14:31:54 +0000 (10:31 -0400)]
Always append closing quote in log command

Patch suggested by Tomas Hoger <thoger@redhat.com>

15 years agoBug 17803 - Fix both test case and validation logic
Colin Walters [Wed, 1 Apr 2009 16:02:00 +0000 (12:02 -0400)]
Bug 17803 - Fix both test case and validation logic

The previous commit had errors in both the test case and
the validation logic.  The test case was missing a trailing
comma before the previous one, so we weren't testing the
signature we thought we were.

The validation logic was wrong because if the type was not valid,
we'd drop through the entire if clause, and thus skip returning
an error code, and accept the signature.

15 years agoconfigure.in: fix help string alignment
Marc Mutz [Mon, 20 Apr 2009 11:47:59 +0000 (13:47 +0200)]
configure.in: fix help string alignment

* AC_ARG_ENABLE(libaudit: use AS_HELP_STRING for aligned help messages

Signed-off-by: Thiago Macieira <thiago@kde.org>
(cherry picked from commit 660073925b03cad2f6e95ba9f25a81c2d9727185)

15 years agoFix typo in docs.
Xan Lopez [Mon, 14 Apr 2008 12:46:33 +0000 (15:46 +0300)]
Fix typo in docs.

15 years agoBump for unstable cycle
Colin Walters [Wed, 7 Jan 2009 00:36:11 +0000 (19:36 -0500)]
Bump for unstable cycle

15 years agoRelease 1.2.12. dbus-1.2.12
Colin Walters [Wed, 7 Jan 2009 00:35:55 +0000 (19:35 -0500)]
Release 1.2.12.

15 years agoAdd Scott to HACKING
Colin Walters [Tue, 23 Sep 2008 18:56:41 +0000 (14:56 -0400)]
Add Scott to HACKING

15 years agoBug 17060: Explicitly hard fail if expat is not available
Colin Walters [Mon, 11 Aug 2008 20:50:39 +0000 (16:50 -0400)]
Bug 17060: Explicitly hard fail if expat is not available

* configure.in: Tweak libxml/expat detection and handling.

15 years agoBug 17969: Don't test for abstract sockets if explicitly disabled
Lionel Landwerlin [Sat, 18 Oct 2008 18:25:52 +0000 (14:25 -0400)]
Bug 17969: Don't test for abstract sockets if explicitly disabled
Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 18064 - more efficient validation for fixed-size type arrays
Jon Gosting [Tue, 11 Nov 2008 04:29:05 +0000 (23:29 -0500)]
Bug 18064 - more efficient validation for fixed-size type arrays

* dbus/dbus-marshal-validate.c: If an array is fixed size,
skip validation

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoInitialize AVC earlier so we can look up service security contexts
James Carter [Wed, 1 Oct 2008 20:40:33 +0000 (16:40 -0400)]
Initialize AVC earlier so we can look up service security contexts

* bus/bus.c: Initialize AVC earlier:
http://lists.freedesktop.org/archives/dbus/2008-October/010493.html

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoPrint serial in dbus-monitor
Michael Meeks [Fri, 29 Aug 2008 12:48:45 +0000 (08:48 -0400)]
Print serial in dbus-monitor

* tools/dbus-print-message.c: Print serial too.

Signed-off-by: Colin Walters <walters@verbum.org>
15 years ago[win32] Protect usage of SIGHUP with #ifdef
Tor Lillqvist [Thu, 18 Sep 2008 23:40:50 +0000 (19:40 -0400)]
[win32] Protect usage of SIGHUP with #ifdef

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 15412: Add --address option to dbus-send
Lawrence R. Steeger [Sat, 18 Oct 2008 18:50:49 +0000 (14:50 -0400)]
Bug 15412: Add --address option to dbus-send
Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoBug 18446: Keep umask for session bus
Matt McCutchen [Mon, 10 Nov 2008 13:55:27 +0000 (08:55 -0500)]
Bug 18446: Keep umask for session bus

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoFix cross-compiling with autotools.
Diego E. 'Flameeyes' Pettenò [Sun, 4 Jan 2009 00:16:50 +0000 (01:16 +0100)]
Fix cross-compiling with autotools.

The AC_CANONICAL_TARGET macro and the $target_os variables are used for the
target of compilers and other code-generation tools, and should not be used
during cross-compile of generic software. Replace them with
AC_CANONICAL_HOST and $host_os instead, as they should have been from the
start.

For a breakdown of what host, build and target machines are, please see
http://blog.flameeyes.eu/s/canonical-target .

15 years agoAvoid possible use of uninitialized variable
Peter Breitenlohner [Tue, 6 Jan 2009 21:48:39 +0000 (16:48 -0500)]
Avoid possible use of uninitialized variable

Signed-off-by: Colin Walters <walters@verbum.org>
15 years agoEnable -Werror by default with --enable-maintainer-mode, and change warnings
Colin Walters [Sat, 20 Dec 2008 01:02:14 +0000 (20:02 -0500)]
Enable -Werror by default with --enable-maintainer-mode, and change warnings

Important compiler warnings were being lost in the noise from warnings
we know about but aren't problems, and moreover made using -Werror
difficult.  Now we expect *all* developers and testers to be using
-Werror.

15 years agoVarious compiler warning fixes
Colin Walters [Fri, 19 Dec 2008 23:54:59 +0000 (18:54 -0500)]
Various compiler warning fixes

15 years agoBump for unstable cycle
Colin Walters [Fri, 19 Dec 2008 20:17:49 +0000 (15:17 -0500)]
Bump for unstable cycle

15 years agoRelease 1.2.10 dbus-1.2.10
Colin Walters [Fri, 19 Dec 2008 20:17:24 +0000 (15:17 -0500)]
Release 1.2.10

15 years agoAdd requested_reply to send denials, and connection loginfo to "would deny"
Colin Walters [Thu, 18 Dec 2008 00:29:39 +0000 (19:29 -0500)]
Add requested_reply to send denials, and connection loginfo to "would deny"

The requested_reply field is necessary in send denials too because
it's used in the policy language.  The connection loginfo lack in
"would deny" was just an oversight.

15 years agoAdd uid, pid, and command to security logs
Colin Walters [Wed, 17 Dec 2008 21:01:28 +0000 (16:01 -0500)]
Add uid, pid, and command to security logs

Extend the current security logs with even more relevant
information than just the message content.  This requires
some utility code to look up and cache (as a string)
the data such as the uid/pid/command when a connection is
authenticated.

15 years agoMerge commit '3d6abf64d0abb2718e082e120f14f8f923a4af59' into dbus-1.2
Colin Walters [Tue, 16 Dec 2008 17:29:04 +0000 (12:29 -0500)]
Merge commit '3d6abf64d0abb2718e082e120f14f8f923a4af59' into dbus-1.2

15 years agoAdd optional logging on allow rules
Colin Walters [Tue, 16 Dec 2008 16:57:27 +0000 (11:57 -0500)]
Add optional logging on allow rules

This lets us have a backwards compatibility allow rule but still easily
see when that rule is being used.