rpms/gdm/devel gdm-2.6.0.5-wait-for-bootup.patch, NONE, 1.1 gdm.spec, 1.59, 1.60

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Mar 28 20:04:27 UTC 2005


Update of /cvs/dist/rpms/gdm/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23877

Modified Files:
	gdm.spec 
Added Files:
	gdm-2.6.0.5-wait-for-bootup.patch 
Log Message:
Add a --wait-for-system-started cmdline option


gdm-2.6.0.5-wait-for-bootup.patch:
 daemon/gdm.c          |   10 +++++
 daemon/gdm.h          |    9 ++++
 daemon/slave.c        |  100 +++++++++++++++++++++++++++++++++++++++++---------
 daemon/slave.h        |    3 +
 daemon/verify-pam.c   |   57 +++++++++++++++++++++++++---
 gui/greeter/greeter.c |    9 +++-
 6 files changed, 162 insertions(+), 26 deletions(-)

--- NEW FILE gdm-2.6.0.5-wait-for-bootup.patch ---
diff -ur gdm-2.6.0.5/daemon/gdm.c gdm-2.6.0.5-wait-for-bootup/daemon/gdm.c
--- gdm-2.6.0.5/daemon/gdm.c	2004-08-03 19:18:58.000000000 -0400
+++ gdm-2.6.0.5-wait-for-bootup/daemon/gdm.c	2005-03-23 13:28:15.000000000 -0500
@@ -87,6 +87,7 @@
 pid_t gdm_main_pid = 0;		/* PID of the main daemon */
 
 gboolean gdm_wait_for_go = FALSE; /* wait for a GO in the fifo */
+gboolean gdm_wait_for_system_started = FALSE; /* wait for a SYSTEM_STARTED event in the fifo */
 
 gboolean print_version = FALSE; /* print version number and quit */
 gboolean preserve_ld_vars = FALSE; /* Preserve the ld environment variables */
@@ -1865,6 +1866,8 @@
 	  &print_version, 0, N_("Print GDM version"), NULL },
 	{ "wait-for-go", '\0', POPT_ARG_NONE,
 	  &gdm_wait_for_go, 0, N_("Start the first X server but then halt until we get a GO in the fifo"), NULL },
+	{ "wait-for-system-started", '\0', POPT_ARG_NONE,
+	  &gdm_wait_for_system_started, 0, N_("Don't allow the user to login until we get a SYSTEM_STARTED in the fifo"), NULL },
 	{ "monte-carlo-sqrt2", 0, POPT_ARG_NONE,
 	  &monte_carlo_sqrt2, 0, NULL, NULL },
         POPT_AUTOHELP
@@ -2772,6 +2775,13 @@
 				gdm_xdmcp_run();
 			}
 		}
+	} else if (strcmp (msg, GDM_SOP_SYSTEM_STARTED) == 0) {
+		GSList *li;
+		gdm_wait_for_system_started = FALSE;
+		for (li = displays; li != NULL; li = li->next) {
+			GdmDisplay *d = li->data;
+			send_slave_command (d, GDM_NOTIFY_SYSTEM_STARTED);
+		}
 	} else if (strncmp (msg, GDM_SOP_WRITE_X_SERVERS " ",
 		            strlen (GDM_SOP_WRITE_X_SERVERS " ")) == 0) {
 		GdmDisplay *d;
diff -ur gdm-2.6.0.5/daemon/gdm.h gdm-2.6.0.5-wait-for-bootup/daemon/gdm.h
--- gdm-2.6.0.5/daemon/gdm.h	2005-03-23 16:37:00.000000000 -0500
+++ gdm-2.6.0.5-wait-for-bootup/daemon/gdm.h	2005-03-23 13:28:15.000000000 -0500
@@ -107,6 +107,7 @@
 #define GDM_FOCUS      'F' /* Allow focus on the login window again (optional) */
 #define GDM_SAVEDIE    '!' /* Save wm order and die (and set busy cursor) */
 #define GDM_QUERY_CAPSLOCK 'Q' /* Is capslock on? */
+#define GDM_ALLOW_LOGIN    'a' /* Allow login to take place (when system is fully started) */
 
 /* Different login interruptions */
 #define GDM_INTERRUPT_TIMED_LOGIN 'T'
@@ -115,6 +116,7 @@
 #define GDM_INTERRUPT_SELECT_USER 'U'
 #define GDM_INTERRUPT_LOGIN_SOUND 'L'
 #define GDM_INTERRUPT_THEME       'H'
+#define GDM_INTERRUPT_LOGIN       ''
 
 /* The dreaded miscellaneous category */
 #define FIELD_SIZE 256
@@ -543,6 +545,10 @@
    the --wait-for-go command line option */
 #define GDM_SOP_GO "GO" /* no arguments */
 
+/* stop waiting for this and go on with login, useful with
+   the --wait-for-system-started command line option */
+#define GDM_SOP_SYSTEM_STARTED "SYSTEM_STARTED" /* no arguments */
+
 /* sometimes we can't do a syslog so we tell the main daemon */
 #define GDM_SOP_SYSLOG "SYSLOG" /* <pid> <type> <message> */
 
@@ -588,6 +594,7 @@
 #define GDM_NOTIFY_DIRTY_SERVERS "DIRTY_SERVERS"
 #define GDM_NOTIFY_SOFT_RESTART_SERVERS "SOFT_RESTART_SERVERS"
 #define GDM_NOTIFY_GO "GO"
+#define GDM_NOTIFY_SYSTEM_STARTED "SYSTEM_STARTED"
 #define GDM_NOTIFY_TWIDDLE_POINTER "TWIDDLE_POINTER"
 
 /* Ack for a slave message */
@@ -933,4 +940,4 @@
 
 #endif /* GDM_H */
 
-/* EOF */
+
diff -ur gdm-2.6.0.5/daemon/slave.c gdm-2.6.0.5-wait-for-bootup/daemon/slave.c
--- gdm-2.6.0.5/daemon/slave.c	2005-03-23 16:37:00.000000000 -0500
+++ gdm-2.6.0.5-wait-for-bootup/daemon/slave.c	2005-03-23 15:10:26.000000000 -0500
@@ -110,6 +110,8 @@
 static uid_t logged_in_uid = -1;
 static gid_t logged_in_gid = -1;
 
+gboolean gdm_login_is_canceled = FALSE;
+
 static gboolean interrupted = FALSE;
 static gchar *ParsedAutomaticLogin = NULL;
 static gchar *ParsedTimedLogin = NULL;
@@ -137,6 +139,9 @@
 /* wait for a GO in the SOP protocol */
 extern gboolean gdm_wait_for_go;
 
+/* wait for a SYSTEM_STARTED in the SOP protocol */
+extern gboolean gdm_wait_for_system_started;
+
 /* Configuration option variables */
 extern gchar *GdmUser;
 extern uid_t GdmUserId;
@@ -212,6 +217,9 @@
 static void	check_notifies_now (void);
 static void	restart_the_greeter (void);
 
+
+static char *   get_greeter_message (void);
+
 /* Yay thread unsafety */
 static gboolean x_error_occured = FALSE;
 static gboolean gdm_got_ack = FALSE;
@@ -1101,7 +1109,7 @@
 	gdm_slave_send_string (GDM_SOP_QUERYLOGIN, user);
 	if G_LIKELY (ve_string_empty (gdm_ack_response))
 	       return TRUE;	
-	vec = g_strsplit (gdm_ack_response, ",", -1);
+	vec = g_strsplit (gdm_ack_response, ",", 0);
 	if (vec == NULL)
 		return TRUE;
 
@@ -1952,6 +1960,48 @@
 
 	gdm_debug ("gdm_slave_wait_for_login: got_login for '%s'",
 		   ve_sure_string (login));
+
+}
+
+static gboolean 
+pending_greeter_message (void)
+{
+	struct timeval tv;
+	fd_set fd_set;
+	int retval;
+
+	/* Watch stdin (fd 0) to see when it has input. */
+	FD_ZERO (&fd_set);
+	FD_SET (greeter_fd_in, &fd_set);
+
+	tv.tv_sec = 1;
+	tv.tv_usec = 0;
+	retval = select (greeter_fd_in + 1, &fd_set, NULL, NULL, &tv);
+
+	if (retval > 0)
+		return TRUE;
+
+	return FALSE;
+}
+
+gboolean 
+gdm_slave_wait_for_system_started (void)
+{
+	gchar *message;
+
+	while (gdm_wait_for_system_started && !gdm_login_is_canceled) {
+
+		if (pending_greeter_message ())
+		{
+			/* get_greeter_message() has a side effect
+			 * of setting login_canceled when the user
+			 * presses escape
+			 */
+			g_free (get_greeter_message ());
+		}
+	}
+
+	return gdm_wait_for_system_started;
 }
 
 /* If path starts with a "trusted" directory, don't sanity check things */
@@ -4694,6 +4744,8 @@
 				}
 			} else if (strcmp (&s[1], GDM_NOTIFY_GO) == 0) {
 				gdm_wait_for_go = FALSE;
+			} else if (strcmp (&s[1], GDM_NOTIFY_SYSTEM_STARTED) == 0) {
+				gdm_wait_for_system_started = FALSE;
 			} else if (strcmp (&s[1], GDM_NOTIFY_TWIDDLE_POINTER) == 0) {
 				gdm_twiddle_pointer (d);
 			}
@@ -4858,6 +4910,9 @@
 				d->theme_name = g_strdup (&msg[2]);
 			gdm_slave_send_string (GDM_SOP_CHOSEN_THEME, &msg[2]);
 			return TRUE;
+		case GDM_INTERRUPT_LOGIN:
+			gdm_login_is_canceled = TRUE;
+			break;
 		default:
 			break;
 		}
@@ -4872,6 +4927,30 @@
 	return FALSE;
 }
 
+static char *
+get_greeter_message (void)
+{
+    gchar *buf, c;
+
+    buf = NULL;
+    do {
+      g_free (buf);
+      buf = NULL;
+      /* Skip random junk that might have accumulated */
+      do {
+	    c = gdm_fdgetc (greeter_fd_in);
+      } while (c != EOF && c != STX);
+    
+      if (c == EOF ||
+	  (buf = gdm_fdgets (greeter_fd_in)) == NULL) {
+	      interrupted = TRUE;
+	      /* things don't seem well with the greeter, it probably died */
+	      return NULL;
+      }
+    } while (check_for_interruption (buf) && ! interrupted);
+
+    return buf;
+}
 
 char * 
 gdm_slave_greeter_ctl (char cmd, const char *str)
@@ -4896,21 +4975,7 @@
     sched_yield ();
 #endif
 
-    do {
-      g_free (buf);
-      buf = NULL;
-      /* Skip random junk that might have accumulated */
-      do {
-	    c = gdm_fdgetc (greeter_fd_in);
-      } while (c != EOF && c != STX);
-    
-      if (c == EOF ||
-	  (buf = gdm_fdgets (greeter_fd_in)) == NULL) {
-	      interrupted = TRUE;
-	      /* things don't seem well with the greeter, it probably died */
-	      return NULL;
-      }
-    } while (check_for_interruption (buf) && ! interrupted);
+    buf = get_greeter_message ();
 
     /* user responses take kind of random amount of time */
     gdm_random_tick ();
@@ -5243,7 +5308,8 @@
 {
 	if (do_timed_login ||
 	    do_configurator ||
-	    do_restart_greeter)
+	    do_restart_greeter ||
+	    gdm_login_is_canceled)
 		return FALSE;
 	return TRUE;
 }
diff -ur gdm-2.6.0.5/daemon/slave.h gdm-2.6.0.5-wait-for-bootup/daemon/slave.h
--- gdm-2.6.0.5/daemon/slave.h	2004-05-06 18:29:34.000000000 -0400
+++ gdm-2.6.0.5-wait-for-bootup/daemon/slave.h	2005-03-23 13:28:15.000000000 -0500
@@ -41,6 +41,9 @@
 /* This is the slave child handler so that we can chain to it from elsewhere */
 void	 gdm_slave_child_handler (int sig);
 
+/* This function blocks until the system is started or the user cancels login attempt */
+gboolean gdm_slave_wait_for_system_started (void);
+
 #endif /* GDM_SLAVE_H */
 
 /* EOF */
diff -ur gdm-2.6.0.5/daemon/verify-pam.c gdm-2.6.0.5-wait-for-bootup/daemon/verify-pam.c
--- gdm-2.6.0.5/daemon/verify-pam.c	2004-09-14 10:03:01.000000000 -0400
+++ gdm-2.6.0.5-wait-for-bootup/daemon/verify-pam.c	2005-03-23 15:23:19.000000000 -0500
@@ -57,6 +57,8 @@
 extern gboolean GdmDisplayLastLogin;
 
 extern gboolean no_console;
+extern gboolean gdm_wait_for_system_started;
+extern gboolean gdm_login_is_canceled;
 
 /* Evil, but this way these things are passed to the child session */
 static pam_handle_t *pamh = NULL;
@@ -496,8 +498,34 @@
 		    free (reply);
 		    return PAM_CONV_ERR;
 	    }
-	    reply[replies].resp_retcode = PAM_SUCCESS;
-	    reply[replies].resp = strdup (ve_sure_string (s));
+
+	    if (gdm_wait_for_system_started) {
+		    gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, _("The system is not fully booted "
+							        "yet. Login will procede when the "
+							        "system is ready."));
+		    gdm_slave_greeter_ctl_no_ret (GDM_MSG, _("Press escape to cancel login attempt"));
+
+	    }
+
+	    /* gdm_slave_wait_for_system_started () waits for 
+             * the system to be started far enough to allow login.
+             * It returns TRUE if we are still waiting. This occurs 
+             * only if the user pressed escape to cancel the login 
+             * attempt.
+	     * We then need to reset the login_canceled variable.
+             */
+	    if (!gdm_slave_wait_for_system_started ()) {
+		    gdm_slave_greeter_ctl_no_ret (GDM_MSG, "");
+		    gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, "");
+	            reply[replies].resp = strdup (ve_sure_string (s));
+		    reply[replies].resp_retcode = PAM_SUCCESS;
+	    } else {
+		    for (i = 0; i < replies; i++)
+			    if (reply[replies].resp != NULL)
+				    free (reply[replies].resp);
+		    free (reply);
+		    return PAM_CONV_ERR;
+	    }
 	    g_free (s);
 	    break;
 	    
@@ -529,7 +557,6 @@
     return PAM_SUCCESS;
 }
 
-
 static struct pam_conv pamc = {
     &gdm_verify_pam_conv,
     NULL
@@ -723,7 +750,7 @@
     gboolean error_msg_given;
     gboolean credentials_set;
     gboolean started_timer;
-    int null_tok;
+    int null_tok = 0;
 #ifdef HAVE_ADT
     int pw_change = PW_FALSE;   /* if got to trying to change password */
 #endif	/* HAVE_ADT */
@@ -735,7 +762,7 @@
     error_msg_given = FALSE;
     credentials_set = FALSE;
     started_timer = FALSE;
-    null_tok = 0;
+    gdm_login_is_canceled = FALSE;
 
     /* start the timer for timed logins */
     if ( ! ve_string_empty (GdmTimedLogin) &&
@@ -796,8 +823,23 @@
     did_we_ask_for_password = FALSE;
 
     gdm_verify_select_user (NULL);
+
     /* Start authentication session */
     if ((pamerr = pam_authenticate (pamh, null_tok)) != PAM_SUCCESS) {
+            if (gdm_login_is_canceled) {
+		    /* cleanup stuff */
+		    gdm_slave_greeter_ctl_no_ret (GDM_SETLOGIN, "");
+		    g_free (login);
+		    login = NULL;
+		    /* this will clear the message */
+		    gdm_slave_greeter_ctl_no_ret (GDM_RESET, "");
+		    gdm_slave_greeter_ctl_no_ret (GDM_MSG, "");
+		    gdm_slave_greeter_ctl_no_ret (GDM_ERRBOX, "");
+
+		    gdm_verify_cleanup (d);
+
+		    return NULL;
+	    }
 	    if ( ! ve_string_empty (selected_user)) {
 		    pam_handle_t *tmp_pamh;
 
@@ -825,7 +867,8 @@
 		    gdm_slave_greeter_ctl_no_ret (GDM_SETLOGIN, login);
 
 		    goto authenticate_again;
-	    }
+	    } 
+            	    
 	    if (started_timer)
 		    gdm_slave_greeter_ctl_no_ret (GDM_STOPTIMER, "");
 	    if (gdm_slave_action_pending ()) {
@@ -899,6 +942,7 @@
     }
 
     /* Check if the user's account is healthy. */
+    null_tok = 0;
     pamerr = pam_acct_mgmt (pamh, null_tok);
     switch (pamerr) {
     case PAM_SUCCESS :
@@ -1146,6 +1190,7 @@
     /* Start authentication session */
     did_we_ask_for_password = FALSE;
     if ((pamerr = pam_authenticate (pamh, null_tok)) != PAM_SUCCESS) {
+
 	    if (gdm_slave_action_pending ()) {
 		    gdm_error (_("Couldn't authenticate user"));
 		    gdm_error_box (cur_gdm_disp,
diff -ur gdm-2.6.0.5/gui/greeter/greeter.c gdm-2.6.0.5-wait-for-bootup/gui/greeter/greeter.c
--- gdm-2.6.0.5/gui/greeter/greeter.c	2004-08-03 19:06:21.000000000 -0400
+++ gdm-2.6.0.5-wait-for-bootup/gui/greeter/greeter.c	2005-03-23 13:28:15.000000000 -0500
@@ -567,9 +567,15 @@
 static gboolean
 key_press_event (GtkWidget *widget, GdkEventKey *key, gpointer data)
 {
-  if (DOING_GDM_DEVELOPMENT && (key->keyval == GDK_Escape))
+  if (key->keyval == GDK_Escape)
     {
+    if (DOING_GDM_DEVELOPMENT)
       gtk_main_quit ();
+    else
+    {
+      printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_LOGIN); 
+      fflush (stdout);
+    }
       
       return TRUE;
     }
@@ -1123,7 +1129,6 @@
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
-  if G_UNLIKELY (DOING_GDM_DEVELOPMENT)
     g_signal_connect (G_OBJECT (window), "key_press_event",
 		      G_CALLBACK (key_press_event), NULL);
   


Index: gdm.spec
===================================================================
RCS file: /cvs/dist/rpms/gdm/devel/gdm.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- gdm.spec	28 Mar 2005 10:56:12 -0000	1.59
+++ gdm.spec	28 Mar 2005 20:04:25 -0000	1.60
@@ -16,7 +16,7 @@
 Summary: The GNOME Display Manager.
 Name: gdm
 Version: 2.6.0.7
-Release: 7
+Release: 8
 Epoch: 1
 License: LGPL/GPL
 Group: User Interface/X
@@ -31,6 +31,7 @@
 Patch14: gdm-2.6.0.0-session-errors-in-tmp.patch
 Patch15: gdm-2.6.0.0-update-switchdesk-location.patch
 Patch16: gdm-2.6.0.0-pie.patch
+Patch18: gdm-2.6.0.5-wait-for-bootup.patch
 Patch19: gdm-2.6.0.5-cleanup-xses.patch
 Patch20: gdm-2.6.0.5-sort-session-list.patch
 Patch21: gdm-2.6.0.5-use-cannonical-username.patch
@@ -95,6 +96,7 @@
 %patch14 -p1 -b .session-errors
 %patch15 -p1 -b .update-switchdesk-location
 %patch16 -p1 -b .pie
+%patch18 -p1 -b .wait-for-bootup
 %patch19 -p1 -b .cleanup-xses
 %patch20 -p1 -b .sort-session-list
 %patch21 -p1 -b .use-cannonical-username
@@ -260,6 +262,9 @@
 %attr(1770, root, gdm) %dir %{_localstatedir}/gdm
 
 %changelog
+* Mon Mar 28 2005 Matthias Clasen <mclasen at redhat.com> 1:2.6.0.7-8
+- Add a --wait-for-system-startup cmdline option.
+
 * Mon Mar 28 2005 Christopher Aillon <caillon at redhat.com>
 - rebuilt
 
@@ -311,7 +316,8 @@
 - Prefer nb_NO over no_NO for Norwegian (fixes bug #136033)
 
 * Thu Oct  7 2004 Alexander Larsson <alexl at redhat.com> - 1:2.6.0.5-4
-- Change default greeter theme to "Default", require redhat-artwork with Default symlink.
+- Change default greeter theme to "Default", require 
+  redhat-artwork with Default symlink.
 
 * Wed Sep 29 2004 Ray Strode <rstrode at redhat.com> 1:2.6.0.5-3
 - Check if there is a selected node before using iterator.




More information about the fedora-cvs-commits mailing list