Commit graph

4417 commits

Author SHA1 Message Date
Simon McVittie
ff068fea60 Add NetBSD to the list of platforms where credentials-passing a pid should work
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Simon McVittie
57e67fc551 test_processid: only assert that it works if we expect it to work
Otherwise, this would fail on, for instance, QNX.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Patrick Welche
19dc604b2f whitespace/comment fixes
[originally part of the previous commit -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-11-06 14:29:50 +00:00
Patrick Welche
f26ade306c Implement NetBSD credentials-passing with LOCAL_PEEREID
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:50 +00:00
Simon McVittie
fc2fa25a3f dbus-daemon test: don't assert we pass uid/pid on unknown Unix platforms
We know that Linux, FreeBSD and OpenBSD are "first class citizens"
for credentials-passing, with NetBSD not far behind: people have
turned up on the bug tracking system and told us that tests passed.
On other Unixes, we can't really assert that it works, until someone
who runs them tells us that it worked for them.

Additions to these lists are welcome.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Patrick Welche <prlw1@cam.ac.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
Tested-by: Patrick Welche <prlw1@cam.ac.uk>
2014-11-06 14:29:43 +00:00
Simon McVittie
aebc247402 NEWS 2014-10-29 14:21:19 +00:00
Simon McVittie
595dc4f888 dbus-spawn: do not forget the exec() errno when the grandchild exits
As is already noted in a comment in
_dbus_babysitter_set_child_exit_error(), if the grandchild fails
to exec() the desired process, we get both CHILD_EXEC_FAILED (with
an errno) and CHILD_EXITED (with a status), and we want to report
the former, since it is more informative. However, clearing
sitter->errnum meant we lose the errno value.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24821
Reviewed-by: Ross Lagerwall
2014-10-29 14:16:58 +00:00
Simon McVittie
acec88f32a dbus-tutorial: replace the entire GLib section with "use GDBus"
Also provide links to relevant GLib and Qt documentation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=25140
2014-10-29 14:15:53 +00:00
Simon McVittie
2e4d069ac4 Stop asserting that we're not using the dummy lock implementation
That implementation no longer exists, so neither 0xABCDEF nor 0xABCDEF2
has any special meaning any more.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-10-29 14:12:38 +00:00
Simon McVittie
f541722f5a Use a better NoReply message for disconnection with reply pending
As an implementation detail, dbus-daemon handles this situation by
artificially triggering a timeout (even if its configured timeout for
method calls is in fact infinite). However, using the same debug message
for both is misleading, and can lead people who are debugging a service
crash to blame dbus-daemon instead, wasting their time.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=76112
2014-10-29 14:10:48 +00:00
Simon McVittie
dab9cbc502 dbus-sysdeps-unix: document the assumption that makes our use of credentials secure
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83499
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-10-29 14:06:42 +00:00
Simon McVittie
c7fdbe77dd Consistently save and restore errno
Some functions in dbus-transport-socket.c make a (wrapped)
socket syscall, then call other APIs, then test the result and
errno of the socket syscall.

This would break horribly if those "other APIs" overwrote errno with
their own value (... and this is part of why errno is an awful API).

Notably, if running under DBUS_VERBOSE, _dbus_verbose() is basically
fprintf(), which sets errno; and our Unix fd-passing support
makes calls of the form _dbus_verbose ("Read/wrote %i unix fds\n", n)
between the syscall and the result processing.

Maybe one day we'll convert all of dbus' syscall wrappers to either
raise a DBusError, or use the "negative errno" convention that systemd
borrowed from the Linux kernel, and in particular, we would need to
do that if we ever ported it to a platform where socket error reporting
was not basically errno. However, in practice everyone uses something
derived from BSD sockets, so "this sets errno, you know what errno is"
is a good enough internal API if we make sure to use it correctly.

Nothing calls _dbus_get_is_errno_nonzero(), so I just removed it instead
of converting it to the new calling convention.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83625
2014-10-29 14:02:37 +00:00
Simon McVittie
7bcfcec523 NEWS 2014-10-29 13:59:24 +00:00
Simon McVittie
13d8bc7629 Implement getter, setter for ALLOW_INTERACTIVE_AUTHORIZATION flag
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83449
Reviewed-by: Lennart Poettering
2014-10-28 17:11:18 +00:00
Patrick Welche
a400f9ac25 build: include dbus-sysdeps-unix.h for _dbus_fd_set_close_on_exec
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85563
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-28 17:10:52 +00:00
Simon McVittie
66b15d1779 dbus-spec, dbus-protocol: add ALLOW_INTERACTIVE_AUTHORIZATION flag
Heavily based on a patch from Lennart Poettering.

This is useful for authentication frameworks such as polkit, but this
flag is supposed to be generic, and not be bound to any implementation
of such a framework.

The dbus specification already clarifies that unknown flags must be
ignored, the reference implementation and the other implementations we
checked indeed ignore any new flags, hence we should be fine with
compatibility here.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83449
2014-10-28 15:03:06 +01:00
Ralf Habacker
8ad6a5575f Include test-dbus and test-bus in cmake 'make check' target.
Because test-dbus and test-bus lives in subdirectory dbus/bus, we need
to define make 'check' in top level source directory.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-24 18:49:44 +02:00
Simon McVittie
3d363220ad test-bus, test-dbus: close any inherited fds from caller
It is probably a bug for them to pass us any fds without close-on-exec;
but apparently CMake has this bug, and so does at least some NetBSD GUI
environment. Cope.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-10-24 18:48:18 +02:00
Simon McVittie
8fd6e561df cmake: only copy session.conf and system.conf into test data dir
Historically, CMake used the glob *.conf.in whereas Autotools listed
the files explicitly. This used to be equivalent, but broke down
when we added example-*.conf.in which are just snippets rather than
complete configuration files (they're intended to go in session.d
or system.d, or otherwise get included by the main config file).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-10-24 16:51:53 +02:00
Ralf Habacker
4564754a2f Add configure checks for accept4, dirfd, inotify_init1 and unix_fd_passing to cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-24 16:45:07 +02:00
Ralf Habacker
e8c5817a5b Add configure check for pipe2 to cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-17 14:45:30 +02:00
Simon McVittie
25d13297f8 NEWS 2014-10-14 14:12:14 +01:00
Alban Crequy
74b4f1d07a dbus-test-tool: add black-hole mode
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-14 13:53:59 +01:00
Alban Crequy
75b35badb7 dbus-test-tool spam: add --messages-per-conn=N
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-14 13:53:57 +01:00
Alban Crequy
10f8b67a9f Add dbus-test-tool, currently with "echo" and "spam" modes
This is installed by default, but easy to filter out for embedded systems
or whatever.

Based on earlier work by Simon McVittie and Will Thompson

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34140
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-14 13:53:54 +01:00
Simon McVittie
c88525f815 dbus_shutdown: document its effect on shared connections
In practice, the sort of applications that call dbus_shutdown()
(e.g. regression tests) will want to either use private connections,
or turn off exit-on-disconnect on the shared connection, or both.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=16924
2014-10-13 15:16:56 +01:00
Simon McVittie
eca46a2341 Do not claim that '*' resolves to INADDR_ANY on all OSs
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72296
2014-10-13 14:01:51 +01:00
Simon McVittie
c7b7d811c8 NEWS 2014-10-13 13:58:06 +01:00
Lennart Poettering
e26d35c641 spec: introduce new value "const" for EmitsChangedSignal annotation
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72958
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-13 13:56:56 +01:00
Simon McVittie
6e53e972ce NEWS 2014-10-13 13:52:12 +01:00
Руслан Ижбулатов
95fe17a96d Let pkg-config expand directory variables recursively
In particular this makes them more MinGW-friendly: pkg-config on Windows
has specific code to rewrite the ${prefix} when installed in a
different prefix.

[add @datarootdir@, expand commit message -smcv]

Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75858
2014-10-13 13:41:36 +01:00
Simon McVittie
1a578e6668 NEWS, bump spec version to (unreleased) 0.25 2014-10-06 12:27:36 +01:00
Simon McVittie
c230c790c6 spec: translate arbitrary limits into something more comprehensible
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=84188
Reviewed-by: Lennart Poettering
2014-10-06 12:23:44 +01:00
Simon McVittie
9359a1793c spec: in the table of types, classify them
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=84188
Reviewed-by: Lennart Poettering
2014-10-06 12:23:24 +01:00
Simon McVittie
b4ae991605 Start 1.9.2, update NEWS 2014-10-06 12:17:07 +01:00
Alban Crequy
668cd4eb20 GetAllMatchRules: provide an example how it could be used
[use dist_examples_SCRIPTS instead of EXTRA_DIST -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=84598
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-06 12:10:51 +01:00
Simon McVittie
33ee25f98a 1.9.0 2014-10-01 19:35:08 +01:00
Alban Crequy
f11f6f30d6 config: add examples to show how to enable/disable the Stats interface
[install examples to ${docdir}/examples -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80759
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-01 16:38:40 +01:00
Simon McVittie
4695aacd0d Enable Stats interface by default; disallow non-root use on system bus
[fix typo in interface name -alban]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80759
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-10-01 16:37:20 +01:00
Sebastian Rasmussen
7e0ec24f20 dbus-launch: Fix typo in manpage
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=84313
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 13:41:21 +01:00
Simon McVittie
9d00d22c3f Use ISO C strchr() instead of BSD index()
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
2014-09-25 12:59:50 +01:00
Alban Crequy
d5ea45d735 match_rule_to_string: add test
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:59:50 +01:00
Alban Crequy
5d1f9cbdb9 match_rule_to_string: fix escaping
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:59:50 +01:00
Alban Crequy
f01bd748f4 match_rule_to_string: returns NULL if no memory instead of looping
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:59:50 +01:00
Alban Crequy
2e7a24bbde Stats: GetAllMatchRules: add tests
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:59:50 +01:00
Alban Crequy
7793e774dd Implement GetAllMatchRules on the Stats interface
Usage:

$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus \
      org.freedesktop.DBus.Debug.Stats.GetAllMatchRules
method return sender=org.freedesktop.DBus -> dest=:1.13 reply_serial=2
   array [
      dict entry(
         string ":1.4"
         array [
         ]
      )
      dict entry(
         string ":1.9"
         array [
            string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged'"
         ]
      )
      dict entry(
         string ":1.11"
         array [
            string "eavesdrop='true'"
         ]
      )
   ]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:59:50 +01:00
Simon McVittie
15f9e7bb7c Describe quoting for match rules
I wish I could say "I can't believe this was never documented", but
it wouldn't be true.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=24307
Reviewed-by: Alban Crequy
2014-09-25 12:59:50 +01:00
Ralf Habacker
af793271bf Fix test suite fails on test-dbus with --enable-tests (but no assertions).
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83968
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-25 12:39:49 +02:00
Simon McVittie
5392058c25 Expand documentation of NO_REPLY_EXPECTED
The message type is more important than whether NO_REPLY_EXPECTED is
set, when deciding whether a reply is expected. This documents
existing practice in at least libdbus, GDBus and dbus-daemon.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75749
Reviewed-by: Thiago Macieira
2014-09-24 18:07:54 +01:00
Simon McVittie
529691794e inotify: make sure we set the close-on-exec flag
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73689
Reviewed-by: Ralf Habacker
[add <dbus/dbus-sysdeps-unix.h> which is now required for
_dbus_fd_set_close_on_exec -smcv]
2014-09-23 19:25:55 +01:00