Call for testing for coming 2.9 release.

Wayne Davison wayne at blorf.net
Thu Apr 26 02:46:55 EST 2001


On Wed, 25 Apr 2001, Damien Miller wrote:
> [...] you can grab snapshots from:
>
> http://www.mindrot.org/~djm/openssh-snap/
>
> directly.

Thanks for the pointer.  I grabbed the April 25th snapshot, and these
are the changes I needed to make Solaris work with UseLogin enabled.

..wayne..
-------------- next part --------------
Index: acconfig.h
--- openssh-20010424bal/acconfig.h	Tue Apr 24 12:38:51 2001
+++ ./acconfig.h	Tue Apr 24 18:27:48 2001
@@ -169,6 +169,12 @@
 /* Define if you want to specify the path to your wtmpx file */
 #undef CONF_WTMPX_FILE
 
+/* Some systems need a utmpx entry for /bin/login to work */
+#undef LOGIN_NEEDS_UTMPX
+
+/* Some versions of /bin/login need the TERM supplied on the commandline */
+#undef LOGIN_NEEDS_TERM
+
 /* Define is libutil has login() function */
 #undef HAVE_LIBUTIL_LOGIN
 
Index: configure.in
--- openssh-20010424bal/configure.in	Tue Apr 24 12:38:51 2001
+++ ./configure.in	Tue Apr 24 18:27:48 2001
@@ -152,6 +152,8 @@
 	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
 	LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" 
 	need_dash_r=1
+	AC_DEFINE(LOGIN_NEEDS_UTMPX)
+	AC_DEFINE(LOGIN_NEEDS_TERM)
 	AC_DEFINE(PAM_SUN_CODEBASE)
 	# hardwire lastlog location (can't detect it on some versions)
 	conf_lastlog_location="/var/adm/lastlog"
Index: session.c
--- openssh-20010424bal/session.c	Tue Apr 24 12:38:51 2001
+++ ./session.c	Tue Apr 24 18:27:48 2001
@@ -126,6 +126,7 @@
 void	session_proctitle(Session *s);
 void	do_exec_pty(Session *s, const char *command);
 void	do_exec_no_pty(Session *s, const char *command);
+void	call_record_login(Session *s);
 void	do_login(Session *s, const char *command);
 void	do_child(Session *s, const char *command);
 void	do_motd(void);
@@ -644,6 +645,10 @@
 #ifndef HAVE_OSF_SIA
 		if (!(options.use_login && command == NULL))
 			do_login(s, command);
+# ifdef LOGIN_NEEDS_UTMPX
+		else
+			call_record_login(s);
+# endif
 #endif
 
 		/* Do common processing for the child, such as execing the command. */
@@ -687,15 +692,11 @@
 	}
 }
 
-/* administrative, login(1)-like work */
 void
-do_login(Session *s, const char *command)
+call_record_login(Session *s)
 {
-	char *time_string;
-	char hostname[MAXHOSTNAMELEN];
 	socklen_t fromlen;
 	struct sockaddr_storage from;
-	time_t last_login_time;
 	struct passwd * pw = s->pw;
 	pid_t pid = getpid();
 
@@ -713,6 +714,23 @@
 		}
 	}
 
+	/* Record that there was a login on that tty from the remote host. */
+	record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
+	    get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
+	    (struct sockaddr *)&from);
+}
+
+/* administrative, login(1)-like work */
+void
+do_login(Session *s, const char *command)
+{
+	char *time_string;
+	char hostname[MAXHOSTNAMELEN];
+	time_t last_login_time;
+	struct passwd * pw = s->pw;
+
+	call_record_login(s);
+
 	/* Get the time and hostname when the user last logged in. */
 	if (options.print_lastlog) {
 		hostname[0] = '\0';
@@ -720,11 +738,6 @@
 		    hostname, sizeof(hostname));
 	}
 
-	/* Record that there was a login on that tty from the remote host. */
-	record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
-	    get_remote_name_or_ip(utmp_len, options.reverse_mapping_check),
-	    (struct sockaddr *)&from);
-
 #ifdef USE_PAM
 	/*
 	 * If password change is needed, do it now.
@@ -1511,6 +1524,9 @@
 			/* Launch login(1). */
 
 			execl(LOGIN_PROGRAM, "login", "-h", hostname,
+#ifdef LOGIN_NEEDS_TERM
+			     s->term? s->term : "unknown",
+#endif
 			     "-p", "-f", "--", pw->pw_name, NULL);
 
 			/* Login couldn't be executed, die. */


More information about the openssh-unix-dev mailing list