Subject: Bug#70084: xterm: user `jsroot'(uid=0) entered into utmp as user `root'

From: Jeff Sheinberg <[email-masked]>
Date: Sun, 27 Aug 2000 14:25:11 -0400 (EDT)

Package: xterm
Version: 3.3.6-10
Severity: normal

Hi,

On my system there are three unique users with userid=0, they are
`root', `sashroot', and `jsroot'.  While logged in on an xterm as
user `jsroot' on `pts/2', I started another xterm which was then
allocated `pts/3' for its use.

The following typescript from `pts/3' shows that its utmp entry
was made for user `root', rather than for user `jsroot'.  In
addition, its environment variable LOGNAME was set to `root' while
USER was set to `jsroot'.

    0=bash, 1=.sh_env, EUID=0, PWD=~jsroot, SHELL=/bin/bash, SHLVL=2
    .sh_env:  *warning*  LOGNAME=root and USER=jsroot
    .sh_env: now setting LOGNAME=jsroot

    1 jsroot ~ # dump-utmp /var/run/utmp | sed 's/  //g'
    ||8|si|6| ||Sun Aug 27 10:09:38 2000
    reboot|~ |2|~~|0| ||Sun Aug 27 10:09:38 2000
    runlevel|~ |1|~~|20018| ||Sun Aug 27 10:09:38 2000
    ||8|l2|254| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty1|6|1 |417| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty2|6|2 |418| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty3|6|3 |419| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty4|6|4 |420| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty5|6|5 |421| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty6|6|6 |422| ||Sun Aug 27 10:09:45 2000
    LOGIN |tty9|6|9 |423| ||Sun Aug 27 10:09:45 2000
    jeff|:0|7|:0|11823|248.252.255.191|console |Sun Aug 27 10:16:45
2000
    jeff|pts/0 |7|/0|11889| |:0.0|Sun Aug 27 10:16:47 2000
    jeff|pts/1 |7|/1|11890| |:0.0|Sun Aug 27 10:16:47 2000
    jsroot|pts/2 |7|/2|11959| |:0.0|Sun Aug 27 10:17:09 2000
    root|pts/3 |7|/3|15235| |:0.0|Sun Aug 27 13:38:02 2000

    2 jsroot ~ # who
    jeff     :0       Aug 27 10:16 (console)
    jeff     pts/0    Aug 27 10:16 (:0.0)
    jeff     pts/1    Aug 27 10:16 (:0.0)
    jsroot   pts/2    Aug 27 10:17 (:0.0)
    root     pts/3    Aug 27 13:38 (:0.0)

    3 jsroot ~ # who am i
    eden-hda7.my.local!root     pts/3    Aug 27 13:38 (:0.0)

Just in case you are wondering exactly how to duplicate this, here
is how.

    I initially logged in via xdm as user `jeff', then I started
    an xterm on `pts/2', then I executed `exec login jsroot',
    which updated utmp for `pts/2' as user `jsroot'.  Then I
    executed `xterm' from `jsroot' on `pts/2', which started on
    `pts/3', from which I copied the above typescript.

Also, I get the same reported behavior from xterm when I just
login as user `jsroot' via xdm.

Note that I get the same behavior from xterm regardless of whether
its `loginShell' resource is true or false.

Thanks,
-- 
Jeff Sheinberg  <[email-masked]>

-- System Information
Debian Release: 2.2
Kernel Version: Linux eden-hda7.my.local 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i586 unknown

Versions of the packages xterm depends on:
ii  libc6          2.1.3-10       GNU C Library: Shared libraries and Timezone
ii  libncurses5    5.0-6          Shared libraries for terminal handling
ii  xlib6g         3.3.6-10       shared libraries required by X clients

--- Begin /etc/X11/Xresources/xterm (modified conffile)
! /etc/X11/Xresources/xterm
! Uncomment the following lines to make xterm appear much like a virtual
! console, so that ANSI colors will make more sense.
! XTerm*background: black
! XTerm*foreground: gray90
! DEC VT series terminal emulators (like xterm) must generate VT220-compliant
! sequences for the backspace and delete keys per the Debian Policy Manual;
! this provides compatibility with the Linux console.  Also, work around an
! apparent bug in the default translations for the home and end keys in
! xterm.  Note that this resource specification affects all programs with a
! "vt100" widget in their resource class hierarchy, and that these
! translation overrides do not apply if one of the listed modifier keys is
! pressed (e.g., what shift-backspace does depends on the program in question).
! Note - These resources are also loaded from the ~/.Xresources file,
!        therefore, all upstream changes need to be copied from this
!        file /etc/X11/Xresources/xterm into your ~/.Xresources file.
*VT100.Translations: #override ~Shift ~Ctrl ~Meta <Key>BackSpace: string("\177")\n\
                               ~Shift ~Ctrl ~Meta <Key>Delete: string("\033[3~")\n\
                               ~Shift ~Ctrl ~Meta <Key>Home: string("\033[1~")\n\
                               ~Shift ~Ctrl ~Meta <Key>End: string("\033[4~")
! /etc/X11/Xresources/xterm - end of file.

--- End /etc/X11/Xresources/xterm