Authenticate as root if e.g. the wheel group is empty (#834494)

This commit is contained in:
David Zeuthen 2012-09-18 14:56:20 -04:00
parent afd4b1dd7d
commit 952de8f0b2
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From fa04223240d46641b0773dbf9f7d72f529046bea Mon Sep 17 00:00:00 2001
From: David Zeuthen <zeuthen@gmail.com>
Date: Tue, 18 Sep 2012 14:47:06 -0400
Subject: [PATCH] Fall back to authenticating as uid 0 if the list of admin
identities is empty
For example, this can happen if the wheel group has no members. This
was reported in Red Hat bug 834494, see
https://bugzilla.redhat.com/show_bug.cgi?id=834494
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
---
src/polkitbackend/polkitbackendinteractiveauthority.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index 1d4a555..3bd2f0b 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -1293,15 +1293,11 @@ polkit_backend_interactive_authority_get_admin_identities (PolkitBackendInteract
PolkitDetails *details)
{
PolkitBackendInteractiveAuthorityClass *klass;
- GList *ret;
+ GList *ret = NULL;
klass = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_CLASS (authority);
- if (klass->get_admin_identities == NULL)
- {
- ret = g_list_prepend (NULL, polkit_unix_user_new (0));
- }
- else
+ if (klass->get_admin_identities != NULL)
{
ret = klass->get_admin_identities (authority,
caller,
@@ -2257,6 +2253,10 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
}
}
+ /* Fall back to uid 0 if no users are available (rhbz #834494) */
+ if (user_identities == NULL)
+ user_identities = g_list_prepend (NULL, polkit_unix_user_new (0));
+
session = authentication_session_new (agent,
cookie,
subject,
--
1.7.12

View File

@ -1,7 +1,7 @@
Summary: polkit Authorization Framework
Name: polkit
Version: 0.107
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
URL: http://www.freedesktop.org/wiki/Software/polkit
Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
@ -29,6 +29,8 @@ Conflicts: polkit-gnome < 0.97
Obsoletes: polkit-desktop-policy < 0.103
Provides: polkit-desktop-policy = 0.103
Patch0: polkit-0.107-fall-back-to-uid0-if-no-admin-users-are-available.patch
%description
polkit is a toolkit for defining and handling authorizations. It is
used for allowing unprivileged processes to speak to privileged
@ -59,6 +61,7 @@ Development documentation for polkit.
%prep
%setup -q
%patch0 -p1 -b .fall-back-to-uid-0
%build
%configure --enable-gtk-doc \
@ -127,6 +130,9 @@ exit 0
%{_datadir}/gtk-doc
%changelog
* Tue Sep 18 2012 David Zeuthen <davidz@redhat.com> 0.107-3%{?dist}
- Authenticate as root if e.g. the wheel group is empty (#834494)
* Fri Jul 27 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.107-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild