[upower] - Ensure we've initialized errors when calling into PolicyKit. - Resolves: #622830

Richard Hughes rhughes at fedoraproject.org
Tue Aug 10 15:01:56 UTC 2010


commit 8bbd1fe47630362a43a06feb63c22ff22941be71
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Aug 10 16:01:59 2010 +0100

    - Ensure we've initialized errors when calling into PolicyKit.
    - Resolves: #622830

 upower-0.9.6-ensure-gerror-is-init.patch |   44 ++++++++++++++++++++++++++++++
 upower.spec                              |   10 ++++++-
 2 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/upower-0.9.6-ensure-gerror-is-init.patch b/upower-0.9.6-ensure-gerror-is-init.patch
new file mode 100644
index 0000000..286a518
--- /dev/null
+++ b/upower-0.9.6-ensure-gerror-is-init.patch
@@ -0,0 +1,44 @@
+commit a4e099c5bff9f9fdb9067a0a6bb206d4c34745ae
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Tue Aug 10 15:52:12 2010 +0100
+
+    Ensure we've initialized errors when calling into PolicyKit
+
+diff --git a/src/up-polkit.c b/src/up-polkit.c
+index d7760dd..9b86394 100644
+--- a/src/up-polkit.c
++++ b/src/up-polkit.c
+@@ -69,11 +69,14 @@ up_polkit_check_auth (UpPolkit *polkit, PolkitSubject *subject, const gchar *act
+ {
+ 	gboolean ret = FALSE;
+ 	GError *error;
+-	GError *error_local;
++	GError *error_local = NULL;
+ 	PolkitAuthorizationResult *result;
+ 
+ 	/* check auth */
+-	result = polkit_authority_check_authorization_sync (polkit->priv->authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, NULL, &error_local);
++	result = polkit_authority_check_authorization_sync (polkit->priv->authority,
++							    subject, action_id, NULL,
++							    POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
++							    NULL, &error_local);
+ 	if (result == NULL) {
+ 		error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message);
+ 		dbus_g_method_return_error (context, error);
+@@ -104,11 +107,14 @@ up_polkit_is_allowed (UpPolkit *polkit, PolkitSubject *subject, const gchar *act
+ {
+ 	gboolean ret = FALSE;
+ 	GError *error;
+-	GError *error_local;
++	GError *error_local = NULL;
+ 	PolkitAuthorizationResult *result;
+ 
+ 	/* check auth */
+-	result = polkit_authority_check_authorization_sync (polkit->priv->authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, NULL, &error_local);
++	result = polkit_authority_check_authorization_sync (polkit->priv->authority,
++							    subject, action_id, NULL,
++							    POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
++							    NULL, &error_local);
+ 	if (result == NULL) {
+ 		error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message);
+ 		dbus_g_method_return_error (context, error);
diff --git a/upower.spec b/upower.spec
index cec8b8f..e44229c 100644
--- a/upower.spec
+++ b/upower.spec
@@ -1,7 +1,7 @@
 Summary:        Power Management Service
 Name:           upower
 Version:        0.9.5
-Release:        4%{?dist}
+Release:        5%{?dist}
 License:        GPLv2+
 Group:          System Environment/Libraries
 URL:            http://hal.freedesktop.org/releases/
@@ -25,6 +25,9 @@ Requires:       udev
 Requires:       pm-utils >= 1.2.2.1
 Requires:       gobject-introspection
 
+# Upstream: don't crash with new polkits.
+Patch0:    upower-0.9.6-ensure-gerror-is-init.patch
+
 # Old project name
 Obsoletes: DeviceKit-power < 1:0.9.0-2
 
@@ -49,6 +52,7 @@ Headers and libraries for UPower.
 
 %prep
 %setup -q
+%patch0 -p1 -b .new-polkit
 
 %build
 %configure \
@@ -108,6 +112,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
 %{_includedir}/libupower-glib/upower.h
 
 %changelog
+* Tue Aug 10 2010 Richard Hughes <rhughes at redhat.com> - 0.9.5-5
+- Ensure we've initialized errors when calling into PolicyKit.
+- Resolves: #622830
+
 * Mon Jul 26 2010 Bastien Nocera <bnocera at redhat.com> 0.9.5-4
 - Add support for iDevice battery checking
 


More information about the scm-commits mailing list