Commit graph

3678 commits

Author SHA1 Message Date
Simon McVittie
f17fd1cc4e Define DBUS_COMPILATION externally for all tests that use internal stuff
It might as well go in the AM_CPPFLAGS rather than in the source code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:44 +01:00
Simon McVittie
ce334cb0d6 corrupt test: close connection before releasing GSocket
GSocket takes responsibility for closing the fd, and there doesn't
seem to be any way to tell it not to. When this test is adapted to run
under DBusLoop as an alternative to dbus-glib, that becomes a problem,
because DBusLoop/DBusSocketSetEpoll do not tolerate that. Work around it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:37 +01:00
Simon McVittie
cae26e9fac _dbus_become_daemon: don't pretend it worked
This function is meaningless (and possibly unimplementable) on Windows.
We shouldn't call it; if we do, it should raise an error.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:31 +01:00
Simon McVittie
732021af1b Allow dbus-daemon --nofork on Windows
On Windows, the dbus-daemon is not able to fork (daemonize). If someone
explicitly requests forking, it should fail, but if someone
explicitly requests *not* forking, there seems no harm in allowing it.

A few of the regression tests specifically require a dbus-daemon that
will not fork, so allowing this option on Windows means those tests
don't need an extra OS condition.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 12:00:09 +01:00
Simon McVittie
21a60c993b Fix declaration of _dbus_win_startup_winsock
This regressed in commit b7a91bfd.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03 11:59:46 +01:00
Simon McVittie
b119fc4a14 Fix unused function when SELinux is not enabled
It must be one of the "only smcv tests this" configurations...
2013-08-30 17:41:33 +01:00
Simon McVittie
3e35c91fd8 Move some sysdeps stuff only used by the dbus-daemon outside libdbus
This means we don't need to worry about whether it's thread-safe,
and makes libdbus a little smaller.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:45 +01:00
Simon McVittie
765c9ebc59 _dbus_check_setuid: comment on thread-safety
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:44 +01:00
Simon McVittie
b7a91bfd46 _dbus_win_startup_winsock: be thread-safe
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:42 +01:00
Simon McVittie
53966707ae Comment some suspicious uses of static variables
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:40 +01:00
Simon McVittie
e63961b750 _dbus_get_autolaunch_address: don't make argv static
This function could be accessed from any thread, which would mean it
scribbles on argv twice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:39 +01:00
Simon McVittie
cc28d8d910 _dbus_file_path_extract_elements_from_tail: don't misuse static variable
If we _dbus_verbose() from more than one thread at the same time,
we don't want to get into trouble with static variables (and I don't
think micro-optimizing this function is really worth it anyway).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-30 17:32:15 +01:00
Simon McVittie
31edd76313 Revert "Add a statically-initialized implementation of _dbus_lock() on glibc systems"
This reverts commit 83aaa9f359.

This wasn't right: because it looked for a symbol from pthread.h,
modules could end up disagreeing about whether threading was enabled or
not.
2013-08-30 17:31:16 +01:00
Simon McVittie
d98a587f76 _dbus_get_tmpdir: be thread-safe
Sharing a static variable between threads is not safe in general,
and this function is used in the shared libdbus (for nonce files),
so it can't rely on being single-threaded.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68610
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-29 12:30:02 +01:00
Simon McVittie
ced50f8be1 libdbus-1.la: have proper dependencies on Windows
Assigning to libdbus_1_la_DEPENDENCIES defeats Automake's normal
dependency logic, which makes libdbus-1.la depend on all the
static libraries that will go into it (it still had a corrct dependency
on the other objects, which go through a separate variable).
This meant libdbus-init-win wasn't necessarily built first.

Use EXTRA_libdbus_1_la_DEPENDENCIES to avoid that problem.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68505
Acked-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-29 11:35:52 +01:00
Ralf Habacker
b1579df4ce Generate autotools provided PACKAGE_.. and VERSION defines by a cmake macro.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67072
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-28 14:50:57 +02:00
Ralf Habacker
5366a920f4 Fixed mingw gcc 4.8.1 complains about double defined macros.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67072
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-28 10:53:54 +02:00
Ralf Habacker
e1bc016458 Fixed gcc 4.8.1 -Wformat warnings on windows.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67072
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-28 10:43:28 +02:00
Chengwei Yang
28f15d8b21 Fix debug output about dbus server ref count
dbus_server_disconnect() invokes dbus_server_unref() at the end of
function, the latter will print a trace about server ref count decrease
1. However, it doesn't invoke dbus_server_ref(), so there isn't a trace
about server ref count increase in debug output.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 12:00:25 +01:00
Chengwei Yang
d61daf50ce Fix comment about atomic operations
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 11:59:23 +01:00
Chengwei Yang
8203fe35da Cleanup: simplify assertion check
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 11:54:34 +01:00
Simon McVittie
fa783ea4ea fix whitespace 2013-08-23 11:54:01 +01:00
Chengwei Yang
7781931109 Cleanup: polish inotify backend
At previous, it will do get pid and print a verbose string per inotify
event, and then do send signal to the daemon.

This patch changes the behavior to get pid and print a verbose string
one time.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68303
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 11:53:39 +01:00
Chengwei Yang
82600c61dc Cleanup: polish verbose mode checking
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 11:51:18 +01:00
Simon McVittie
73ded5c619 NEWS
Also belatedly mention dbus-run-session in 1.7.4.
2013-08-23 11:46:36 +01:00
Chengwei Yang
fe45937648 DBus Spec: fix examples namespace to com.example
There are a lot of examples in DBus Spec, and some of them just use the
namespace org.freedesktop, and so as object namespace org/freedesktop.
However, this is quite confusing.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66481
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 11:41:21 +01:00
Simon McVittie
5ee72fe2e1 dbus-run-session: remove various extra variables from the environment
DBUS_SESSION_BUS_PID is not mandatory to set, but we should unset it
if present, since it points to a different session's bus. Likewise for
DBUS_SESSION_BUS_WINDOWID.

Similarly, if DBUS_STARTER_BUS_TYPE and DBUS_STARTER_ADDRESS
are set (as they would be under GNOME Terminal 3.8, see
<https://bugs.freedesktop.org/show_bug.cgi?id=63119>) then they
are likely to point to a different session's bus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2013-08-23 11:41:16 +01:00
Simon McVittie
412538b3b9 Export dbus_setenv() as a utility function
It's sufficiently portable that GLib has an equivalent, and I really
don't want to have to either open-code it in dbus-run-session or
link dbus-run-session statically. We have enough statically-linked
rubbish already.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39196
Reviewed-by: Colin Walters <walters@verbum.org>
2013-08-23 11:40:50 +01:00
Simon McVittie
30fa2e1ace Revert "Factor out DBusAuthorization from DBusTransport"
This reverts commit 600621dbc8.
2013-08-23 11:10:41 +01:00
Simon McVittie
414cb42dee Revert "Actually use DBusAuthorization in DBusAuth EXTERNAL mech"
This reverts commit d5d25b5efd.
2013-08-23 11:10:41 +01:00
Simon McVittie
75f5b682cc Revert "Add new files really."
This reverts commit 78c447173d.
2013-08-23 11:10:41 +01:00
Simon McVittie
383f596c4a Revert "Rename authorized_identity in authenticated_identity for clarity sake."
This reverts commit ef82b38152.
2013-08-23 11:10:40 +01:00
Simon McVittie
083169744b Revert "Fixed rejected hunk complete."
This reverts commit 541063a3ab.
2013-08-23 11:10:40 +01:00
Simon McVittie
e5f16e5716 Revert "Enable anonymous authorization for tests"
This reverts commit 22fc03d274.
2013-08-23 11:10:40 +01:00
Simon McVittie
3006b952db Revert "Remove refcounting from DBusAuth and DBusAuthorization"
This reverts commit 7f6d7229d8.
2013-08-23 11:10:40 +01:00
Simon McVittie
bb9e5f65e7 Revert "dbus_connection_set_allow_anonymous(): fix doc"
This reverts commit a4722d4480.
2013-08-23 11:10:40 +01:00
Simon McVittie
b75b6c4202 Revert "trivial: re-word authorization failure message"
This reverts commit 65cd1208e0.
2013-08-23 11:10:40 +01:00
Simon McVittie
f9b4432dbb Revert "Remove transport's call to _dbus_authorization_do_authorization()."
This reverts commit 64e50dd167.
2013-08-23 11:09:21 +01:00
Cosimo Alfarano
64e50dd167 Remove transport's call to _dbus_authorization_do_authorization().
All mechs do authorization before answering OK/REJECT.
There is no reason to run a second round of authorization which will
return the same answer of the first time (when OK) or will never be
reched (if REJECTed).

Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 03:55:10 +02:00
Ralf Habacker
5fcba306d9 Manual rebase fix. 2013-08-23 03:10:15 +02:00
Simon McVittie
71cfa9cdd0 Add a test-case for trying to connect with the wrong GUID
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 03:03:30 +02:00
Simon McVittie
65cd1208e0 trivial: re-word authorization failure message
Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-23 03:02:14 +02:00
Simon McVittie
9c0a70f5a3 Add a simple manual test for authentication/authorization.
Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-23 02:57:50 +02:00
Cosimo Alfarano
a4722d4480 dbus_connection_set_allow_anonymous(): fix doc
Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-23 02:18:47 +02:00
Cosimo Alfarano
7f6d7229d8 Remove refcounting from DBusAuth and DBusAuthorization
Those structs are for DBusTransport internal use, they should not be
referenced outside it.
The transport needs only to allocate memory on initialization and free
it on finalization.
The lifecycle for the two allocated structs is DBusTransport lifecycle
and at DBusTransport's finalization its connection is already
disconnected.
The assumption is that the transport owns a reference for any object the
two structs holds a reference for (particularly DBusConnection)

Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 02:14:28 +02:00
Cosimo Alfarano
22fc03d274 Enable anonymous authorization for tests
Now that authorization is in SASL mechs, enable anonymous authorizations
when we are testing anonymous mechs functionality

Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 01:48:23 +02:00
Ralf Habacker
541063a3ab Fixed rejected hunk complete. 2013-08-23 01:46:56 +02:00
Cosimo Alfarano
ef82b38152 Rename authorized_identity in authenticated_identity for clarity sake.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 01:43:27 +02:00
Ralf Habacker
78c447173d Add new files really. 2013-08-23 01:37:55 +02:00
Cosimo Alfarano
d5d25b5efd Actually use DBusAuthorization in DBusAuth EXTERNAL mech
Also update the authentication script so that DBusAuthorization default
rules are used during testing.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 01:31:47 +02:00