Improve polkit port

epel9
Matthias Clasen 16 years ago
parent add048c18e
commit b6815b6505

@ -7,7 +7,7 @@
Summary: A process-transparent configuration system Summary: A process-transparent configuration system
Name: GConf2 Name: GConf2
Version: 2.26.2 Version: 2.26.2
Release: 2%{?dist} Release: 3%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Base Group: System Environment/Base
Source: http://download.gnome.org/sources/GConf/2.26/GConf-%{version}.tar.bz2 Source: http://download.gnome.org/sources/GConf/2.26/GConf-%{version}.tar.bz2
@ -37,7 +37,8 @@ Patch0: GConf-2.18.0.1-reload.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=568845 # http://bugzilla.gnome.org/show_bug.cgi?id=568845
Patch1: GConf-gettext.patch Patch1: GConf-gettext.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=498370 # http://bugzilla.redhat.com/show_bug.cgi?id=498370
# http://bugzilla.gnome.org/show_bug.cgi?id=585303
Patch2: polkit1.patch Patch2: polkit1.patch
@ -153,6 +154,9 @@ fi
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/*
%changelog %changelog
* Tue Jun 9 2009 Matthias Clasen <mclasen@redhat.com> - 2.26.2-3
- Improve the port
* Tue Jun 9 2009 Matthias Clasen <mclasen@redhat.com> - 2.26.2-2 * Tue Jun 9 2009 Matthias Clasen <mclasen@redhat.com> - 2.26.2-2
- Port to PolicyKit 1 - Port to PolicyKit 1

@ -1,6 +1,6 @@
diff -up GConf-2.26.2/configure.in.polkit1 GConf-2.26.2/configure.in diff -up GConf-2.26.2/configure.in.polkit1 GConf-2.26.2/configure.in
--- GConf-2.26.2/configure.in.polkit1 2009-05-14 11:18:34.000000000 -0400 --- GConf-2.26.2/configure.in.polkit1 2009-05-14 11:18:34.000000000 -0400
+++ GConf-2.26.2/configure.in 2009-06-09 21:12:21.335927355 -0400 +++ GConf-2.26.2/configure.in 2009-06-12 13:00:27.978836073 -0400
@@ -181,7 +181,7 @@ AC_ARG_ENABLE(defaults_service, @@ -181,7 +181,7 @@ AC_ARG_ENABLE(defaults_service,
, enable_defaults_service=auto) , enable_defaults_service=auto)
@ -26,7 +26,7 @@ diff -up GConf-2.26.2/configure.in.polkit1 GConf-2.26.2/configure.in
AM_CONDITIONAL(ENABLE_DEFAULTS_SERVICE, [test "x$enable_defaults_service" != "xno"]) AM_CONDITIONAL(ENABLE_DEFAULTS_SERVICE, [test "x$enable_defaults_service" != "xno"])
diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gconf-defaults.c diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gconf-defaults.c
--- GConf-2.26.2/defaults/gconf-defaults.c.polkit1 2009-05-14 11:13:40.000000000 -0400 --- GConf-2.26.2/defaults/gconf-defaults.c.polkit1 2009-05-14 11:13:40.000000000 -0400
+++ GConf-2.26.2/defaults/gconf-defaults.c 2009-06-09 21:07:45.472634301 -0400 +++ GConf-2.26.2/defaults/gconf-defaults.c 2009-06-12 14:21:50.117398713 -0400
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
* *
@ -242,7 +242,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
*p = 0; *p = 0;
} }
@@ -323,56 +315,158 @@ polkit_action_for_gconf_path (GConfDefau @@ -323,56 +315,160 @@ polkit_action_for_gconf_path (GConfDefau
return action; return action;
} }
@ -296,6 +296,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ gpointer user_data; + gpointer user_data;
+ GDestroyNotify destroy; + GDestroyNotify destroy;
+ PolkitSubject *subject; + PolkitSubject *subject;
+ gboolean challenge;
+} CheckAuthData; +} CheckAuthData;
- /* Check that caller is privileged */ - /* Check that caller is privileged */
@ -442,12 +443,13 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ data->user_data = user_data; + data->user_data = user_data;
+ data->destroy = destroy; + data->destroy = destroy;
+ data->subject = polkit_system_bus_name_new (dbus_g_method_get_sender (context)); + data->subject = polkit_system_bus_name_new (dbus_g_method_get_sender (context));
+ data->challenge = FALSE;
+ +
+ check_next_action (data); + check_next_action (data);
} }
static char * static char *
@@ -398,11 +492,11 @@ gconf_address_for_caller (GConfDefaults @@ -398,11 +494,11 @@ gconf_address_for_caller (GConfDefaults
dbus_error_free (&error); dbus_error_free (&error);
return NULL; return NULL;
} }
@ -462,7 +464,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
"Failed to get passwd information for uid %d", uid); "Failed to get passwd information for uid %d", uid);
return NULL; return NULL;
} }
@@ -434,13 +528,13 @@ copy_tree (GConfClient *src, @@ -434,13 +530,13 @@ copy_tree (GConfClient *src,
GSList *list, *l; GSList *list, *l;
GConfEntry *entry; GConfEntry *entry;
@ -478,7 +480,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
gconf_change_set_set (changes, entry->key, entry->value); gconf_change_set_set (changes, entry->key, entry->value);
} }
g_slist_foreach (list, (GFunc)gconf_entry_free, NULL); g_slist_foreach (list, (GFunc)gconf_entry_free, NULL);
@@ -461,7 +555,7 @@ copy_entry (GConfClient *src, @@ -461,7 +557,7 @@ copy_entry (GConfClient *src,
{ {
GConfValue *value; GConfValue *value;
@ -487,7 +489,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
return; return;
value = gconf_client_get (src, path, NULL); value = gconf_client_get (src, path, NULL);
@@ -471,69 +565,66 @@ copy_entry (GConfClient *src, @@ -471,69 +567,66 @@ copy_entry (GConfClient *src,
} }
} }
@ -599,7 +601,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
goto cleanup; goto cleanup;
source = gconf_client_get_for_engine (engine); source = gconf_client_get_for_engine (engine);
@@ -542,45 +633,175 @@ do_copy (GConfDefaults *mechani @@ -542,45 +635,175 @@ do_copy (GConfDefaults *mechani
changes = gconf_change_set_new (); changes = gconf_change_set_new ();
/* recursively copy each include, leaving out the excludes */ /* recursively copy each include, leaving out the excludes */
@ -793,7 +795,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
} }
static void static void
@@ -594,20 +815,13 @@ append_key (GConfChangeSet *cs, @@ -594,20 +817,13 @@ append_key (GConfChangeSet *cs,
g_ptr_array_add (keys, (gpointer) key); g_ptr_array_add (keys, (gpointer) key);
} }
@ -818,7 +820,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
keys = g_ptr_array_new (); keys = g_ptr_array_new ();
gconf_change_set_foreach (changes, append_key, keys); gconf_change_set_foreach (changes, append_key, keys);
g_ptr_array_add (keys, NULL); g_ptr_array_add (keys, NULL);
@@ -615,7 +829,15 @@ gconf_defaults_set_system (GConfDefaults @@ -615,7 +831,15 @@ gconf_defaults_set_system (GConfDefaults
g_signal_emit (mechanism, signals[SYSTEM_SET], 0, keys->pdata); g_signal_emit (mechanism, signals[SYSTEM_SET], 0, keys->pdata);
g_ptr_array_free (keys, TRUE); g_ptr_array_free (keys, TRUE);
@ -835,7 +837,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
} }
void void
@@ -624,7 +846,7 @@ gconf_defaults_set_mandatory (GConfDefau @@ -624,7 +848,7 @@ gconf_defaults_set_mandatory (GConfDefau
const char **excludes, const char **excludes,
DBusGMethodInvocation *context) DBusGMethodInvocation *context)
{ {
@ -844,7 +846,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
} }
static void static void
@@ -636,13 +858,13 @@ unset_tree (GConfClient *dest, @@ -636,13 +860,13 @@ unset_tree (GConfClient *dest,
GSList *list, *l; GSList *list, *l;
GConfEntry *entry; GConfEntry *entry;
@ -860,7 +862,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
gconf_change_set_unset (changes, entry->key); gconf_change_set_unset (changes, entry->key);
} }
g_slist_foreach (list, (GFunc)gconf_entry_free, NULL); g_slist_foreach (list, (GFunc)gconf_entry_free, NULL);
@@ -654,25 +876,25 @@ unset_tree (GConfClient *dest, @@ -654,25 +878,25 @@ unset_tree (GConfClient *dest,
g_slist_foreach (list, (GFunc)g_free, NULL); g_slist_foreach (list, (GFunc)g_free, NULL);
g_slist_free (list); g_slist_free (list);
} }
@ -894,7 +896,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
{ {
GConfEngine *engine; GConfEngine *engine;
GConfClient *dest = NULL; GConfClient *dest = NULL;
@@ -680,7 +902,7 @@ unset_in_db (GConfDefaults *mechanism, @@ -680,7 +904,7 @@ unset_in_db (GConfDefaults *mechanism,
int i; int i;
engine = gconf_engine_get_local (address, error); engine = gconf_engine_get_local (address, error);
@ -903,7 +905,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
goto out; goto out;
dest = gconf_client_get_for_engine (engine); dest = gconf_client_get_for_engine (engine);
@@ -706,48 +928,219 @@ out: @@ -706,48 +930,224 @@ out:
gconf_change_set_unref (changes); gconf_change_set_unref (changes);
} }
@ -1041,6 +1043,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ g_debug ("result for '%s': challenge\n", + g_debug ("result for '%s': challenge\n",
+ data->actions[data->id]); + data->actions[data->id]);
+ is_authorized = TRUE; + is_authorized = TRUE;
+ data->challenge = TRUE;
+ } + }
+ else { + else {
+ g_debug ("result for '%s': not authorized\n", + g_debug ("result for '%s': not authorized\n",
@ -1054,8 +1057,11 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ if (is_authorized) { + if (is_authorized) {
+ data->id++; + data->id++;
+ if (data->actions[data->id] == NULL) { + if (data->actions[data->id] == NULL) {
+ g_debug ("return TRUE\n"); + gint result;
+ dbus_g_method_return (data->context, TRUE); +
+ result = data->challenge ? 1 : 2;
+ g_debug ("return %d\n", result);
+ dbus_g_method_return (data->context, result);
+ } + }
+ else { + else {
+ check_next_action (data); + check_next_action (data);
@ -1065,8 +1071,8 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
- else - else
- dbus_g_method_return (context); - dbus_g_method_return (context);
+ else { + else {
+ g_debug ("return FALSE\n"); + g_debug ("return 0\n");
+ dbus_g_method_return (data->context, FALSE); + dbus_g_method_return (data->context, 0);
+ } + }
+ +
out: out:
@ -1097,6 +1103,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ data->user_data = NULL; + data->user_data = NULL;
+ data->destroy = NULL; + data->destroy = NULL;
+ data->subject = polkit_system_bus_name_new (dbus_g_method_get_sender (context)); + data->subject = polkit_system_bus_name_new (dbus_g_method_get_sender (context));
+ data->challenge = FALSE;
+ +
+ check_next_action (data); + check_next_action (data);
+} +}
@ -1153,7 +1160,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.c.polkit1 GConf-2.26.2/defaults/gc
+ +
diff -up GConf-2.26.2/defaults/gconf-defaults.h.polkit1 GConf-2.26.2/defaults/gconf-defaults.h diff -up GConf-2.26.2/defaults/gconf-defaults.h.polkit1 GConf-2.26.2/defaults/gconf-defaults.h
--- GConf-2.26.2/defaults/gconf-defaults.h.polkit1 2009-05-14 11:13:40.000000000 -0400 --- GConf-2.26.2/defaults/gconf-defaults.h.polkit1 2009-05-14 11:13:40.000000000 -0400
+++ GConf-2.26.2/defaults/gconf-defaults.h 2009-06-09 21:07:45.474639261 -0400 +++ GConf-2.26.2/defaults/gconf-defaults.h 2009-06-12 13:00:27.984836059 -0400
@@ -83,6 +83,14 @@ void gconf_defaults_unset_mand @@ -83,6 +83,14 @@ void gconf_defaults_unset_mand
const char **excludes, const char **excludes,
DBusGMethodInvocation *context); DBusGMethodInvocation *context);
@ -1171,7 +1178,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.h.polkit1 GConf-2.26.2/defaults/gc
#endif /* GCONF_DEFAULTS_H */ #endif /* GCONF_DEFAULTS_H */
diff -up GConf-2.26.2/defaults/gconf-defaults-main.c.polkit1 GConf-2.26.2/defaults/gconf-defaults-main.c diff -up GConf-2.26.2/defaults/gconf-defaults-main.c.polkit1 GConf-2.26.2/defaults/gconf-defaults-main.c
--- GConf-2.26.2/defaults/gconf-defaults-main.c.polkit1 2009-05-05 20:37:32.000000000 -0400 --- GConf-2.26.2/defaults/gconf-defaults-main.c.polkit1 2009-05-05 20:37:32.000000000 -0400
+++ GConf-2.26.2/defaults/gconf-defaults-main.c 2009-06-09 21:07:45.475644220 -0400 +++ GConf-2.26.2/defaults/gconf-defaults-main.c 2009-06-12 13:00:27.987836052 -0400
@@ -122,6 +122,29 @@ get_system_bus (void) @@ -122,6 +122,29 @@ get_system_bus (void)
return bus; return bus;
} }
@ -1236,7 +1243,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults-main.c.polkit1 GConf-2.26.2/defaul
diff -up GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 GConf-2.26.2/defaults/gconf-defaults.xml diff -up GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 GConf-2.26.2/defaults/gconf-defaults.xml
--- GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 2009-05-14 11:13:40.000000000 -0400 --- GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 2009-05-14 11:13:40.000000000 -0400
+++ GConf-2.26.2/defaults/gconf-defaults.xml 2009-06-09 21:07:45.476638353 -0400 +++ GConf-2.26.2/defaults/gconf-defaults.xml 2009-06-12 14:21:43.646401662 -0400
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
<node name="/"> <node name="/">
<interface name="org.gnome.GConf.Defaults"> <interface name="org.gnome.GConf.Defaults">
@ -1260,7 +1267,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 GConf-2.26.2/defaults/
+ <method name="CanSetSystem"> + <method name="CanSetSystem">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="includes" direction="in" type="as"/> + <arg name="includes" direction="in" type="as"/>
+ <arg name="result" direction="out" type="b"/> + <arg name="result" direction="out" type="u"/>
+ </method> + </method>
+ +
<signal name="SystemSet"> <signal name="SystemSet">
@ -1279,13 +1286,7 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 GConf-2.26.2/defaults/
recursively, skipping the excluded subtrees. recursively, skipping the excluded subtrees.
To decide which PolicyKit privilege to require for the copying of To decide which PolicyKit privilege to require for the copying of
each path in includes, the mechanism looks for a privilege with an each path in includes, the mechanism looks for a privilege with an
@@ -41,12 +47,12 @@ @@ -46,7 +52,7 @@
<method name="SetMandatory">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="includes" direction="in" type="as"/>
- <arg name="excludes" direction="in" type="as"/>
+ <arg name="result" direction="out" type="b"/>
</method>
<!-- <!--
Unsets keys in the system-wide mandatory GConf database, making the Unsets keys in the system-wide mandatory GConf database, making the
@ -1303,14 +1304,14 @@ diff -up GConf-2.26.2/defaults/gconf-defaults.xml.polkit1 GConf-2.26.2/defaults/
+ <method name="CanSetMandatory"> + <method name="CanSetMandatory">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> + <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="includes" direction="in" type="as"/> + <arg name="includes" direction="in" type="as"/>
+ <arg name="result" direction="out" type="b"/> + <arg name="result" direction="out" type="u"/>
+ </method> + </method>
+ +
</interface> </interface>
</node> </node>
diff -up GConf-2.26.2/defaults/Makefile.am.polkit1 GConf-2.26.2/defaults/Makefile.am diff -up GConf-2.26.2/defaults/Makefile.am.polkit1 GConf-2.26.2/defaults/Makefile.am
--- GConf-2.26.2/defaults/Makefile.am.polkit1 2009-04-25 02:44:06.000000000 -0400 --- GConf-2.26.2/defaults/Makefile.am.polkit1 2009-04-25 02:44:06.000000000 -0400
+++ GConf-2.26.2/defaults/Makefile.am 2009-06-09 21:07:45.478662799 -0400 +++ GConf-2.26.2/defaults/Makefile.am 2009-06-12 13:00:27.990835416 -0400
@@ -20,13 +20,13 @@ INCLUDES = \ @@ -20,13 +20,13 @@ INCLUDES = \
gconf_defaults_mechanism_LDADD = \ gconf_defaults_mechanism_LDADD = \

Loading…
Cancel
Save