--- a/daemon/gdm-session-record.c	2012-09-07 04:33:20.000000000 +1000
+++ b/daemon/gdm-session-record.c	2012-10-11 13:20:34.000000000 +1100
@@ -124,20 +124,43 @@
         }
         g_debug ("using ut_pid %d", (int) u->ut_pid);
 #endif
 }
 
 static void
 record_set_id (UTMP       *u,
                const char *id)
 {
 #if defined(HAVE_UT_UT_ID)
+/* PSz 11 Oct 12
+ * Seems this record_set_id() is only ever called to set ID to $DISPLAY.
+ * 
+ * For console logins, $DISPLAY may be ":0" and that might be a sensible ID.
+ * But for remote XDMCP clients, $DISPLAY is "IP.of.cli.ent:0" and that does
+ * not go well into a 4-byte ut_id, is likely to cause all the clients use
+ * the same ut_id of "192."
+ * 
+ * It may be sensible to simply leave ut_id="" as then getutxid() will use
+ * ut_line to match, see sysdeps/generic/utmp-equal.h in libc sources.
+ * In fact we ourselves do such similar matching ourselves, ignoring ut_id,
+ * when "Updating existing utmp record".
+ * 
+ * Another idea might be to encode session_pid into ut_id, say somewhat
+ * similarly to Samba ut_id_encode() in source/smbd/utmp.c . But I am lazy
+ * and go for the simple "leave blank".
+ * 
+ * Based on previous patch for older version, see:
+ *   http://bugs.debian.org/551802
+ *   https://bugzilla.gnome.org/show_bug.cgi?id=599103
+ */
+        return;
+/* No need for return above, since record_set_id() is never called */
         strncpy (u->ut_id, id, sizeof (u->ut_id));
         g_debug ("using ut_id %.*s", (int) sizeof (u->ut_id), u->ut_id);
 #endif
 }
 
 static void
 record_set_host (UTMP       *u,
                  const char *x11_display_name,
                  const char *host_name)
 {
@@ -211,21 +234,22 @@
 
 #if defined(HAVE_UT_UT_TYPE)
         session_record.ut_type = USER_PROCESS;
         g_debug ("using ut_type USER_PROCESS");
 #endif
 
         record_set_timestamp (&session_record);
         record_set_pid (&session_record, session_pid);
 
         /* Set ut_id to the $DISPLAY value */
-        record_set_id (&session_record, x11_display_name);
+        /* PSz 11 Oct 12 Do not set ut_id to $DISPLAY, but leave blank */
+/*      record_set_id (&session_record, x11_display_name); */
         record_set_host (&session_record, x11_display_name, host_name);
         record_set_line (&session_record, display_device, x11_display_name);
 
         /* Handle wtmp */
         g_debug ("Writing wtmp session record to " GDM_NEW_SESSION_RECORDS_FILE);
 #if defined(HAVE_UPDWTMPX)
         updwtmpx (GDM_NEW_SESSION_RECORDS_FILE, &session_record);
 #elif defined(HAVE_UPDWTMP)
         updwtmp (GDM_NEW_SESSION_RECORDS_FILE, &session_record);
 #elif defined(HAVE_LOGWTMP) && defined(HAVE_UT_UT_HOST)
@@ -279,21 +303,22 @@
         g_debug ("Writing logout record");
 
 #if defined(HAVE_UT_UT_TYPE)
         session_record.ut_type = DEAD_PROCESS;
         g_debug ("using ut_type DEAD_PROCESS");
 #endif
 
         record_set_timestamp (&session_record);
         record_set_pid (&session_record, session_pid);
         /* Set ut_id to the $DISPLAY value */
-        record_set_id (&session_record, x11_display_name);
+        /* PSz 11 Oct 12 Do not set ut_id to $DISPLAY, but leave blank */
+/*      record_set_id (&session_record, x11_display_name); */
         record_set_host (&session_record, x11_display_name, host_name);
         record_set_line (&session_record, display_device, x11_display_name);
 
 
         /* Handle wtmp */
         g_debug ("Writing wtmp logout record to " GDM_NEW_SESSION_RECORDS_FILE);
 #if defined(HAVE_UPDWTMPX)
         updwtmpx (GDM_NEW_SESSION_RECORDS_FILE, &session_record);
 #elif defined (HAVE_UPDWTMP)
         updwtmp (GDM_NEW_SESSION_RECORDS_FILE, &session_record);
@@ -352,21 +377,22 @@
         g_debug ("Writing failed session attempt record");
 
 #if defined(HAVE_UT_UT_TYPE)
         session_record.ut_type = USER_PROCESS;
         g_debug ("using ut_type USER_PROCESS");
 #endif
 
         record_set_timestamp (&session_record);
         record_set_pid (&session_record, session_pid);
         /* Set ut_id to the $DISPLAY value */
-        record_set_id (&session_record, x11_display_name);
+        /* PSz 11 Oct 12 Do not set ut_id to $DISPLAY, but leave blank */
+/*      record_set_id (&session_record, x11_display_name); */
         record_set_host (&session_record, x11_display_name, host_name);
         record_set_line (&session_record, display_device, x11_display_name);
 
         /* Handle btmp */
         g_debug ("Writing btmp failed session attempt record to "
                  GDM_BAD_SESSION_RECORDS_FILE);
 
 #if defined(HAVE_UPDWTMPX)
         updwtmpx (GDM_BAD_SESSION_RECORDS_FILE, &session_record);
 #elif defined(HAVE_UPDWTMP)
