import PackageKit-1.1.12-7.el8

c8 imports/c8/PackageKit-1.1.12-7.el8
MSVSphere Packaging Team 1 year ago
parent a27f7e492d
commit 59c49c2588

@ -0,0 +1,56 @@
From 0a46c047512e36d454800602b3845be35eb2dafe Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Sat, 1 May 2021 01:08:59 +0100
Subject: [PATCH 1/2] pk-transaction: Only set polkit interactive flag if
transaction has too
This should fix polkit dialogues popping up when doing background
refresh operations, particularly for the
`org.freedesktop.packagekit.system-sources-refresh` action.
See
https://gitlab.gnome.org/GNOME/gnome-software/-/issues/582#note_1095101.
Note: This fix is only done through code inspection. I have not tried to
reproduce the failure case, and not tested that this commit actually
fixes it.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
src/pk-transaction.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 83ee5588c..64b7def40 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2252,6 +2252,7 @@ pk_transaction_authorize_actions (PkTransaction *transaction,
PkTransactionPrivate *priv = transaction->priv;
const gchar *text = NULL;
struct AuthorizeActionsData *data = NULL;
+ PolkitCheckAuthorizationFlags flags;
if (actions->len <= 0) {
g_debug ("No authentication required");
@@ -2338,13 +2339,17 @@ pk_transaction_authorize_actions (PkTransaction *transaction,
data->role = role;
data->actions = g_ptr_array_ref (actions);
+ flags = POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE;
+ if (pk_backend_job_get_interactive (priv->job))
+ flags |= POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION;
+
g_debug ("authorizing action %s", action_id);
/* do authorization async */
polkit_authority_check_authorization (priv->authority,
priv->subject,
action_id,
details,
- POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
+ flags,
priv->cancellable,
(GAsyncReadyCallback) pk_transaction_authorize_actions_finished_cb,
data);
--
2.40.0

@ -0,0 +1,84 @@
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

@ -14,7 +14,7 @@
Summary: Package management service
Name: PackageKit
Version: 1.1.12
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.freedesktop.org/software/PackageKit/
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
@ -34,6 +34,8 @@ Patch0: rhel-Vendor.conf.patch
Patch1: 0001-dnf-Invalidate-the-sack-cache-after-downloading-new-.patch
Patch2: 0001-dnf-Don-t-override-DnfContext-s-release_ver-for-the-.patch
Patch3: 0001-command-not-found-Don-t-use-a-bash-regex-to-fix-othe.patch
Patch5: 0001-pk-transaction-Only-set-polkit-interactive-flag-if-t.patch
Patch6: 0002-pk-engine-Only-set-polkit-interactive-flag-if-method.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1814820
Patch4: revert-shutdown-on-idle.patch
@ -338,6 +340,10 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
%{_datadir}/vala/vapi/packagekit-glib2.vapi
%changelog
* Mon Apr 24 2023 Richard Hughes <rhughes@redhat.com> - 1.1.12-7
- Backport changes for passing interactive flag to polkit calls.
- Resolves: #2177711
* Fri May 22 2020 Michael Catanzaro <mcatanzaro@redhat.com> - 1.1.12-6
- Fix documentation links in Vendor.conf
- Resolves: #1837648

Loading…
Cancel
Save