[polkit] Don't crash if initializing the server object fails

Adam Jackson ajax at fedoraproject.org
Wed Oct 10 13:35:27 UTC 2012


commit b885f75196d3292f14063e29f3ede0760ced129f
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct 10 09:35:04 2012 -0400

    Don't crash if initializing the server object fails

 ...g-if-initializing-the-server-object-fails.patch |   32 ++++++++++++++++++++
 polkit.spec                                        |    7 ++++-
 2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/polkit-0.107-avoid-crashing-if-initializing-the-server-object-fails.patch b/polkit-0.107-avoid-crashing-if-initializing-the-server-object-fails.patch
new file mode 100644
index 0000000..b8c412a
--- /dev/null
+++ b/polkit-0.107-avoid-crashing-if-initializing-the-server-object-fails.patch
@@ -0,0 +1,32 @@
+From 59f2d96ce3ac63173669f299a9453a7bf5e70a70 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax at 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 at 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
diff --git a/polkit.spec b/polkit.spec
index ba7fa50..e811e84 100644
--- a/polkit.spec
+++ b/polkit.spec
@@ -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 at redhat.com> 0.107-4
+- Don't crash if initializing the server object fails
+
 * Tue Sep 18 2012 David Zeuthen <davidz at redhat.com> 0.107-3%{?dist}
 - Authenticate as root if e.g. the wheel group is empty (#834494)
 


More information about the scm-commits mailing list