source: proiecte/PPPP/gdm/debian/patches/17_add_failsafe.patch @ 134

Last change on this file since 134 was 134, checked in by (none), 14 years ago

gdm sources with the modifications for webcam

File size: 4.1 KB
RevLine 
[134]1#
2# Description: Support failsafe sessions
3# Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=594833
4#
5--- gdm-2.27.90/daemon/gdm-session-direct.c     2009-09-09 18:39:10.902593154 +1000
6+++ gdm-2.27.90-failsafe/daemon/gdm-session-direct.c    2009-09-09 21:04:10.641171722 +1000
7@@ -2032,7 +2032,14 @@
8         g_return_if_fail (impl->priv->is_running == FALSE);
9 
10         command = get_session_command (impl);
11-        program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
12+
13+        if (gdm_session_direct_is_failsafe(impl) == FALSE) {
14+                program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
15+        } else {
16+                /* Failsafe session: bypass the Xsession script */
17+                program = g_strdup (command);
18+        }
19+
20         g_free (command);
21 
22         setup_session_environment (impl);
23@@ -2123,6 +2130,55 @@
24         return g_strdup (session->priv->selected_user);
25 }
26 
27+gboolean
28+gdm_session_direct_is_failsafe (GdmSessionDirect *session_direct)
29+{
30+        GError     *error;
31+        GKeyFile   *key_file;
32+        gboolean    res;
33+        gboolean    failsafe = FALSE;
34+        char       *filename;
35+        char       *full_path;
36+
37+        g_return_val_if_fail (session_direct != NULL, FALSE);
38+        g_return_val_if_fail (GDM_IS_SESSION_DIRECT (session_direct), FALSE);
39+
40+        filename = g_strdup_printf ("%s.desktop", get_session_name (session_direct));
41+
42+        key_file = g_key_file_new ();
43+        error = NULL;
44+        res = g_key_file_load_from_dirs (key_file,
45+                                         filename,
46+                                         get_system_session_dirs (),
47+                                         &full_path,
48+                                         G_KEY_FILE_NONE,
49+                                         &error);       
50+        if (! res) {
51+                g_debug ("GdmSessionDirect: File '%s' not found: %s", filename, error->message);
52+                goto out;
53+        }
54+
55+        error = NULL;
56+        res = g_key_file_has_key (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GDM-FailSafe", NULL);
57+        if (!res) {
58+                failsafe =  FALSE;
59+                goto out;
60+        } else {
61+                failsafe = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GDM-FailSafe", &error);
62+                if (error) {
63+                        failsafe = FALSE;
64+                        g_error_free (error);
65+                        goto out;
66+                } else if (failsafe == TRUE) {
67+                        g_debug ("GdmSessionDirect: Session %s is tagged as failsafe", filename);
68+                }
69+        }
70+
71+out:
72+        g_free (filename);
73+        return failsafe;
74+}
75+
76 static void
77 gdm_session_direct_select_session (GdmSession *session,
78                                    const char *text)
79--- gdm-2.27.90/daemon/gdm-session-direct.h     2009-08-25 05:31:18.000000000 +1000
80+++ gdm-2.27.90-failsafe/daemon/gdm-session-direct.h    2009-09-09 21:04:18.660554358 +1000
81@@ -56,6 +56,7 @@
82                                                                 gboolean    display_is_local) G_GNUC_MALLOC;
83 
84 char             * gdm_session_direct_get_username             (GdmSessionDirect     *session_direct);
85+gboolean           gdm_session_direct_is_failsafe              (GdmSessionDirect     *session_direct);
86 
87 /* Exported methods */
88 gboolean           gdm_session_direct_restart                  (GdmSessionDirect     *session_direct,
89--- gdm-2.27.90/daemon/gdm-simple-slave.c       2009-09-09 18:39:10.855368061 +1000
90+++ gdm-2.27.90-failsafe/daemon/gdm-simple-slave.c      2009-09-09 14:30:13.156128123 +1000
91@@ -112,7 +112,11 @@
92         username = gdm_session_direct_get_username (slave->priv->session);
93         gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PreSession", username);
94 
95-        /* FIXME: should we do something here? */
96+        /* FIXME: should we do something here?
97+         * Note that error return status from PreSession script should
98+         * be ignored in the case of a Failsafe session, which can be checked
99+         * by calling: gdm_session_direct_is_failsafe(session)
100+         */
101 }
102 
103 static void
Note: See TracBrowser for help on using the repository browser.