Package: gdm Version: 2.20.7-4lenny1 Severity: important Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=599103
Hi! Since gdm version 2.20, gdm has stopped using the sessreg command to register user sessions in utmp, and it uses its own code to do the registration. This code, however, does not work properly when the session is remote. All users are given the id that corresponds to the first 4 characters of the host, which taking into account that no resolution is used, tends to be "192.". Since this id is supposed to be unique, all users are registered with the same id, and only one is shown. $ who maxy tty3 2009-10-15 10:46 jtelez 2009-10-20 09:41 (192.168.200.110:0) marga pts/19 2009-10-20 09:53 (192.168.200.108:0.0) $ ps axu | grep gnome-session | grep -v dbus | grep -v seahorse marga 4308 0.0 0.4 31624 5972 ? Ssl 09:40 0:00 /usr/bin/gnome-session maxy 4746 0.0 0.3 31536 5892 ? Ssl 09:40 0:00 /usr/bin/gnome-session jtelez 5647 0.0 0.4 31616 5984 ? Ssl 09:41 0:00 /usr/bin/gnome-session Despite the fact that there are actually 3 sessions started, only one is shown by the who command, because the id is "192." for the three of them. More data about this bug can be found in this mail, by Maximiliano Curia: http://mail.gnome.org/archives/gdm-list/2009-October/msg00004.html Maximiliano has prepared a patch for gdm 2.20.7 (lenny's), and we've tested it with success in our environment, which I'm attaching to this mail. It'd be nice if this patch could be applied to lenny's gdm, so that other people using XDMCP don't have to experience the same. I have already reported it upstream as: https://bugzilla.gnome.org/show_bug.cgi?id=599103 -- Besos, Marga
Index: gdm-2.20.7/daemon/slave.c =================================================================== --- gdm-2.20.7.orig/daemon/slave.c 2009-10-20 16:00:07.000000000 -0300 +++ gdm-2.20.7/daemon/slave.c 2009-10-20 16:04:59.000000000 -0300 @@ -4333,7 +4333,14 @@ #endif #if defined(HAVE_UT_UT_ID) - strncpy (record.ut_id, d->name, sizeof (record.ut_id)); + /* ut_id is defined as a char ut_id[4]. When it's not zero, it's + * used as the unique identifier for getutxid (used below), when + * ut_id is zero, ut_line is used as the identifier instead. + * + * d->name can be hosname:display :display or ip:display. + * Since storing the first bytes may create collissions, we choose to + * leave ut_id as zero and use ut_line as the main identifier. + */ gdm_debug ("utmp-wtmp: Using id %*s", (int) sizeof (record.ut_id), record.ut_id); @@ -4363,7 +4370,6 @@ if (host) { strncpy (record.ut_host, host, sizeof (record.ut_host)); - g_free (host); gdm_debug ("utmp-wtmp: Using hostname %*s", (int) sizeof (record.ut_host), @@ -4372,6 +4378,28 @@ #ifdef HAVE_UT_SYSLEN record.ut_syslen = MIN (strlen (host), sizeof (record.ut_host)); #endif + /* If it hasn't been set yet, set ut_line to the host:display */ + if (device_name == NULL) { + size_t len_host = strlen(host); + strncpy (record.ut_line, host, sizeof (record.ut_line)); + + /* If the hostname was too long put the display at the end */ + if ( (len_host+1) > sizeof(record.ut_line) ) { + size_t len_display = 0; + char *sep = strrchr(host,':'); + len_display = strlen(sep); + + if ( sep && ( len_display+1 < sizeof (record.ut_line) ) ) { + strncpy(record.ut_line + sizeof (record.ut_line) - (len_display+1), + sep, len_display+1 ); + } else { + /* if no display was found (or display was too long), + * make sure it's a string */ + record.ut_line[sizeof (record.ut_line) - 1] = '\0'; + } + } + } + g_free (host); } #endif