Don't crash if initializing the server object fails

This commit is contained in:
Adam Jackson 2012-10-10 09:35:04 -04:00
parent 952de8f0b2
commit b885f75196
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 59f2d96ce3ac63173669f299a9453a7bf5e70a70 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@nwnk.net>
Date: Tue, 09 Oct 2012 18:08:24 +0000
Subject: PolkitAgent: Avoid crashing if initializing the server object fails
Note that otherwise we return a freed server object. Since later in
polkit_agent_listener_register_with_options we check against NULL to
determine failure, this makes for sad times later when we call
server_free() on it again.
https://bugs.freedesktop.org/show_bug.cgi?id=55776
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
---
diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c
index 0d97501..5bddd03 100644
--- a/src/polkitagent/polkitagentlistener.c
+++ b/src/polkitagent/polkitagentlistener.c
@@ -260,10 +260,9 @@ server_new (PolkitSubject *subject,
if (!server_init_sync (server, cancellable, error))
{
server_free (server);
- goto out;
+ return NULL;
}
- out:
return server;
}
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,7 +1,7 @@
Summary: polkit Authorization Framework
Name: polkit
Version: 0.107
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
URL: http://www.freedesktop.org/wiki/Software/polkit
Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
@ -30,6 +30,7 @@ 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
Patch1: polkit-0.107-avoid-crashing-if-initializing-the-server-object-fails.patch
%description
polkit is a toolkit for defining and handling authorizations. It is
@ -62,6 +63,7 @@ Development documentation for polkit.
%prep
%setup -q
%patch0 -p1 -b .fall-back-to-uid-0
%patch1 -p1 -b .crash-fix
%build
%configure --enable-gtk-doc \
@ -130,6 +132,9 @@ exit 0
%{_datadir}/gtk-doc
%changelog
* Wed Oct 10 2012 Adam Jackson <ajax@redhat.com> 0.107-4
- Don't crash if initializing the server object fails
* 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)