Package: gdm Version: 2.20.11-2 Severity: normal As reported in lenny's version, gdm tries to manage the utmp record setting the id of the record to be the first part of display name, the id is defined to be 4 bytes long, and the display name for xdmcp clients is of the form ip:display_number, so, xdmcp users in the same /8 network end up overwriting the other user utmp record.
On the other hand, if the id is a sequence of '\0', the id field is not used as a unique identifier, but the "line" field is. Since the line field is long enough to hold a ip:display_number, the attached patch uses this idea to avoid the collisions. -- System Information: Debian Release: squeeze/sid APT prefers testing-proposed-updates APT policy: (500, 'testing-proposed-updates'), (500, 'proposed-updates'), (500, 'testing'), (500, 'stable') Architecture: i386 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores) Locale: LANG=es_AR.UTF-8, LC_CTYPE=es_AR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages gdm depends on: ii adduser 3.112 add and remove users and groups ii aterm [x-termina 1.0.1-7+b1 Afterstep XVT - a VT102 emulator f ii debconf [debconf 1.5.35 Debian configuration management sy ii gksu 2.0.2-3 graphical frontend to su ii gnome-session [x 2.30.2-1 The GNOME Session Manager - GNOME ii gnome-terminal [ 2.30.2-1 The GNOME terminal emulator applic ii konsole [x-termi 4:4.4.5-1 X terminal emulator ii ksmserver [x-ses 4:3.5.9.dfsg.1-6+lenny1 session manager for KDE ii kwin [x-window-m 4:3.5.9.dfsg.1-6+lenny1 the KDE window manager ii libart-2.0-2 2.3.21-1 Library of functions for 2D graphi ii libatk1.0-0 1.30.0-1 The ATK accessibility toolkit ii libattr1 1:2.4.44-2 Extended attribute shared library ii libc6 2.11.2-6 Embedded GNU C Library: Shared lib ii libcairo2 1.8.10-6 The Cairo 2D vector graphics libra ii libdbus-1-3 1.2.24-3 simple interprocess messaging syst ii libdbus-glib-1-2 0.88-2 simple interprocess messaging syst ii libdmx1 1:1.1.0-2 X11 Distributed Multihead extensio ii libfontconfig1 2.8.0-2.1 generic font configuration library ii libfreetype6 2.4.2-1 FreeType 2 font engine, shared lib ii libglade2-0 1:2.6.4-1 library to load .glade files at ru ii libglib2.0-0 2.24.2-1 The GLib library of C routines ii libgnomecanvas2- 2.30.1-1 A powerful object-oriented display ii libgtk2.0-0 2.20.1-1+b1 The GTK+ graphical user interface ii libpam-modules 1.1.1-6 Pluggable Authentication Modules f ii libpam-runtime 1.1.1-6 Runtime support for the PAM librar ii libpam0g 1.1.1-6 Pluggable Authentication Modules l ii libpango1.0-0 1.28.1-1 Layout and rendering of internatio ii librsvg2-2 2.26.3-1 SAX-based renderer library for SVG ii librsvg2-common 2.26.3-1 SAX-based renderer library for SVG ii libselinux1 2.0.96-1 SELinux runtime shared libraries ii libwrap0 7.6.q-19 Wietse Venema's TCP wrappers libra ii libx11-6 2:1.3.3-3 X11 client-side library ii libxau6 1:1.0.6-1 X11 authorisation library ii libxdmcp6 1:1.0.3-2 X11 Display Manager Control Protoc ii libxext6 2:1.1.2-1 X11 miscellaneous extension librar ii libxi6 2:1.3-4 X11 Input extension library ii libxinerama1 2:1.1-3 X11 Xinerama extension library ii libxml2 2.7.7.dfsg-4 GNOME XML library ii lsb-base 3.2-23.1 Linux Standard Base 3.2 init scrip ii metacity [x-wind 1:2.30.1-2 lightweight GTK+ window manager ii openbox [x-windo 3.4.11.1-1 standards compliant, fast, light-w ii rxvt-unicode [x- 9.07-2+b1 RXVT-like terminal emulator with U ii twm [x-window-ma 1:1.0.4-2 Tab window manager ii xfce4-session [x 4.6.2-1 Xfce4 Session Manager ii xfce4-terminal [ 0.4.5-1 Xfce terminal emulator ii xfwm4 [x-window- 4.6.2-1 window manager of the Xfce project ii xterm [x-termina 261-1 X terminal emulator Versions of packages gdm recommends: ii dialog 1.1-20100428-1 Displays user-friendly dialog boxe ii gdm-themes 0.6.2 Themes for the GNOME Display Manag ii whiptail 0.52.11-1 Displays user-friendly dialog boxe ii xnest 2:1.7.7-6 Nested X server ii xserver-xephyr 2:1.7.7-6 nested X server ii xserver-xorg 1:7.5+7 the X.Org X server ii zenity 2.30.0-1 Display graphical dialog boxes fro Versions of packages gdm suggests: ii libpam-gnome-keyring 2.30.3-1 PAM module to unlock the GNOME key ii locales 2.11.2-6 Embedded GNU C Library: National L ii pm-utils 1.3.0-2 utilities and scripts for power ma -- Configuration Files: /etc/gdm/gdm.conf changed [not included] /etc/pam.d/gdm changed [not included] -- debconf information excluded
Index: gdm-2.20.11/daemon/slave.c =================================================================== --- gdm-2.20.11.orig/daemon/slave.c 2010-10-14 12:19:21.000000000 -0300 +++ gdm-2.20.11/daemon/slave.c 2010-10-14 12:20:24.000000000 -0300 @@ -4343,11 +4343,18 @@ #endif #if defined(HAVE_UT_UT_ID) - strncpy (record.ut_id, d->name, sizeof (record.ut_id)); + /* Don't, leave it as '\0', so ut_line is used as the id instead + * strncpy (record.ut_id, d->name, sizeof (record.ut_id)); */ gdm_debug ("utmp-wtmp: Using id %*s", (int) sizeof (record.ut_id), record.ut_id); #endif + host = NULL; + if (! d->attached && g_str_has_prefix (d->name, ":")) { + host = g_strdup_printf ("%s%s", d->hostname, d->name); + } else { + host = g_strdup (d->name); + } if (device_name != NULL) { g_assert (g_str_has_prefix (device_name, "/dev/")); @@ -4355,6 +4362,27 @@ sizeof (record.ut_line)); g_free (device_name); device_name = NULL; + } else { + if ( host != NULL ) { + strncpy (record.ut_line, host, sizeof (record.ut_line)); + + /* If the hostname was too long put the display at the end */ + if ( strlen(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'; + } + } + } } gdm_debug ("utmp-wtmp: Using line %*s", @@ -4362,18 +4390,8 @@ record.ut_line); #if defined(HAVE_UT_UT_HOST) - host = NULL; - if (! d->attached && g_str_has_prefix (d->name, ":")) { - host = g_strdup_printf ("%s%s", - d->hostname, - d->name); - } else { - host = g_strdup (d->name); - } - 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), @@ -4384,6 +4402,7 @@ #endif } #endif + if (host) g_free(host); switch (record_type) { @@ -4439,7 +4458,7 @@ setutxent (); while ((u = getutxent ()) != NULL && - (u = getutxid (&record)) != NULL) { + (u = getutxline (&record)) != NULL) { gdm_debug ("Removing utmp record"); if (u->ut_pid == pid &&