You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
3.5 KiB
85 lines
3.5 KiB
From b06fae505b66049e537ad15d3569c260e9bc976f Mon Sep 17 00:00:00 2001
|
|
From: Philip Withnall <pwithnall@endlessos.org>
|
|
Date: Sat, 1 May 2021 01:16:05 +0100
|
|
Subject: [PATCH 2/2] pk-engine: Only set polkit interactive flag if method
|
|
call has too
|
|
|
|
Same as the previous commit.
|
|
|
|
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
|
|
---
|
|
src/pk-engine.c | 22 +++++++++++++++++-----
|
|
1 file changed, 17 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/pk-engine.c b/src/pk-engine.c
|
|
index 7ea87a448..3d6633ba6 100644
|
|
--- a/src/pk-engine.c
|
|
+++ b/src/pk-engine.c
|
|
@@ -632,6 +632,18 @@ pk_engine_is_proxy_unchanged (PkEngine *engine, const gchar *sender,
|
|
return TRUE;
|
|
}
|
|
|
|
+static PolkitCheckAuthorizationFlags
|
|
+get_polkit_flags_for_dbus_invocation (GDBusMethodInvocation *invocation)
|
|
+{
|
|
+ PolkitCheckAuthorizationFlags flags = POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;
|
|
+ GDBusMessage *message = g_dbus_method_invocation_get_message (invocation);
|
|
+
|
|
+ if (g_dbus_message_get_flags (message) & G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION)
|
|
+ flags |= POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION;
|
|
+
|
|
+ return flags;
|
|
+}
|
|
+
|
|
static void
|
|
pk_engine_set_proxy (PkEngine *engine,
|
|
const gchar *proxy_http,
|
|
@@ -715,7 +727,7 @@ pk_engine_set_proxy (PkEngine *engine,
|
|
polkit_authority_check_authorization (engine->priv->authority, subject,
|
|
"org.freedesktop.packagekit.system-network-proxy-configure",
|
|
NULL,
|
|
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
|
|
+ get_polkit_flags_for_dbus_invocation (context),
|
|
NULL,
|
|
(GAsyncReadyCallback) pk_engine_action_obtain_proxy_authorization_finished_cb,
|
|
state);
|
|
@@ -1604,7 +1616,7 @@ pk_engine_offline_method_call (GDBusConnection *connection_, const gchar *sender
|
|
polkit_authority_check_authorization (engine->priv->authority, subject,
|
|
"org.freedesktop.packagekit.trigger-offline-update",
|
|
NULL,
|
|
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
|
|
+ get_polkit_flags_for_dbus_invocation (invocation),
|
|
NULL,
|
|
pk_engine_offline_helper_cb,
|
|
helper);
|
|
@@ -1618,7 +1630,7 @@ pk_engine_offline_method_call (GDBusConnection *connection_, const gchar *sender
|
|
polkit_authority_check_authorization (engine->priv->authority, subject,
|
|
"org.freedesktop.packagekit.clear-offline-update",
|
|
NULL,
|
|
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
|
|
+ get_polkit_flags_for_dbus_invocation (invocation),
|
|
NULL,
|
|
pk_engine_offline_helper_cb,
|
|
helper);
|
|
@@ -1645,7 +1657,7 @@ pk_engine_offline_method_call (GDBusConnection *connection_, const gchar *sender
|
|
polkit_authority_check_authorization (engine->priv->authority, subject,
|
|
"org.freedesktop.packagekit.trigger-offline-update",
|
|
NULL,
|
|
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
|
|
+ get_polkit_flags_for_dbus_invocation (invocation),
|
|
NULL,
|
|
pk_engine_offline_helper_cb,
|
|
helper);
|
|
@@ -1672,7 +1684,7 @@ pk_engine_offline_method_call (GDBusConnection *connection_, const gchar *sender
|
|
polkit_authority_check_authorization (engine->priv->authority, subject,
|
|
"org.freedesktop.packagekit.trigger-offline-upgrade",
|
|
NULL,
|
|
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
|
|
+ get_polkit_flags_for_dbus_invocation (invocation),
|
|
NULL,
|
|
pk_engine_offline_helper_cb,
|
|
helper);
|
|
--
|
|
2.40.0
|
|
|