Problem with utmp on IRIX

Iain Morgan imorgan at nas.nasa.gov
Fri Mar 15 06:51:05 EST 2002


Hello all,

It looks like there is a problem with how OpenSSH writes the id field in
utmp and utmpx on IRIX. OpenSSH and IRIX use somewhat differnt conventions
for the id field and this seems to create a problem under some
circumstances.

Under some (as yet undetermined) circumstances IRIX leaves a DEAD_PROCESS
record that still has a username and pid associated with it. When this
happens, cuserid() and getlogin() can get fooled into using the old 
record rather than the record writtne by sshd.

I wrote a small program to extract some of the information from the
utmpx file and have included some output her to help illustrate the
issue.

octane30.root./tmp: 51> /bin/tty
/dev/ttyq3
octane30.root./tmp: 52> ./utxent | grep ttyq3
onufer:ttyq3:q3:8:1006:1896751
root:ttyq3:tyq3:7:0:1955158
octane30.root./tmp: 53> ps -fp 1896751
     UID        PID       PPID  C    STIME TTY     TIME CMD
octane30.root./tmp: 54> who am i
onufer     ttyq3        Mar 13 13:34
octane30.root./tmp: 55> whoami
root
octane30.root./tmp: 56> 

I made a very minor alteration to loginrec.c which seems to have
eliminated the issue on the systems that I have tested it on.

diff -u src/loginrec.c irix6.5/loginrec.c
--- src/loginrec.c      Mon Oct 29 18:50:40 2001
+++ irix6.5/loginrec.c  Wed Mar  6 11:33:40 2002
@@ -564,6 +564,10 @@
        if (strncmp(src, "/dev/", 5) == 0)
                src += 5;
 
+       /* Make the ut_id field consistent with IRIX */
+       if (strncmp(src, "tty", 3) == 0)
+               src += 3;
+
        len = strlen(src);
 
        if (len > 0) {


--
Iain Morgan
NAS Desktop Support Group




More information about the openssh-unix-dev mailing list