gdbus: Add flags to require authentication as the same user

This eliminates a common use case for the
`GDBusAuthObserver::authorize-authenticated-peer` signal, which is often
implemented incorrectly by people.

Suggested by Simon McVittie.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1804
This commit is contained in:
Philip Withnall
2020-12-15 13:00:28 +00:00
parent 137a9bdcc2
commit 1a6aa9a493
6 changed files with 50 additions and 15 deletions

View File

@@ -70,7 +70,9 @@
* connections from any successfully authenticated user (but not from
* anonymous connections using the `ANONYMOUS` mechanism). If you only
* want to allow D-Bus connections from processes owned by the same uid
* as the server, you would use a signal handler like the following:
* as the server, since GLib 2.68, you should use the
* %G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flag. Its equivalent
* to the following signal handler:
*
* |[<!-- language="C" -->
* static gboolean