ngompa / rpms / PackageKit

Forked from rpms/PackageKit 4 years ago
Clone

Blame SOURCES/0001-Do-not-set-JUST_REINSTALL-on-any-kind-of-auth-failur.patch

796e9d
From bb9f9a8fb451d7a2d81f7390993db75491224729 Mon Sep 17 00:00:00 2001
796e9d
From: Richard Hughes <richard@hughsie.com>
796e9d
Date: Mon, 9 Apr 2018 16:39:56 +0100
796e9d
Subject: [PATCH] Do not set JUST_REINSTALL on any kind of auth failure
796e9d
796e9d
If we try to continue the auth queue when it has been cancelled (or failed)
796e9d
then we fall upon the obscure JUST_REINSTALL transaction flag which only the
796e9d
DNF backend actually verifies.
796e9d
796e9d
Many thanks to Matthias Gerstner <mgerstner@suse.de> for spotting the problem.
796e9d
---
796e9d
 src/pk-transaction.c | 27 ++++++++-------------------
796e9d
 1 file changed, 8 insertions(+), 19 deletions(-)
796e9d
796e9d
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
796e9d
index 1d006c782..ffee29f6f 100644
796e9d
--- a/src/pk-transaction.c
796e9d
+++ b/src/pk-transaction.c
796e9d
@@ -2351,25 +2351,14 @@ pk_transaction_authorize_actions_finished_cb (GObject *source_object,
796e9d
 
796e9d
 	/* did not auth */
796e9d
 	if (!polkit_authorization_result_get_is_authorized (result)) {
796e9d
-		if (g_strcmp0 (action_id, "org.freedesktop.packagekit.package-install") == 0 &&
796e9d
-			       pk_bitfield_contain (priv->cached_transaction_flags,
796e9d
-						    PK_TRANSACTION_FLAG_ENUM_ALLOW_REINSTALL)) {
796e9d
-			g_debug ("allowing just reinstallation");
796e9d
-			pk_bitfield_add (priv->cached_transaction_flags,
796e9d
-					 PK_TRANSACTION_FLAG_ENUM_JUST_REINSTALL);
796e9d
-		} else {
796e9d
-			priv->waiting_for_auth = FALSE;
796e9d
-			/* emit an ::StatusChanged, ::ErrorCode() and then ::Finished() */
796e9d
-			pk_transaction_status_changed_emit (data->transaction, PK_STATUS_ENUM_FINISHED);
796e9d
-			pk_transaction_error_code_emit (data->transaction, PK_ERROR_ENUM_NOT_AUTHORIZED,
796e9d
-							"Failed to obtain authentication.");
796e9d
-			pk_transaction_finished_emit (data->transaction, PK_EXIT_ENUM_FAILED, 0);
796e9d
-
796e9d
-			syslog (LOG_AUTH | LOG_NOTICE,
796e9d
-				"uid %i failed to obtain auth",
796e9d
-				priv->uid);
796e9d
-			goto out;
796e9d
-		}
796e9d
+		priv->waiting_for_auth = FALSE;
796e9d
+		/* emit an ::StatusChanged, ::ErrorCode() and then ::Finished() */
796e9d
+		pk_transaction_status_changed_emit (data->transaction, PK_STATUS_ENUM_FINISHED);
796e9d
+		pk_transaction_error_code_emit (data->transaction, PK_ERROR_ENUM_NOT_AUTHORIZED,
796e9d
+						"Failed to obtain authentication.");
796e9d
+		pk_transaction_finished_emit (data->transaction, PK_EXIT_ENUM_FAILED, 0);
796e9d
+		syslog (LOG_AUTH | LOG_NOTICE, "uid %i failed to obtain auth", priv->uid);
796e9d
+		goto out;
796e9d
 	}
796e9d
 
796e9d
 	if (data->actions->len <= 1) {
796e9d
-- 
796e9d
2.17.0
796e9d