Commit graph

3652 commits

Author SHA1 Message Date
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
Cosimo Alfarano
600621dbc8 Factor out DBusAuthorization from DBusTransport
In order to authorize/reject a connection in a polite way, instead of
cutting it off after authentication succeed and Hello() is
sent, because authorization failed, we need to factor out some
authorization bits from DBusTransport and pass them to DBusAuth.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 01:20:34 +02:00
Simon McVittie
36bb2125d1 Fix confusion between "is it authenticated?" and "try to authenticate"
Historically, _dbus_transport_get_is_authenticated() has had the
side-effect of trying to advance the authentication state machine (if
there's enough buffered input to do so). This seems an inappropriate
activity for what looks like a simple getter.

Split it into _dbus_transport_try_to_authenticate (which does what it
always used to do) and _dbus_transport_peek_is_authenticated (which
is the simple getter version).

To minimize the difference in behaviour for the stable branch of D-Bus,
I've only used _dbus_transport_peek_is_authenticated where it was used
in an assertion, which should clearly not have side effects (and I've
checked that the asserting function cannot be called until both
authentication and authorization have completed). Replacing most of the
calls to get_is_authenticated with try_to_authenticate is a possible
piece of future work.

Based on patches from Cosimo Alfarano, who noticed this
assertion-with-side-effects.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
https://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.com>
2013-08-23 00:45:11 +02:00
Cosimo Alfarano
1809c7ad2a Unset/free also windows user function, finalizing the connection
It's currently not used, but it's safer to unset it and free user's
data for avoiding future head-aches

https://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23 00:17:40 +02:00
Simon McVittie
d643212651 More NEWS 2013-08-22 20:46:51 +01:00
Chengwei Yang
df537d3f9f Fix reference doc in comments 2013-08-22 20:09:46 +01:00
Chengwei Yang
c1daecad31 Move function to the right place where it supposed to be used
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 20:09:26 +01:00
Chengwei Yang
4bb8b56293 DBus Spec: Fix sample service file
There are two errors in the sample service file.

First, a typo, Names should be Name.
Second, can not specify multiple names.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66481
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 20:04:10 +01:00
Chengwei Yang
014ea55625 Ignore more unused staff if build with tests but without asserts
https://bugs.freedesktop.org/show_bug.cgi?id=66069
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 20:03:06 +01:00
Chengwei Yang
15bc915d74 Doc: fix incorrect param names, missing params, non-exist params
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65755
2013-08-22 20:01:08 +01:00
Ivan Romanov
0928169cf8 Use iface instead of interface in function parameters
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66493
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 19:11:23 +01:00
Simon McVittie
82d37b93ec Document GetAdtAuditSessionData and GetConnectionSELinuxSecurityContext
These are only part of the DBus interface because dbus-daemon didn't
previously support multiple interfaces. I don't know enough about
either of these security frameworks to know what they return, but
perhaps one day someone who knows about Solaris or SELinux will tell
us...

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-22 18:22:14 +01:00
Simon McVittie
4b63567c02 GetConnectionCredentials: add
The initial set of credentials is just UnixUserID and ProcessID.
The rest can follow when someone is sufficiently interested to actually
test them.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[rename a function that Ralf found unclear -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 18:21:58 +01:00
Chengwei Yang
46af309cf5 Fix build with "--enable-stats"
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-22 18:17:49 +01:00
Simon McVittie
eca135456b Merge branch 'dbus-1.6'
Conflicts:
	NEWS
2013-08-22 18:03:59 +01:00
Simon McVittie
5ad2668fb3 NEWS for 1.6 2013-08-22 18:03:24 +01:00
Simon McVittie
039758ca69 NEWS 2013-08-22 18:02:42 +01:00
Ralf Habacker
bc02680c69 Fixed compiler warning on windows.
https://bugs.freedesktop.org/show_bug.cgi?id=61874
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-19 21:29:26 +02:00
Ralf Habacker
006c5750b3 Documentation fix.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29666
Reviewed-by: Chengwei Yang <chengwei.yang.cn@gmail.com>
2013-08-15 10:43:10 +02:00
Ralf Habacker
9554ca9d9f Fixed remaining issues.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:54:59 +02:00
Ralf Habacker
8a76654a43 Add debug messages to load_ex_ip_helper_procedures().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:53:28 +02:00
Ralf Habacker
9cc21aa001 Refactored get_pid_from_extended_tcp_table() and get_pid_from_tcp_ex_table() to be more equal.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:53:22 +02:00
Ralf Habacker
2fd9e2c255 Fix for broken wine AllocateAndGetTcpExTableFromStack() implementation.
On wine (tested with 1.5.6) the mentioned function could not be located in
iphlpapi.dll using LoadLibrary()/GetProcAddress(), which is the prefered
method to get a tcp peer pid on WinXP <= SP2.
To workaround this limitation we use GetExtendedTcpTable() first to get the peer pid.
If this fails (which happens at least on real WinXP SP2) we then use
AllocateAndGetTcpExTableFromStack() to get the pid.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:53:16 +02:00
Ralf Habacker
0b2b6cba92 Add doc to load_ex_ip_helper_procedures().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:52:37 +02:00
Ralf Habacker
4886ff454e Only take process id of localhost client connection entries.
This patch makes sure, that the process id is fetched only from localhost
 client address connections fetched from the tcp table.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:52:32 +02:00
Ralf Habacker
d6b67a0383 Fixed bug of unsupported GetExtendTcpTable() on Windows XP SP2 and earlier.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-09 17:52:28 +02:00
Ralf Habacker
2f24bc8616 Dump fetched sid on return of _dbus_getsid().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66060
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-07 17:02:18 +02:00