UseLogin yes and 'w': IP address used

Damien Miller djm at mindrot.org
Wed Aug 9 10:12:13 EST 2000


On Tue, 8 Aug 2000, Pekka Savola wrote:

> > The problem is most likely with login. OpenSSH tries to fill out 
> > all fields in utmp, and will store both remote hostname and IP address
> > if your struct utmp supports them (RH does).
> 
> The same thing happens with login in FreeBSD-4.1 -STABLE.  I doubt it's
> login (at least mostly).
> 
> There are actually two problems here, I think.  'w' showing the IP address
> and logins getting double recorded.
 
The 'w' issue looks deliberate - OpenSSH passes the IP address to login(1)
presumably because hostnames are lest trustworthy than addresses.

The double recording issue is a bug in OpenSSH. Does the below fix help?

Index: session.c
===================================================================
RCS file: /var/cvs/openssh/session.c,v
retrieving revision 1.28
diff -u -r1.28 session.c
--- session.c	2000/07/11 23:45:27	1.28
+++ session.c	2000/08/08 23:25:03
@@ -591,8 +591,9 @@
 			}
 		}
 		/* Record that there was a login on that terminal. */
-		record_login(pid, s->tty, pw->pw_name, pw->pw_uid, hostname,
-			     (struct sockaddr *)&from);
+		if (!options.use_login || command != NULL)
+			record_login(pid, s->tty, pw->pw_name, pw->pw_uid, 
+			    hostname, (struct sockaddr *)&from);
 
 		/* Check if .hushlogin exists. */
 		snprintf(line, sizeof line, "%.200s/.hushlogin", pw->pw_dir);


-- 
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)









More information about the openssh-unix-dev mailing list