Re: [gdm-list] gdm_common_debug()?




Andrew:

If not using syslog, how does a person see the output of
gdm_common_debug() in, for example, gui/gdmlogin.c?  The code says it
prints it to stdout, but I am not certain where to see that.

I think I am using a local static display.

syslog just means that the output goes to your system log, which is
normally /var/log/messages (or /var/adm/messages on some distros).
Check to see if messages are being appended to this file with "gdm"
as the program, should look like this (note "gdm" after the username
column:

Aug 15 16:28:59 username gdm[20913]: [ID 702911 daemon.error] Couldn't
authenticate user

Note you must have debug enabled in the GDM configuration for this to
work.  Run gdmsetup and make sure debug in the Security tab is checked.

If your system isn't set up to send system messages to syslog, then
I'm not sure where the GDM debug messages would go, probably to
/dev/null.

I enabled debug and am definitely am getting certain gdm debug messages. For example, everything in daemon/slave is fine, but for the gui, I only get debug messages about "Sending command" and "Got response".

Sep 22 09:36:14 nar100 gdm[2793]: Handling user message: 'ATTACHED_SERVERS'
Sep 22 09:36:14 nar100 gdmgreeter[9214]:   Got response: 'OK :0,,7'
Sep 22 09:36:14 nar100 gdmgreeter[9214]: Sending command: 'CLOSE'
Sep 22 09:36:14 nar100 gdm[2793]: Handling user message: 'CLOSE'
Sep 22 09:36:14 nar100 gdm[9181]: gdm_slave_wait_for_login: In loop

I'm trying your suggestion in Gnome bug 340148 to unset GDM_TIMED_LOGIN_OK in the slave (which I have confirmed does happen), but it seems to have no effect on the GUI.

I am attaching my current patch.

Probably would require some serious hacking on GDM to get
the messages to appear elsewhere.

Just for now, I suppose I could use the old C fprintf() to print to append a log file. Or I could use GDB. But, I thought perhaps there was a normal way to get these messages.


Andrew
--- gdm-2.14.9.original/daemon/slave.c	2006-05-19 17:04:32.000000000 -0600
+++ gdm-2.14.9/daemon/slave.c	2006-09-21 17:16:16.000000000 -0600
@@ -184,6 +184,8 @@
 static gboolean gdm_can_i_assume_root_role (struct passwd *pwent);
 #endif
 
+gboolean gdm_is_user_valid (const char *username);
+
 /* Yay thread unsafety */
 static gboolean x_error_occurred = FALSE;
 static gboolean gdm_got_ack = FALSE;
@@ -2564,6 +2566,10 @@
 		g_unsetenv ("GDM_TIMED_LOGIN_OK");
 	}
 
+	gdm_debug ("ahz slave: d->timed_login_ok=%i\n", d->timed_login_ok);
+	gdm_debug ("ahz slave: ParsedTimedLogin=%s, GDM_TIMED_LOGIN_OK=%s", 
+		ParsedTimedLogin, g_getenv("GDM_TIMED_LOGIN_OK"));
+
 	if (SERVER_IS_FLEXI (d)) {
 		g_setenv ("GDM_FLEXI_SERVER", "yes", TRUE);
 	} else {
@@ -5484,7 +5490,22 @@
       }
     }
 
-    return g_string_free (str, FALSE);
+    if (!ve_string_empty(str->str) && gdm_is_user_valid(str->str))
+	    return g_string_free (str, FALSE);
+    else
+    {
+        /* "If an empty or otherwise invalid username is returned [by the script]
+         *  automatic login is not performed." -- GDM manual 
+	 */
+	gdm_debug ("ahz slave: Script returned invalid username: '%s'", str->str);
+	/* fixme: also turn off automatic login */
+	/* fixme: none of these commands turn off timed login */
+	gdm_set_value_bool(GDM_KEY_TIMED_LOGIN_ENABLE, FALSE);
+	d->timed_login_ok = FALSE;
+	do_timed_login = FALSE;
+	g_string_free(str, TRUE);
+	return NULL;
+    }
 }
 
 static void
@@ -5668,4 +5689,16 @@
 }
 #endif /* HAVE_TSOL */
 
+
+/* gdm_is_user_valid() copied from gui/gdmuser.c */
+gboolean
+gdm_is_user_valid (const char *username)
+{
+    struct passwd *pwent;
+    pwent = getpwnam (username);
+    if (pwent != NULL)
+	return TRUE;
+
+    return FALSE;
+}
 /* EOF */
--- gdm-2.14.9.original/gui/gdmlogin.c	2006-05-31 04:11:52.000000000 -0600
+++ gdm-2.14.9/gui/gdmlogin.c	2006-09-22 09:32:57.000000000 -0600
@@ -423,6 +423,9 @@
 static gboolean
 gdm_timer (gpointer data)
 {
+	gdm_common_debug("ahz debug gdm_timer()\n");
+	gdm_common_info("ahz info gdm_timer()\n");
+
 	if (gdm_timed_delay <= 0) {
 		/* timed interruption */
 		printf ("%c%c%c\n", STX, BEL, GDM_INTERRUPT_TIMED_LOGIN);
@@ -430,7 +433,7 @@
 	} else {
 		gchar *autologin_msg;
 
-		/* Note that this message is not handled the same way as in
+				/* Note that this message is not handled the same way as in
 		 * the greeter, we don't parse it through the enriched text.
 		 */
 		autologin_msg = gdm_common_expand_text (
@@ -1615,6 +1618,9 @@
     if (len != 1)
 	return (TRUE);
 
+    gdm_common_debug("ahz debug opcode=%c()\n", buf[0]);
+    gdm_common_info("ahz info opcode=%c()\n", buf[0]);
+
     /* Parse opcode */
     switch (buf[0]) {
     case GDM_SETLOGIN:
@@ -1959,12 +1965,18 @@
 	 * Timed Login: Start Timer Loop
 	 */
 
+	gdm_common_debug("ahz debug GDM_STARTTIMER\n");
+	gdm_common_info("ahz info GDM_STARTTIMER\n");
+	gdm_common_debug("ahz GDM_STARTTIMER: GDM_TIMED_LOGIN_OK = %s\n", g_getenv("GDM_TIMED_LOGIN_OK"));
+
 	if (timed_handler_id == 0 &&
+	    NULL != g_getenv("GDM_TIMED_LOGIN_OK") && 
 	    gdm_config_get_bool (GDM_KEY_TIMED_LOGIN_ENABLE) &&
 	    ! ve_string_empty (gdm_config_get_string (GDM_KEY_TIMED_LOGIN)) &&
 	    gdm_config_get_int (GDM_KEY_TIMED_LOGIN_DELAY) > 0) {
 		gdm_timed_delay = gdm_config_get_int (GDM_KEY_TIMED_LOGIN_DELAY);
 		timed_handler_id  = g_timeout_add (1000, gdm_timer, NULL);
+		gdm_common_debug("ahz new timed_handler_id = %i\n", timed_handler_id);
 	}
 	printf ("%c\n", STX);
 	fflush (stdout);
--- gdm-2.14.9.original/gui/gdmcommon.c	2006-03-13 14:18:24.000000000 -0700
+++ gdm-2.14.9/gui/gdmcommon.c	2006-09-21 17:57:00.000000000 -0600
@@ -176,8 +176,17 @@
     s = g_strdup_vprintf (format, args);
     va_end (args);
 
+#if 1
+    if (using_syslog)
+        syslog (LOG_ERR, "%s", s);
+    else
+        g_printf ("%s\n", s);
+#else
+    /* ahz: what is this?  why is it different than gdm_common_error() for example? */
     syslog (LOG_ERR, "%s", s);
     closelog ();
+#endif
+
     g_free (s);
 }
 
@@ -708,7 +717,7 @@
 		g_string_append (str, _(" second"));
 	      break;
 	    case 'u':
-	      g_string_append (str, ve_sure_string (gdm_config_get_string (GDM_KEY_TIMED_LOGIN)));
+	      g_string_append (str, ve_sure_string (g_getenv("GDM_TIMED_LOGIN_OK")));
 	      break;
 	    default:
 	      if (ch < 127)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]