Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbus: check whether the client wanted interactive authentication #546

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ if test "x$with_dbus" = xyes; then
#
# Check for required D-Bus modules
#
PKG_CHECK_MODULES([dbus], [dbus-1 gio-2.0 polkit-gobject-1],
PKG_CHECK_MODULES([dbus], [dbus-1 gio-2.0 >= 2.46 polkit-gobject-1],
[AC_DEFINE([HAVE_DBUS], [1], [Required GDBus API available])
dbus_summary="system-wide; $dbus_CFLAGS $dbus_LIBS"],
[AC_MSG_FAILURE([Required D-Bus modules (dbus-1, gio-2.0) not found!])]
Expand Down
6 changes: 5 additions & 1 deletion src/DBus/DBusBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,11 @@ namespace usbguard
polkit_details_insert (details, "polkit.message", "This USBGuard action needs authorization");
USBGUARD_LOG(Trace) << "Customized.";
USBGUARD_LOG(Trace) << "Checking authorization of action \"" << action_id.str() << "\" with Polkit ...";
const PolkitCheckAuthorizationFlags flags = POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION;
GDBusMessage* const message = g_dbus_method_invocation_get_message (invocation);
const PolkitCheckAuthorizationFlags flags = (g_dbus_message_get_flags (message) &
G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION)
? POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION
: POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;
PolkitAuthorizationResult* const result = polkit_authority_check_authorization_sync
(authority,
subject,
Expand Down