Subject: bin/30915: sshd via inetd and changing logname
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 08/04/2005 22:24:01
>Number:         30915
>Category:       bin
>Synopsis:       sshd via inetd and changing logname
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 04 22:24:00 +0000 2005
>Originator:     reed@reedmedia.net
>Release:        NetBSD 2.0.2
>Organization:
http://bsd.reedmedia.net/
>Environment:
	
	
System: NetBSD rainier.reedmedia.net 2.0.2 NetBSD 2.0.2 (GENERIC) #0: Wed Mar 23 08:53:42 UTC 2005 jmc@faith.netbsd.org:/home/builds/ab/netbsd-2-0-2-RELEASE/i386/200503220140Z-obj/home/builds/ab/netbsd-2-0-2-RELEASE/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
My sshd is started from inetd:
ssh             stream  tcp     nowait  root    /usr/sbin/sshd sshd -i

dmesg reports like:

  sshd (pid 9703) changing logname from reed to reedmedia

And then I log in to pstech and I get another entry:

  sshd (pid 755) changing logname from reedmedia to pstech

I login two more times to pstech, but no more logs.

Then I login into a different account and dmesg has another log:

  sshd (pid 25573) changing logname from pstech to bsdnews

USER PID PPID PGID   SESS JOBC STAT TT    TIME COMMAND
root 439    1  439 c22440    0 IWs  ?? 0:18.62 /usr/sbin/inetd -l

USER  PID PPID PGID   SESS JOBC STAT TT    TIME COMMAND
root 4402  439  439 c22440    0 IW   ?? 0:01.30 sshd: bsdnews [priv

USER      PID PPID PGID   SESS JOBC STAT TT    TIME COMMAND
bsdnews 25573 4402  439 c22440    0 IW   ?? 0:00.02 sshd: bsdnews@ttyp6

I see the code is from src/sys/kern/kern_prot.c (but maybe problem
is in sshd). I posted to netbsd-help: "How does the sshd process
know about the previous login name associated with different
process?"

christos asked me to file a PR: "It does not do the necessary work
to deal with process groups I think when started from inetd."

>How-To-Repeat:
Use inetd to serve sshd. Connect via ssh to different accounts.
>Fix:
	

>Unformatted: