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
  • daemon/gdm-session-direct.c

    #
    # Description: Support failsafe sessions
    # Upstream: https://bugzilla.gnome.org/show_bug.cgi?id=594833
    #
    old new  
    20322032        g_return_if_fail (impl->priv->is_running == FALSE);
    20332033
    20342034        command = get_session_command (impl);
    2035         program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
     2035
     2036        if (gdm_session_direct_is_failsafe(impl) == FALSE) {
     2037                program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
     2038        } else {
     2039                /* Failsafe session: bypass the Xsession script */
     2040                program = g_strdup (command);
     2041        }
     2042
    20362043        g_free (command);
    20372044
    20382045        setup_session_environment (impl);
     
    21232130        return g_strdup (session->priv->selected_user);
    21242131}
    21252132
     2133gboolean
     2134gdm_session_direct_is_failsafe (GdmSessionDirect *session_direct)
     2135{
     2136        GError     *error;
     2137        GKeyFile   *key_file;
     2138        gboolean    res;
     2139        gboolean    failsafe = FALSE;
     2140        char       *filename;
     2141        char       *full_path;
     2142
     2143        g_return_val_if_fail (session_direct != NULL, FALSE);
     2144        g_return_val_if_fail (GDM_IS_SESSION_DIRECT (session_direct), FALSE);
     2145
     2146        filename = g_strdup_printf ("%s.desktop", get_session_name (session_direct));
     2147
     2148        key_file = g_key_file_new ();
     2149        error = NULL;
     2150        res = g_key_file_load_from_dirs (key_file,
     2151                                         filename,
     2152                                         get_system_session_dirs (),
     2153                                         &full_path,
     2154                                         G_KEY_FILE_NONE,
     2155                                         &error);       
     2156        if (! res) {
     2157                g_debug ("GdmSessionDirect: File '%s' not found: %s", filename, error->message);
     2158                goto out;
     2159        }
     2160
     2161        error = NULL;
     2162        res = g_key_file_has_key (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GDM-FailSafe", NULL);
     2163        if (!res) {
     2164                failsafe =  FALSE;
     2165                goto out;
     2166        } else {
     2167                failsafe = g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GDM-FailSafe", &error);
     2168                if (error) {
     2169                        failsafe = FALSE;
     2170                        g_error_free (error);
     2171                        goto out;
     2172                } else if (failsafe == TRUE) {
     2173                        g_debug ("GdmSessionDirect: Session %s is tagged as failsafe", filename);
     2174                }
     2175        }
     2176
     2177out:
     2178        g_free (filename);
     2179        return failsafe;
     2180}
     2181
    21262182static void
    21272183gdm_session_direct_select_session (GdmSession *session,
    21282184                                   const char *text)
  • daemon/gdm-session-direct.h

    old new  
    5656                                                                gboolean    display_is_local) G_GNUC_MALLOC;
    5757
    5858char             * gdm_session_direct_get_username             (GdmSessionDirect     *session_direct);
     59gboolean           gdm_session_direct_is_failsafe              (GdmSessionDirect     *session_direct);
    5960
    6061/* Exported methods */
    6162gboolean           gdm_session_direct_restart                  (GdmSessionDirect     *session_direct,
  • daemon/gdm-simple-slave.c

    old new  
    112112        username = gdm_session_direct_get_username (slave->priv->session);
    113113        gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PreSession", username);
    114114
    115         /* FIXME: should we do something here? */
     115        /* FIXME: should we do something here?
     116         * Note that error return status from PreSession script should
     117         * be ignored in the case of a Failsafe session, which can be checked
     118         * by calling: gdm_session_direct_is_failsafe(session)
     119         */
    116120}
    117121
    118122static void
Note: See TracBrowser for help on using the repository browser.