~ubuntu-branches/ubuntu/raring/gdm/raring

« back to all changes in this revision

Viewing changes to debian/patches/04_polkit1.patch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-17 11:41:35 UTC
  • mfrom: (1.4.32 upstream)
  • Revision ID: james.westby@ubuntu.com-20090717114135-1ql0hht1lumoiscv
Tags: 2.26.1git20090717-0ubuntu1
* Update to latest upstream git head:
  - Make greeter login window be a dock. Fixes metacity complaining about
    session management. (LP: #395324)
* Drop patches which are fixed upstream:
  - 00git-greeter-session-management.patch
  - 00git-invalid-dmrc-layout.patch
  - 00git-use-after-free.patch
  - 00git-xklavier4.patch
  - 02_dont_force_us_keyboard.patch
  - 04_polkit1.patch
* 80_workaround_incorrect_directories.patch: Update to new upstream version.
* Drop 01_xconfigoptions.patch; these configure variables are not used any
  more in the upstream code, and upstream supplies the X.org -br option by
  default now. Also drop the corresponding configure changes from
  17_update_default_xserver.patch.
* Apply 15_usplash.patch to debian/gdm.init and drop the patch.
* 17_update_default_xserver.patch: Update to new upstream version, add
  corresponding configure change, add patch tag header, forward upstream,
  and rename to 02_x_server_location.patch.
* Drop 99_autoreconf.patch. The only remaining build system change is the
  previous item.
* Drop 20_xdm-stuff.patch, it's just cruft.
* Drop debian/Xsession, and change debian/rules to install the upstream one.
* 01_xrdb_nocpp.patch: Add patch tag header, forward upstream.
* Rename 80_workaround_incorrect_directories.patch to
  04_fix_external_program_directories.patch and add patch tag header.
* Rename 81_initial_server_on_vt7.patch to 05_initial_server_on_vt7.patch.
* debian/rules: Remove /var/gdm (empty and nonstandard) and /var/run (will
  be created at runtime), thanks lintian.
* debian/copyright: Point to versioned GPL, thanks lintian.
* debian/gdm.postrm: Use "set -e" to conform to policy.
* Add debian/xterm.desktop: Reintroduce "failsafe xterm" session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Description: Port to PolicyKit 1.0 API.
2
 
# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=585272
3
 
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/configure.ac gdm-2.26.1.new/configure.ac
4
 
--- gdm-2.26.1/configure.ac     2009-07-13 12:01:48.108491945 +0200
5
 
+++ gdm-2.26.1.new/configure.ac 2009-07-13 12:01:49.544491210 +0200
6
 
@@ -46,7 +46,6 @@
7
 
 LIBGLADE_REQUIRED_VERSION=1.99.2
8
 
 SCROLLKEEPER_REQUIRED_VERSION=0.1.4
9
 
 GCONF_REQUIRED_VERSION=2.6.1
10
 
-POLICYKIT_REQUIRED_VERSION=0.8
11
 
 GNOME_PANEL_REQUIRED_VERSION=2.0.0
12
 
 LIBXKLAVIER_REQUIRED_VERSION=3.5
13
 
 #FONTCONFIG_REQUIRED_VERSION=2.6.0
14
 
@@ -118,30 +117,6 @@
15
 
 AC_SUBST(LIBXKLAVIER_CFLAGS)
16
 
 AC_SUBST(LIBXKLAVIER_LIBS)
17
 
 
18
 
-PKG_CHECK_MODULES(POLKIT_GNOME,
19
 
-        polkit-gnome >= $POLICYKIT_REQUIRED_VERSION,
20
 
-        have_polkit=yes,
21
 
-        have_polkit=no)
22
 
-
23
 
-AC_ARG_ENABLE([polkit],
24
 
-              AS_HELP_STRING([--enable-polkit],
25
 
-                             [Enable PolicyKit support @<:@default=auto@:>@]),
26
 
-              enable_polkit=$enableval, enable_polkit=auto)
27
 
-
28
 
-if test "x$enable_polkit" != "xno"; then
29
 
-  if test "x$enable_polkit" = "xyes" -a "x$have_polkit" = "xno"; then
30
 
-    AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found])
31
 
-  fi
32
 
-
33
 
-  if test "x$have_polkit" = "xyes" ; then
34
 
-    AC_DEFINE(HAVE_POLKIT_GNOME, [], [Define if we have polkit])
35
 
-  fi
36
 
-fi
37
 
-AM_CONDITIONAL(HAVE_POLKIT_GNOME, test x$have_polkit = xyes)
38
 
-AC_SUBST(HAVE_POLKIT_GNOME)
39
 
-AC_SUBST(POLKIT_GNOME_CFLAGS)
40
 
-AC_SUBST(POLKIT_GNOME_LIBS)
41
 
-
42
 
 PKG_CHECK_MODULES(SIMPLE_CHOOSER,
43
 
         dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
44
 
         gtk+-2.0 >= $GTK_REQUIRED_VERSION
45
 
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c gdm-2.26.1.new/gui/simple-greeter/gdm-greeter-login-window.c
46
 
--- gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c    2009-02-20 03:45:09.000000000 +0100
47
 
+++ gdm-2.26.1.new/gui/simple-greeter/gdm-greeter-login-window.c        2009-07-13 12:02:05.829713541 +0200
48
 
@@ -56,10 +56,6 @@
49
 
 #include <dbus/dbus-glib.h>
50
 
 #include <dbus/dbus-glib-lowlevel.h>
51
 
 
52
 
-#ifdef HAVE_POLKIT_GNOME
53
 
-#include <polkit-gnome/polkit-gnome.h>
54
 
-#endif
55
 
-
56
 
 #include "gdm-settings-client.h"
57
 
 #include "gdm-settings-keys.h"
58
 
 #include "gdm-profile.h"
59
 
@@ -1030,119 +1026,6 @@
60
 
         return res;
61
 
 }
62
 
 
63
 
-#ifdef HAVE_POLKIT_GNOME
64
 
-static void
65
 
-system_restart_auth_cb (PolKitAction          *action,
66
 
-                        gboolean               gained_privilege,
67
 
-                        GError                *error,
68
 
-                        GdmGreeterLoginWindow *login_window)
69
 
-{
70
 
-        GError          *local_error;
71
 
-        DBusGConnection *connection;
72
 
-        gboolean         res;
73
 
-
74
 
-        g_debug ("GdmGreeterLoginWindow: system restart auth callback gained=%s", gained_privilege ? "yes" : "no");
75
 
-
76
 
-        if (! gained_privilege) {
77
 
-                if (error != NULL) {
78
 
-                        g_warning ("GdmGreeterLoginWindow: system restart error: %s", error->message);
79
 
-                }
80
 
-                return;
81
 
-        }
82
 
-
83
 
-        local_error = NULL;
84
 
-        connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error);
85
 
-        if (connection == NULL) {
86
 
-                g_warning ("Unable to get system bus connection: %s", local_error->message);
87
 
-                g_error_free (local_error);
88
 
-                return;
89
 
-        }
90
 
-
91
 
-        res = try_system_restart (connection, &local_error);
92
 
-        if (! res) {
93
 
-                g_warning ("Unable to restart system: %s", local_error->message);
94
 
-                g_error_free (local_error);
95
 
-                return;
96
 
-        }
97
 
-}
98
 
-
99
 
-static void
100
 
-system_stop_auth_cb (PolKitAction          *action,
101
 
-                     gboolean               gained_privilege,
102
 
-                     GError                *error,
103
 
-                     GdmGreeterLoginWindow *login_window)
104
 
-{
105
 
-        GError          *local_error;
106
 
-        DBusGConnection *connection;
107
 
-        gboolean         res;
108
 
-
109
 
-        g_debug ("GdmGreeterLoginWindow: system stop auth callback gained=%s", gained_privilege ? "yes" : "no");
110
 
-
111
 
-        if (! gained_privilege) {
112
 
-                if (error != NULL) {
113
 
-                        g_warning ("GdmGreeterLoginWindow: system stop error: %s", error->message);
114
 
-                }
115
 
-                return;
116
 
-        }
117
 
-
118
 
-        local_error = NULL;
119
 
-        connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error);
120
 
-        if (connection == NULL) {
121
 
-                g_warning ("Unable to get system bus connection: %s", local_error->message);
122
 
-                g_error_free (local_error);
123
 
-                return;
124
 
-        }
125
 
-
126
 
-        res = try_system_stop (connection, &local_error);
127
 
-        if (! res) {
128
 
-                g_warning ("Unable to stop system: %s", local_error->message);
129
 
-                g_error_free (local_error);
130
 
-                return;
131
 
-        }
132
 
-}
133
 
-
134
 
-static PolKitAction *
135
 
-get_action_from_error (GError *error)
136
 
-{
137
 
-        PolKitAction *action;
138
 
-        char         *paction;
139
 
-        char         *p;
140
 
-
141
 
-        action = polkit_action_new ();
142
 
-
143
 
-        paction = NULL;
144
 
-        if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
145
 
-                paction = g_strdup (error->message + strlen ("Not privileged for action: "));
146
 
-                p = strchr (paction, ' ');
147
 
-                if (p != NULL) {
148
 
-                        *p = '\0';
149
 
-                }
150
 
-        }
151
 
-        g_debug ("GdmGreeterLoginWindow: Requesting priv for '%s'", paction);
152
 
-
153
 
-        polkit_action_set_action_id (action, paction);
154
 
-
155
 
-        g_free (paction);
156
 
-
157
 
-        return action;
158
 
-}
159
 
-
160
 
-static PolKitResult
161
 
-get_result_from_error (GError *error)
162
 
-{
163
 
-        PolKitResult result = POLKIT_RESULT_UNKNOWN;
164
 
-        const char  *p;
165
 
-
166
 
-        p = strrchr (error->message, ' ');
167
 
-        if (p != NULL) {
168
 
-                p++;
169
 
-                polkit_result_from_string_representation (p, &result);
170
 
-        }
171
 
-
172
 
-        return result;
173
 
-}
174
 
-#endif
175
 
-
176
 
 static void
177
 
 do_system_restart (GdmGreeterLoginWindow *login_window)
178
 
 {
179
 
@@ -1159,69 +1042,12 @@
180
 
         }
181
 
 
182
 
         res = try_system_restart (connection, &error);
183
 
-#ifdef HAVE_POLKIT_GNOME
184
 
-        if (! res) {
185
 
+        if (!res) {
186
 
                 g_debug ("GdmGreeterLoginWindow: unable to restart system: %s: %s",
187
 
                          dbus_g_error_get_name (error),
188
 
                          error->message);
189
 
-
190
 
-                if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
191
 
-                        PolKitAction *action;
192
 
-                        PolKitAction *action2;
193
 
-                        PolKitResult  result;
194
 
-                        GtkWidget    *dialog;
195
 
-                        guint         xid;
196
 
-                        pid_t         pid;
197
 
-
198
 
-                        result = get_result_from_error (error);
199
 
-                        action = get_action_from_error (error);
200
 
-
201
 
-                        if (result == POLKIT_RESULT_NO) {
202
 
-                                action2 = polkit_action_new ();
203
 
-                                polkit_action_set_action_id (action2,
204
 
-                                                             "org.freedesktop.consolekit.system.restart-multiple-users");
205
 
-                                dialog = gtk_message_dialog_new (GTK_WINDOW (login_window),
206
 
-                                                                 GTK_DIALOG_MODAL,
207
 
-                                                                 GTK_MESSAGE_ERROR,
208
 
-                                                                 GTK_BUTTONS_OK,
209
 
-                                                                 _("Failed to restart computer"));
210
 
-                                if (polkit_action_equal (action, action2)) {
211
 
-                                        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
212
 
-                                                                                  _("You are not allowed to restart the computer "
213
 
-                                                                                    "because multiple users are logged in"));
214
 
-                                }
215
 
-                                gtk_dialog_run (GTK_DIALOG (dialog));
216
 
-                                gtk_widget_destroy (dialog);
217
 
-
218
 
-                                polkit_action_unref (action);
219
 
-                                polkit_action_unref (action2);
220
 
-
221
 
-                                g_error_free (error);
222
 
-
223
 
-                                return;
224
 
-                        }
225
 
-
226
 
-                        xid = 0;
227
 
-                        pid = getpid ();
228
 
-
229
 
-                        g_error_free (error);
230
 
-                        error = NULL;
231
 
-                        res = polkit_gnome_auth_obtain (action,
232
 
-                                                        xid,
233
 
-                                                        pid,
234
 
-                                                        (PolKitGnomeAuthCB) system_restart_auth_cb,
235
 
-                                                        login_window,
236
 
-                                                        &error);
237
 
-                        polkit_action_unref (action);
238
 
-
239
 
-                        if (! res) {
240
 
-                                g_warning ("Unable to request privilege for action: %s", error->message);
241
 
-                                g_error_free (error);
242
 
-                        }
243
 
-
244
 
-                }
245
 
+               g_error_free (error);
246
 
         }
247
 
-#endif
248
 
 }
249
 
 
250
 
 static void
251
 
@@ -1240,67 +1066,12 @@
252
 
         }
253
 
 
254
 
         res = try_system_stop (connection, &error);
255
 
-#ifdef HAVE_POLKIT_GNOME
256
 
-        if (! res) {
257
 
+        if (!res) {
258
 
                 g_debug ("GdmGreeterLoginWindow: unable to stop system: %s: %s",
259
 
                          dbus_g_error_get_name (error),
260
 
                          error->message);
261
 
-
262
 
-                if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
263
 
-                        PolKitAction *action;
264
 
-                        PolKitAction *action2;
265
 
-                        PolKitResult  result;
266
 
-                        GtkWidget    *dialog;
267
 
-                        guint         xid;
268
 
-                        pid_t         pid;
269
 
-
270
 
-                        xid = 0;
271
 
-                        pid = getpid ();
272
 
-
273
 
-                        result = get_result_from_error (error);
274
 
-                        action = get_action_from_error (error);
275
 
-
276
 
-                        if (result == POLKIT_RESULT_NO) {
277
 
-                                action2 = polkit_action_new ();
278
 
-                                polkit_action_set_action_id (action2,
279
 
-                                                             "org.freedesktop.consolekit.system.stop-multiple-users");
280
 
-                                dialog = gtk_message_dialog_new (GTK_WINDOW (login_window),
281
 
-                                                                 GTK_DIALOG_MODAL,
282
 
-                                                                 GTK_MESSAGE_ERROR,
283
 
-                                                                 GTK_BUTTONS_OK,
284
 
-                                                                 _("Failed to stop computer"));
285
 
-                                if (polkit_action_equal (action, action2)) {
286
 
-                                        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
287
 
-                                                                                  _("You are not allowed to stop the computer "
288
 
-                                                                                    "because multiple users are logged in"));
289
 
-                                }
290
 
-                                gtk_dialog_run (GTK_DIALOG (dialog));
291
 
-                                gtk_widget_destroy (dialog);
292
 
-
293
 
-                                polkit_action_unref (action);
294
 
-                                polkit_action_unref (action2);
295
 
-
296
 
-                                return;
297
 
-                        }
298
 
-
299
 
-                        g_error_free (error);
300
 
-                        error = NULL;
301
 
-                        res = polkit_gnome_auth_obtain (action,
302
 
-                                                        xid,
303
 
-                                                        pid,
304
 
-                                                        (PolKitGnomeAuthCB) system_stop_auth_cb,
305
 
-                                                        login_window,
306
 
-                                                        &error);
307
 
-                        polkit_action_unref (action);
308
 
-
309
 
-                        if (! res) {
310
 
-                                g_warning ("Unable to request privilege for action: %s", error->message);
311
 
-                                g_error_free (error);
312
 
-                        }
313
 
-
314
 
-                }
315
 
+                g_error_free (error);
316
 
         }
317
 
-#endif
318
 
 }
319
 
 
320
 
 static void
321
 
diff -Nur -x '*.orig' -x '*~' gdm-2.26.1/gui/simple-greeter/Makefile.am gdm-2.26.1.new/gui/simple-greeter/Makefile.am
322
 
--- gdm-2.26.1/gui/simple-greeter/Makefile.am   2009-02-20 03:45:09.000000000 +0100
323
 
+++ gdm-2.26.1.new/gui/simple-greeter/Makefile.am       2009-07-13 12:01:49.548475376 +0200
324
 
@@ -20,7 +20,6 @@
325
 
        $(DISABLE_DEPRECATED_CFLAGS)    \
326
 
        $(GTK_CFLAGS)                                   \
327
 
        $(SIMPLE_GREETER_CFLAGS)                        \
328
 
-       $(POLKIT_GNOME_CFLAGS)                          \
329
 
        $(NULL)
330
 
 
331
 
 @INTLTOOL_SCHEMAS_RULE@
332
 
@@ -90,7 +89,6 @@
333
 
        libgdmuser.la                   \
334
 
        $(COMMON_LIBS)                  \
335
 
        $(SIMPLE_GREETER_LIBS)          \
336
 
-       $(POLKIT_GNOME_LIBS)            \
337
 
        $(RBAC_LIBS)                    \
338
 
        $(NULL)
339
 
 
340
 
@@ -250,7 +248,6 @@
341
 
        libgdmuser.la           \
342
 
        $(COMMON_LIBS)          \
343
 
        $(SIMPLE_GREETER_LIBS)  \
344
 
-       $(POLKIT_GNOME_LIBS)    \
345
 
        $(NULL)
346
 
 
347
 
 test_user_manager_SOURCES =    \
348
 
@@ -261,7 +258,6 @@
349
 
        libgdmuser.la           \
350
 
        $(COMMON_LIBS)          \
351
 
        $(SIMPLE_GREETER_LIBS)  \
352
 
-       $(POLKIT_GNOME_LIBS)    \
353
 
        $(NULL)
354
 
 
355
 
 libexec_PROGRAMS =                     \
356
 
@@ -325,7 +321,6 @@
357
 
        $(COMMON_LIBS)                  \
358
 
        $(EXTRA_GREETER_LIBS)           \
359
 
        $(SIMPLE_GREETER_LIBS)          \
360
 
-       $(POLKIT_GNOME_LIBS)            \
361
 
        $(RBAC_LIBS)                    \
362
 
        $(LIBXKLAVIER_LIBS)             \
363
 
        $(NULL)