static void gdm_display_real_get_timed_login_details (GdmDisplay *display, gboolean *enabledp, char **usernamep, int *delayp) { gboolean res; gboolean enabled; int delay; char *username; enabled = FALSE; username = NULL; delay = 0; #ifdef WITH_SYSTEMD /* FIXME: More careful thought needs to happen before we * can support auto/timed login on auxilliary seats in the * systemd path. */ if (LOGIND_RUNNING()) { if (g_strcmp0 (display->priv->seat_id, "seat0") != 0) { goto out; } } #endif res = gdm_settings_direct_get_boolean (GDM_KEY_AUTO_LOGIN_ENABLE, &enabled); if (res && enabled) { res = gdm_settings_direct_get_string (GDM_KEY_AUTO_LOGIN_USER, &username); } if (enabled && res && username != NULL && username[0] != '\0') { goto out; } g_free (username); username = NULL; enabled = FALSE; res = gdm_settings_direct_get_boolean (GDM_KEY_TIMED_LOGIN_ENABLE, &enabled); if (res && ! enabled) { goto out; } res = gdm_settings_direct_get_string (GDM_KEY_TIMED_LOGIN_USER, &username); if (res && (username == NULL || username[0] == '\0')) { enabled = FALSE; g_free (username); username = NULL; goto out; } delay = 0; res = gdm_settings_direct_get_int (GDM_KEY_TIMED_LOGIN_DELAY, &delay); if (res && delay <= 0) { /* we don't allow the timed login to have a zero delay */ delay = 10; } out: if (enabledp != NULL) { *enabledp = enabled; } if (usernamep != NULL) { *usernamep = username; } else { g_free (username); } if (delayp != NULL) { *delayp = delay; } }
static void gdm_display_real_get_timed_login_details (GdmDisplay *display, gboolean *enabledp, char **usernamep, int *delayp) { gboolean res; gboolean enabled; int delay; char *username; enabled = FALSE; username = NULL; delay = 0; res = gdm_settings_direct_get_boolean (GDM_KEY_AUTO_LOGIN_ENABLE, &enabled); if (enabled) { res = gdm_settings_direct_get_string (GDM_KEY_AUTO_LOGIN_USER, &username); } if (enabled && username != NULL && username[0] != '\0') { goto out; } g_free (username); username = NULL; enabled = FALSE; res = gdm_settings_direct_get_boolean (GDM_KEY_TIMED_LOGIN_ENABLE, &enabled); if (! enabled) { goto out; } res = gdm_settings_direct_get_string (GDM_KEY_TIMED_LOGIN_USER, &username); if (username == NULL || username[0] == '\0') { enabled = FALSE; g_free (username); username = NULL; goto out; } delay = 0; res = gdm_settings_direct_get_int (GDM_KEY_TIMED_LOGIN_DELAY, &delay); if (delay <= 0) { /* we don't allow the timed login to have a zero delay */ delay = 10; } out: if (enabledp != NULL) { *enabledp = enabled; } if (usernamep != NULL) { *usernamep = username; } else { g_free (username); } if (delayp != NULL) { *delayp = delay; } }