rpms/gdm/devel gdm-2.6.0.7-wait-for-bootup.patch, NONE, 1.1 gdm.spec, 1.61, 1.62 gdm-2.6.0.5-wait-for-bootup.patch, 1.5, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Mar 29 15:19:40 UTC 2005


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

Modified Files:
	gdm.spec 
Added Files:
	gdm-2.6.0.7-wait-for-bootup.patch 
Removed Files:
	gdm-2.6.0.5-wait-for-bootup.patch 
Log Message:
- Update patch to hopefully build on x86_64


gdm-2.6.0.7-wait-for-bootup.patch:
 daemon/gdm.c          |   10 ++++
 daemon/gdm.h          |    8 +++
 daemon/slave.c        |  102 +++++++++++++++++++++++++++++++++++++++++---------
 daemon/slave.h        |    3 +
 daemon/verify-pam.c   |   53 +++++++++++++++++++++++--
 gui/greeter/greeter.c |    9 +++-
 6 files changed, 160 insertions(+), 25 deletions(-)

--- NEW FILE gdm-2.6.0.7-wait-for-bootup.patch ---
--- gdm-2.6.0.7/gui/greeter/greeter.c.wait-for-bootup	2005-01-13 21:07:57.000000000 -0500
+++ gdm-2.6.0.7/gui/greeter/greeter.c	2005-03-29 10:11:54.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;
     }
@@ -1124,7 +1130,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);
   
--- gdm-2.6.0.7/daemon/gdm.c.wait-for-bootup	2004-10-26 18:35:17.000000000 -0400
+++ gdm-2.6.0.7/daemon/gdm.c	2005-03-29 10:11:54.000000000 -0500
@@ -100,6 +100,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_bootup = FALSE; /* wait for a BOOTUP_COMPLETE event in the fifo */
 
 gboolean print_version = FALSE; /* print version number and quit */
 gboolean preserve_ld_vars = FALSE; /* Preserve the ld environment variables */
@@ -1898,6 +1899,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-bootup", '\0', POPT_ARG_NONE,
+	  &gdm_wait_for_bootup, 0, N_("Don't allow the user to login until we get a BOOTUP_COMPLETE in the fifo"), NULL },
 	{ "monte-carlo-sqrt2", 0, POPT_ARG_NONE,
 	  &monte_carlo_sqrt2, 0, NULL, NULL },
         POPT_AUTOHELP
@@ -2855,6 +2858,13 @@
 				gdm_xdmcp_run();
 			}
 		}
+	} else if (strcmp (msg, GDM_SOP_BOOTUP_COMPLETE) == 0) {
+		GSList *li;
+		gdm_wait_for_bootup = FALSE;
+		for (li = displays; li != NULL; li = li->next) {
+			GdmDisplay *d = li->data;
+			send_slave_command (d, GDM_NOTIFY_BOOTUP_COMPLETE);
+		}
 	} else if (strncmp (msg, GDM_SOP_WRITE_X_SERVERS " ",
 		            strlen (GDM_SOP_WRITE_X_SERVERS " ")) == 0) {
 		GdmDisplay *d;
--- gdm-2.6.0.7/daemon/slave.h.wait-for-bootup	2004-05-06 18:33:41.000000000 -0400
+++ gdm-2.6.0.7/daemon/slave.h	2005-03-29 10:11:54.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_bootup (void);
+
 #endif /* GDM_SLAVE_H */
 
 /* EOF */
--- gdm-2.6.0.7/daemon/gdm.h.wait-for-bootup	2005-03-29 10:11:54.000000000 -0500
+++ gdm-2.6.0.7/daemon/gdm.h	2005-03-29 10:11:54.000000000 -0500
@@ -115,6 +115,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 +544,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-bootup command line option */
+#define GDM_SOP_BOOTUP_COMPLETE "BOOTUP_COMPLETE" /* no arguments */
+
 /* sometimes we can't do a syslog so we tell the main daemon */
 #define GDM_SOP_SYSLOG "SYSLOG" /* <pid> <type> <message> */
 
@@ -591,6 +596,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_BOOTUP_COMPLETE "BOOTUP_COMPLETE"
 #define GDM_NOTIFY_TWIDDLE_POINTER "TWIDDLE_POINTER"
 
 /* Ack for a slave message */
@@ -941,4 +947,4 @@
 
 #endif /* GDM_H */
 
-/* EOF */
+
--- gdm-2.6.0.7/daemon/slave.c.wait-for-bootup	2005-03-29 10:11:54.000000000 -0500
+++ gdm-2.6.0.7/daemon/slave.c	2005-03-29 10:12:33.000000000 -0500
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <dirent.h>
+#include <sys/select.h>
 #include <unistd.h>
 #include <utime.h>
 #if defined(_POSIX_PRIORITY_SCHEDULING) && defined(HAVE_SCHED_YIELD)
@@ -36,6 +37,7 @@
 #endif
 #include <fcntl.h>
 #include <sys/types.h>
+#include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <strings.h>
@@ -110,6 +112,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 +141,9 @@
 /* wait for a GO in the SOP protocol */
 extern gboolean gdm_wait_for_go;
 
+/* wait for a BOOTUP_COMPLETE in the SOP protocol */
+extern gboolean gdm_wait_for_bootup;
+
 /* Configuration option variables */
 extern gchar *GdmUser;
 extern uid_t GdmUserId;
@@ -212,6 +219,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 +1111,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 +1962,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_bootup (void)
+{
+	gchar *message;
+
+	while (gdm_wait_for_bootup && !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_bootup;
 }
 
 /* If path starts with a "trusted" directory, don't sanity check things */
@@ -4707,6 +4759,8 @@
 				}
 			} else if (strcmp (&s[1], GDM_NOTIFY_GO) == 0) {
 				gdm_wait_for_go = FALSE;
+			} else if (strcmp (&s[1], GDM_NOTIFY_BOOTUP_COMPLETE) == 0) {
+				gdm_wait_for_bootup = FALSE;
 			} else if (strcmp (&s[1], GDM_NOTIFY_TWIDDLE_POINTER) == 0) {
 				gdm_twiddle_pointer (d);
 			}
@@ -4871,6 +4925,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;
 		}
@@ -4885,6 +4942,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)
@@ -4909,21 +4990,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 ();
@@ -5256,7 +5323,8 @@
 {
 	if (do_timed_login ||
 	    do_configurator ||
-	    do_restart_greeter)
+	    do_restart_greeter ||
+	    gdm_login_is_canceled)
 		return FALSE;
 	return TRUE;
 }
--- gdm-2.6.0.7/daemon/verify-pam.c.wait-for-bootup	2004-12-14 15:27:35.000000000 -0500
+++ gdm-2.6.0.7/daemon/verify-pam.c	2005-03-29 10:11:54.000000000 -0500
@@ -59,6 +59,8 @@
 extern gid_t GdmGroupId;
 
 extern gboolean no_console;
+extern gboolean gdm_wait_for_bootup;
+extern gboolean gdm_login_is_canceled;
 
 /* Evil, but this way these things are passed to the child session */
 static pam_handle_t *pamh = NULL;
@@ -498,8 +500,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_bootup) {
+		    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_bootup () 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_bootup ()) {
+		    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;
 	    
@@ -531,7 +559,6 @@
     return PAM_SUCCESS;
 }
 
-
 static struct pam_conv pamc = {
     &gdm_verify_pam_conv,
     NULL
@@ -725,7 +752,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 */
@@ -737,7 +764,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) &&
@@ -798,8 +825,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;
 
@@ -901,6 +943,7 @@
     }
 
     /* Check if the user's account is healthy. */
+    null_tok = 0;
     pamerr = pam_acct_mgmt (pamh, null_tok);
     switch (pamerr) {
     case PAM_SUCCESS :


Index: gdm.spec
===================================================================
RCS file: /cvs/dist/rpms/gdm/devel/gdm.spec,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- gdm.spec	29 Mar 2005 15:07:25 -0000	1.61
+++ gdm.spec	29 Mar 2005 15:19:37 -0000	1.62
@@ -30,7 +30,7 @@
 Patch13: gdm-selinux.patch
 Patch14: gdm-2.6.0.0-session-errors-in-tmp.patch
 Patch15: gdm-2.6.0.0-update-switchdesk-location.patch
-Patch18: gdm-2.6.0.5-wait-for-bootup.patch
+Patch18: gdm-2.6.0.7-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


--- gdm-2.6.0.5-wait-for-bootup.patch DELETED ---




More information about the fedora-cvs-commits mailing list