Commit graph

2638 commits

Author SHA1 Message Date
Simon McVittie
fb704ba78f update_desktop_file_entry: use _dbus_strdup for something we'll dbus_free
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
2011-02-16 14:47:08 +00:00
Simon McVittie
02b0fa5792 NEWS so far for 1.4.4 2011-02-16 12:37:59 +00:00
Lennart Poettering
509a2e899a build-sys: ignore -Waddress message so that build works on gcc/rawhide
Newer gccs warn if you compare an address of a variable that is allocated
on the stack or is static with NULL. Since we compile dbus with -Werror
this causes the build to fail since we do this check all the time due to
macros such as _DBUS_ASSERT_ERROR_IS_SET().
2011-02-15 13:29:31 +01:00
Matthias Clasen
51e0e91115 Fix syslog string processing
squash_string_nonprintable didn't actually modify the string.

Reviewed-By: Colin Walters <walters@verbum.org>
2011-02-14 11:32:03 -05:00
Colin Walters
66a09fa7c3 bus: Raise file descriptor limit to match configuration
The default configuration has hardcoded 2048 complete connections,
and 64 incomplete.  We need at least that number of file descriptors,
plus some for internal use.

In the bus, attempt to call setrlimit() before we drop privileges.
Practically speaking for this means the system bus gets it, the
session bus doesn't.

http://bugs.freedesktop.org/show_bug.cgi?id=33474

Reviewed-By: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-02-03 13:25:34 -05:00
Simon McVittie
a0e8ae3b77 Merge branch 'dist-30285' into dbus-1.4
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-02-02 15:15:02 +00:00
Simon McVittie
9fee6d735e Merge branch 'serverdata-33277' into dbus-1.4
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-02-02 15:14:31 +00:00
Simon McVittie
f7ecd2fb8b Ignore files produced by make dist 2011-02-01 18:04:35 +00:00
Simon McVittie
27f29026c2 Don't distribute generated files that embed our builddir
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30285
2011-02-01 18:04:21 +00:00
Simon McVittie
3a380137c0 bus-test: add support for only running one test
This is much quicker when valgrinding.

Reviewed-by: Colin Walters <walters@verbum.org>
2011-02-01 11:47:43 +00:00
Simon McVittie
743e79d1dc dbus_bus_set_unique_name, dbus_bus_get_unique_name: remember to unlock on OOM
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33126
Reviewed-by: Colin Walters <walters@verbum.org>
2011-02-01 11:41:02 +00:00
Simon McVittie
7480dfdb2a If a file included via <includedir/> is invalid, syslog and skip it
This is more graceful than failing entirely (our previous behaviour),
but more visible than ignoring it completely (the previous behaviour
patched in by Debian and derivatives).

Based on a patch from Daniel Silverstone back in 2004, which was meant
to be temporary; I think it makes sense to change this permanently,
since files in *.d are typically supplied by other packages, whose bugs
shouldn't be able to bring down dbus-daemon.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=19186
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=230231
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-31 19:16:00 +00:00
Alban Crequy
4d93cc858c Implement message type in match_rule_to_string
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-31 15:31:11 +00:00
Simon McVittie
ab058c4a31 Opt-in to thread safety on Solaris
Alternatively, get a better C library. :-)

See also:
<http://lists.freedesktop.org/archives/dbus/2010-November/013796.html>,
<http://lists.freedesktop.org/archives/dbus/2010-December/013902.html>.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33464
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-27 17:53:45 +00:00
Simon McVittie
799cef5f9e _dbus_server_new_for_tcp_socket: fix error handling
This is one of the patches from Maemo's dbus package. It seems to do all
of:

* fix some documentation
* remove unreached code to delete/free the nonce file from
  _dbus_server_new_for_socket - doing that on failure violates
  least-astonishment anyway
* in _dbus_server_new_for_tcp_socket, never fail without setting @error
* if we fail after creating the nonce file, delete it
* if we fail after allocating the nonce file struct, free it

Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-26 18:55:00 +00:00
Simon McVittie
96a6d14376 Make _dbus_directory_get_next_file use readdir, not readdir_r
This isn't thread-safe or reentrant, but it turns out we don't need
either of those properties, and readdir_r is a real pain to use correctly,
particularly in the presence of FUSE filesystems that might implement
statfs() wrong.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=8284
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=15922
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-01-25 13:18:15 +00:00
Simon McVittie
a431ced679 test/name-test: remove dangling references to test-names.c, which is absent
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-01-25 13:18:03 +00:00
Simon McVittie
d855baed00 fix check for 32-bit integers if short is 32 bits long
In practice, this won't happen for years, but we might as well be correct.

Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-01-25 13:17:44 +00:00
Simon McVittie
460e6282d6 _dbus_loop_iterate: if the kernel says a fd is bad, stop watching it
Again, this shouldn't happen - modules are responsible for cleaning up
their watches - but the failure mode here is really bad: if we leave an
invalid fd in the set, every poll() call will instantly return, marking
it as POLLNVAL. The result is that dbus-daemon busy-loops on poll()
without responding to I/O, so the bad watch will probably never be
cleared up.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32992
Bug-NB: NB#200248
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-21 15:01:37 +00:00
Simon McVittie
f3ed53a30f _dbus_loop_iterate: cleanup: make more use of a temporary variable
It was added by the previous commit.

Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-21 15:01:24 +00:00
Simon McVittie
f740396874 _dbus_loop_iterate: if a watch has been invalidated, skip it
This shouldn't happen - other modules are responsible for cleaning up
their watches - but the bug fixed in my last commit has been present for
several years and I'm sure it's not the only one, so for robustness,
let's refuse to watch obviously-wrong file descriptors.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32992
Bug-NB: NB#200248
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-21 15:01:16 +00:00
Simon McVittie
ca18baf83a dbus-spawn: don't leave bad file descriptors being watched
The code called from handle_watch() might close either or both of the
sockets we're watching, without cleaning up the DBusWatch. This results
in invalid file descriptors being passed to _dbus_poll(), which could
end up busy-looping on a POLLNVAL condition until the babysitter loses
its last ref (which automatically clears up both watches).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32992
Bug-NB: NB#200248
Reviewed-by: Colin Walters <walters@verbum.org>
2011-01-21 15:00:25 +00:00
Simon McVittie
4fa3a89d32 test-privserver-client: wait for server to die between iterations
This fixes a race condition: the server exits while the client continues
to the next iteration. If the server wins, the test passes. If the client
wins, it sends a message to the dying service, never gets a reply, and the
test fails.

My branch to refactor the main loop for fd.o #23194 seems to make the
client more likely to win this race, resulting in intermittent test
failures.

This is an instance of the general problem described by fd.o #11454.
2011-01-21 14:22:39 +00:00
Simon McVittie
a9327eba3c test_server_shutdown: disconnect the server before causing it to be freed
Otherwise we die with an assertion failure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33277
2011-01-21 14:22:39 +00:00
Simon McVittie
e529c4bcdb test_server_setup: allocate two server-data blobs, for watches and timeouts
This is similar to how ConnectionData works. Without this change, we
deserve to segfault: when the first set of callbacks (either watches or
timeouts) is cleaned up, we unref the server and loop, and free sd;
when the second set of callbacks is cleaned up, we use-after-free sd,
the server and the loop, then double-free sd.

However, due to fd.o #33277 we don't even get that far, because we've
already died with an assertion failure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33277
2011-01-21 14:22:39 +00:00
Simon McVittie
c894f62f2c test_server_setup: on OOM while setting up watch/timeout, don't leak sd
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Reviwed-by: Colin Walters <walters@verbum.org>
2011-01-21 13:28:08 +00:00
Simon McVittie
edaa6fe253 _dbus_read_credentials_socket: support OpenBSD
OpenBSD SO_PEERCRED is nearly the same as Linux SO_PEERCRED, but the
struct is named differently. Sigh.

Based on a patch from 'ajacoutot'.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32542
2011-01-21 13:27:18 +00:00
Richard A. Hankins
57fab1c219 fix bad DBusMessageIter doc example
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=11190
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-19 16:01:49 +00:00
Lennart Poettering
2bfed4cc54 systemd: ensure that the system bus is unlikely to be killed on OOM 2011-01-18 23:46:15 +01:00
Simon McVittie
16cc54d958 _dbus_listen_tcp_socket: unify cleanup for EADDRINUSE and other failures
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
2011-01-18 16:07:24 +00:00
Christian Dywan
40b1fc5fff _dbus_listen_tcp_socket: free listen_fd in the error case
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-18 16:00:05 +00:00
Wulf C. Krueger
4e411da35f Fix failure in configure test for abstract sockets
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29895
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 19:49:06 +00:00
Christian Dywan
a144bf4989 clean up credentials on OOM in process_config_first_time_only
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:41:15 +00:00
Simon McVittie
a8302efd2c dbus-cleanup-sockets: free list of socket entries
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:18:40 +00:00
Simon McVittie
69c0c06e35 remove obviously-redundant code from list_concat_new
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:04:09 +00:00
Christian Dywan
0f67e86308 handle failure to register inotify shutdown function
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 12:02:30 +00:00
Christian Dywan
85cb8414ff bus_matchmaker_new: free matchmaker itself, on OOM
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 11:58:26 +00:00
Christian Dywan
6520ecde58 dbus-nonce: check results of _dbus_string_init for OOM
Origin: vendor, Maemo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33128
Bug-NB: NB#180486
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-17 11:54:08 +00:00
Simon McVittie
84d4ed242a Merge branch 'tmp'
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32854
2011-01-14 15:19:23 +00:00
Simon McVittie
5b6369d783 Remove vestigial support for $INTLLIBS
We no longer call AM_GLIB_GNU_GETTEXT or use gettext directly.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=25306
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2011-01-14 15:18:19 +00:00
Simon McVittie
e870df7b82 Add autolaunch test to .gitignore 2011-01-06 17:35:35 +00:00
Simon McVittie
297919ae61 cmake/cross-compile.sh: use mktemp(1) to avoid a symlink attack in /tmp 2011-01-05 19:10:43 +00:00
Simon McVittie
c71f1e9657 Fix the check for -Wfloat-equal 2011-01-05 19:10:24 +00:00
Simon McVittie
d83d74dc68 configure.in: use AC_TRY_COMPILE to avoid a symlink attack in /tmp during compilation 2011-01-05 19:10:12 +00:00
Christian Dywan
916620ea96 Free session file early in dbus-launch
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-05 14:55:42 +00:00
Christian Dywan
68b1d6ad5f Verify that getsockname succeeded in _dbus_listen_tcp_socket
Bug: https://bugs.freedesktop.org//show_bug.cgi?id=29881
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-01-05 14:51:03 +00:00
Christian Dywan
14be9f738b Handle failure to allocate error message in _read_subprocess_line_argv
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
2011-01-05 14:47:12 +00:00
Christian Dywan
79b4e478d7 Check return value of XGetWindowProperty in x11_get_address
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29881
2011-01-05 14:42:45 +00:00
Cristian Rodríguez
e2be7b92a6 Annotate dbus_malloc*() functions with __attribute__ malloc and __attribute__ alloc_size
This improves optimization as well catches buffer overflows at compile time.

code like:

foo = dbus_malloc(2);
strcpy(foo, "epicfail");

will emit:

"warning ... will always overflow the destination buffer..."

Signed-off-by: Cristian Rodríguez <cristian.rodriguez@opensuse.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32710
2011-01-05 13:13:48 +00:00
Will Thompson
56d8d4f58e connection: correct HAVE_DECL_MSG_NOSIGNAL guard
Helpfully, AC_CHECK_DECLS (which configure.in uses to define
HAVE_DECL_MSG_NOSIGNAL) behaves differently to every similar AC_CHECK_*
macro and, rather than producing #undef HAVE_DECL_MSG_NOSIGNAL if the
given symbol is not found, instead produces #define
HAVE_DECL_MSG_NOSIGNAL 0.

Mike McQuaid's patch fixes the uses of this constant in sysdeps-unix;
with this patch, all code is guarded consistently and correctly.
2011-01-05 12:08:57 +00:00