improve fast user switching experience

This commit is contained in:
Matthias Clasen 2007-02-07 03:55:33 +00:00
parent d0ac943d5a
commit 5a1cfbfe11
2 changed files with 377 additions and 1 deletions

369
gdm-2.17.6-username.patch Normal file
View File

@ -0,0 +1,369 @@
--- gdm-2.17.6/docs/C/gdm.xml.username 2007-01-22 00:31:17.000000000 -0500
+++ gdm-2.17.6/docs/C/gdm.xml 2007-02-06 22:52:08.000000000 -0500
@@ -2,8 +2,8 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY legal SYSTEM "legal.xml">
- <!ENTITY version "2.17.4">
- <!ENTITY date "12/13/2006">
+ <!ENTITY version "2.17.7">
+ <!ENTITY date "01/22/2007">
]>
<article id="index" lang="en">
@@ -13,7 +13,7 @@
<revhistory>
<revision>
<revnumber>0.0</revnumber>
- <date>2006-12</date>
+ <date>2007-01</date>
</revision>
</revhistory>
@@ -4515,7 +4515,9 @@
AUTH_LOCAL
CLOSE
FLEXI_XNEST
+FLEXI_XNEST_USER
FLEXI_XSERVER
+FLEXI_XSERVER_USER
GET_CONFIG
GET_CONFIG_FILE
GET_CUSTOM_CONFIG_FILE
@@ -4699,6 +4701,36 @@
</screen>
</sect3>
+ <sect3 id="flexixnestuser">
+ <title>FLEXI_XNEST_USER</title>
+<screen>
+FLEXI_XNEST_USER: Start a new flexible Xnest display and
+ initialize the greeter with the given username.
+Note: This is a variant of the FLEXI_XNEST command.
+Note: The cookie should be the MIT-MAGIC-COOKIE-1,
+ the first one GDM can find in the XAUTHORITY
+ file for this display. If that's not what you
+ use you should generate one first. The cookie
+ should be in hex form.
+Supported since: 2.17.7
+Arguments: &lt;username&gt; &lt;display to run on&gt; &lt;uid of requesting user&gt;
+ &lt;xauth cookie for the display&gt; &lt;xauth file&gt;
+Answers:
+ OK &lt;display&gt;
+ ERROR &lt;err number&gt; &lt;english error description&gt;
+ 0 = Not implemented
+ 1 = No more flexi servers
+ 2 = Startup errors
+ 3 = X failed
+ 4 = X too busy
+ 5 = Xnest can't connect
+ 6 = No server binary
+ 100 = Not authenticated
+ 200 = Too many messages
+ 999 = Unknown error
+</screen>
+ </sect3>
+
<sect3 id="flexixserver">
<title>FLEXI_XSERVER</title>
<screen>
@@ -4722,6 +4754,30 @@
</screen>
</sect3>
+ <sect3 id="flexixserveruser">
+ <title>FLEXI_XSERVER_USER</title>
+<screen>
+FLEXI_XSERVER_USER: Start a new X flexible display and initialize the
+ greeter with the given username. Only supported on
+ connection that passed AUTH_LOCAL
+Supported since: 2.17.7
+Arguments: &lt;username&gt; &lt;xserver type&gt;
+ If no server type specified, starts the standard X server
+Answers:
+ OK &lt;display&gt;
+ ERROR &lt;err number&gt; &lt;english error description&gt;
+ 0 = Not implemented
+ 1 = No more flexi servers
+ 2 = Startup errors
+ 3 = X failed
+ 4 = X too busy
+ 6 = No server binary
+ 100 = Not authenticated
+ 200 = Too many messages
+ 999 = Unknown error
+</screen>
+ </sect3>
+
<sect3 id="getconfig">
<title>GET_CONFIG</title>
<screen>
--- gdm-2.17.6/daemon/slave.c.username 2007-02-06 22:52:08.000000000 -0500
+++ gdm-2.17.6/daemon/slave.c 2007-02-06 22:52:08.000000000 -0500
@@ -1946,6 +1946,7 @@
gdm_slave_wait_for_login (void)
{
char *successsound;
+ char *username;
g_free (login);
login = NULL;
@@ -1970,10 +1971,14 @@
NEVER_FAILS_root_set_euid_egid (0, 0);
gdm_debug ("gdm_slave_wait_for_login: In loop");
+ username = d->preset_user;
+ d->preset_user = NULL;
login = gdm_verify_user (d /* the display */,
- NULL /* username*/,
+ username /* username*/,
d->name /* display name */,
d->attached /* display attached? (bool) */);
+ g_free (username);
+
gdm_debug ("gdm_slave_wait_for_login: end verify for '%s'",
ve_sure_string (login));
--- gdm-2.17.6/daemon/server.c.username 2007-01-22 00:20:40.000000000 -0500
+++ gdm-2.17.6/daemon/server.c 2007-02-06 22:52:08.000000000 -0500
@@ -1439,6 +1439,7 @@
d->retry_count = 0;
d->sleep_before_run = 0;
d->login = NULL;
+ d->preset_user = NULL;
d->timed_login_ok = FALSE;
--- gdm-2.17.6/daemon/gdm.h.username 2007-02-06 22:52:08.000000000 -0500
+++ gdm-2.17.6/daemon/gdm.h 2007-02-06 22:52:08.000000000 -0500
@@ -557,6 +557,8 @@
gboolean logged_in; /* TRUE if someone is logged in */
char *login;
+ char *preset_user;
+
gboolean timed_login_ok;
int screenx;
@@ -874,6 +876,26 @@
* 200 = Too many messages
* 999 = Unknown error
*/
+#define GDM_SUP_FLEXI_XSERVER_USER "FLEXI_XSERVER_USER" /* <username> <xserver type> */
+/* FLEXI_XSERVER_USER: Start a new X flexible display and initialize the
+ * greeter with the given username. Only supported on
+ * connection that passed AUTH_LOCAL
+ * Supported since: 2.17.7
+ * Arguments: <username> <xserver type>
+ * If no server type specified, starts the standard X server
+ * Answers:
+ * OK <display>
+ * ERROR <err number> <english error description>
+ * 0 = Not implemented
+ * 1 = No more flexi servers
+ * 2 = Startup errors
+ * 3 = X failed
+ * 4 = X too busy
+ * 6 = No server binary
+ * 100 = Not authenticated
+ * 200 = Too many messages
+ * 999 = Unknown error
+ */
#define GDM_SUP_FLEXI_XNEST "FLEXI_XNEST" /* <display> <uid> <xauth cookie> <xauth file> */
/* FLEXI_XNEXT: Start a new flexible Xnest display.
* Note: Supported on older versions from 2.2.4.0, later
@@ -909,6 +931,31 @@
* 200 = Too many messages
* 999 = Unknown error
*/
+#define GDM_SUP_FLEXI_XNEST_USER "FLEXI_XNEST_USER" /* <username> <display> <uid> <xauth cookie> <xauth file> */
+/* FLEXI_XNEXT_USER: Start a new flexible Xnest display and
+ * initialize the greeter with the given username
+ * Note: The cookie should be the MIT-MAGIC-COOKIE-1,
+ * the first one gdm can find in the XAUTHORITY
+ * file for this display. If that's not what you
+ * use you should generate one first. The cookie
+ * should be in hex form.
+ * Supported since: 2.17.7
+ * Arguments: <username> <display to run on> <uid of requesting user>
+ * <xauth cookie for the display> <xauth file>
+ * Answers:
+ * OK <display>
+ * ERROR <err number> <english error description>
+ * 0 = Not implemented
+ * 1 = No more flexi servers
+ * 2 = Startup errors
+ * 3 = X failed
+ * 4 = X too busy
+ * 5 = Xnest can't connect
+ * 6 = No server binary
+ * 100 = Not authenticated
+ * 200 = Too many messages
+ * 999 = Unknown error
+ */
#define GDM_SUP_ADD_DYNAMIC_DISPLAY "ADD_DYNAMIC_DISPLAY"
/*
* ADD_DYNAMIC_DISPLAY: Create a new server definition that will
--- gdm-2.17.6/daemon/display.c.username 2007-01-22 00:20:40.000000000 -0500
+++ gdm-2.17.6/daemon/display.c 2007-02-06 22:52:08.000000000 -0500
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -531,6 +533,9 @@
g_free (d->login);
d->login = NULL;
+ g_free (d->preset_user);
+ d->preset_user = NULL;
+
g_free (d->xsession_errors_filename);
d->xsession_errors_filename = NULL;
--- gdm-2.17.6/daemon/gdm.c.username 2007-02-06 22:52:08.000000000 -0500
+++ gdm-2.17.6/daemon/gdm.c 2007-02-06 22:53:54.000000000 -0500
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -103,7 +105,8 @@
const gchar *xnest_disp,
uid_t xnest_uid,
const gchar *xnest_auth_file,
- const gchar *xnest_cookie);
+ const gchar *xnest_cookie,
+ const gchar *username);
static void custom_cmd_restart (long cmd_id);
static void custom_cmd_no_restart (long cmd_id);
@@ -2563,7 +2566,7 @@
handle_flexi_server (NULL, TYPE_FLEXI, gdm_get_value_string (GDM_KEY_STANDARD_XSERVER),
TRUE /* handled */,
FALSE /* chooser */,
- NULL, 0, NULL, NULL);
+ NULL, 0, NULL, NULL, NULL);
} else if (strcmp (msg, GDM_SOP_CANCEL_LOGIN_REQUESTS) == 0) {
GSList *li;
for (li = displays; li != NULL; li = li->next) {
@@ -2970,7 +2973,8 @@
gboolean chooser,
const gchar *xnest_disp, uid_t xnest_uid,
const gchar *xnest_auth_file,
- const gchar *xnest_cookie)
+ const gchar *xnest_cookie,
+ const gchar *username)
{
GdmDisplay *display;
gchar *bin;
@@ -3102,6 +3106,7 @@
flexi_servers++;
+ display->preset_user = g_strdup (username);
display->type = type;
display->socket_conn = conn;
display->parent_disp = g_strdup (xnest_disp);
@@ -3243,6 +3248,7 @@
gdm_handle_user_message (GdmConnection *conn, const gchar *msg, gpointer data)
{
gint i;
+ gboolean has_user;
gdm_debug ("Handling user message: '%s'", msg);
@@ -3311,12 +3317,16 @@
handle_flexi_server (conn, TYPE_FLEXI, gdm_get_value_string (GDM_KEY_STANDARD_XSERVER),
TRUE /* handled */,
FALSE /* chooser */,
- NULL, 0, NULL, NULL);
- } else if (strncmp (msg, GDM_SUP_FLEXI_XSERVER " ",
- strlen (GDM_SUP_FLEXI_XSERVER " ")) == 0) {
+ NULL, 0, NULL, NULL, NULL);
+ } else if (((has_user = strncmp (msg, GDM_SUP_FLEXI_XSERVER_USER " ",
+ strlen (GDM_SUP_FLEXI_XSERVER_USER " "))) == 0) ||
+ (strncmp (msg, GDM_SUP_FLEXI_XSERVER " ",
+ strlen (GDM_SUP_FLEXI_XSERVER " ")) == 0)) {
gchar *name;
const gchar *command = NULL;
GdmXserver *svr;
+ const gchar *rest;
+ gchar *username, *end;
/* Only allow locally authenticated connections */
if ( ! GDM_CONN_AUTHENTICATED(conn)) {
@@ -3327,7 +3337,21 @@
return;
}
- name = g_strdup (&msg[strlen (GDM_SUP_FLEXI_XSERVER " ")]);
+ if (has_user == 0) {
+ rest = msg + strlen (GDM_SUP_FLEXI_XSERVER_USER " ");
+ end = strchr (rest, ' ');
+ if (end) {
+ username = g_strndup (rest, end - rest);
+ rest = end + 1;
+ } else {
+ username = g_strdup (rest);
+ rest = rest + strlen (rest);
+ }
+ } else {
+ rest = msg + strlen (GDM_SUP_FLEXI_XSERVER " ");
+ username = NULL;
+ }
+ name = g_strdup (rest);
g_strstrip (name);
if (ve_string_empty (name)) {
g_free (name);
@@ -3357,13 +3381,27 @@
oh well, this makes other things simpler */
svr->handled,
svr->chooser,
- NULL, 0, NULL, NULL);
- } else if (strncmp (msg, GDM_SUP_FLEXI_XNEST " ",
- strlen (GDM_SUP_FLEXI_XNEST " ")) == 0) {
+ NULL, 0, NULL, NULL, username);
+ g_free (username);
+ } else if (((has_user = strncmp (msg, GDM_SUP_FLEXI_XNEST_USER " ",
+ strlen (GDM_SUP_FLEXI_XNEST_USER " "))) == 0) ||
+ (strncmp (msg, GDM_SUP_FLEXI_XNEST " ",
+ strlen (GDM_SUP_FLEXI_XNEST " ")) == 0)) {
gchar *dispname = NULL, *xauthfile = NULL, *cookie = NULL;
uid_t uid;
+ const gchar *rest;
+ gchar *username, *end;
+
+ if (has_user == 0) {
+ rest = msg + strlen (GDM_SUP_FLEXI_XNEST_USER " ");
+ end = strchr (rest, ' ');
+ username = g_strndup (rest, end - rest);
+ } else {
+ rest = msg;
+ username = NULL;
+ }
- extract_dispname_uid_xauthfile_cookie (msg, &dispname, &uid,
+ extract_dispname_uid_xauthfile_cookie (rest, &dispname, &uid,
&xauthfile, &cookie);
if (dispname == NULL) {
@@ -3387,10 +3425,11 @@
handle_flexi_server (conn, TYPE_FLEXI_XNEST, gdm_get_value_string (GDM_KEY_XNEST),
TRUE /* handled */,
FALSE /* chooser */,
- dispname, uid, xauthfile, cookie);
+ dispname, uid, xauthfile, cookie, username);
g_free (dispname);
g_free (xauthfile);
+ g_free (username);
} else if ((strncmp (msg, GDM_SUP_ATTACHED_SERVERS,
strlen (GDM_SUP_ATTACHED_SERVERS)) == 0) ||
(strncmp (msg, GDM_SUP_CONSOLE_SERVERS,

View File

@ -16,7 +16,7 @@
Summary: The GNOME Display Manager
Name: gdm
Version: 2.17.6
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
License: LGPL/GPL
Group: User Interface/X
@ -51,6 +51,9 @@ Patch25: gdm-2.16.0-indic-langs.patch
Patch28: gdm-2.17.1-desensitize-entry.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=335786
Patch30: gdm-2.17.6-username.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Prereq: /usr/sbin/useradd
@ -122,6 +125,7 @@ several different X sessions on your local machine at the same time.
%patch24 -p1 -b .wtmp
%patch25 -p1 -b .indic-langs
%patch28 -p1 -b .desensitize-entry
%patch30 -p1 -b .username
%build
cp -f %{SOURCE1} config/gdm
@ -311,6 +315,9 @@ fi
%attr(1770, root, gdm) %dir %{_localstatedir}/gdm
%changelog
* Tue Feb 6 2007 Matthias Clasen <mclasen@redhat.com> - 1:2.17.6-2
- Apply a patch to improve fast user switching experience
* Tue Jan 23 2007 Matthias Clasen <mclasen@redhat.com> - 1:2.17.6-1
- Update to 2.17.6