components/openssh/patches/003-last_login.patch
changeset 1612 3f2ec017627f
child 2070 be6c6d4f183f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/openssh/patches/003-last_login.patch	Fri Dec 20 12:17:34 2013 -0800
@@ -0,0 +1,90 @@
+#
+# We changed the OpenSSH to not record the last login time when the "UsePAM"
+# option is on, because the PAM session module in Solaris will record the last
+# login time.  This is for Solaris only, so we will not contribute back this
+# change to the upstream community.
+#
+*** orig/sshd.c	Thu Oct  4 16:08:28 2012
+--- new/sshd.c	Thu Oct  4 16:06:05 2012
+***************
+*** 128,133 ****
+--- 128,137 ----
+  int deny_severity;
+  #endif /* LIBWRAP */
+  
++ #if defined(LASTLOG_FIX) && defined(USE_PAM)
++ #include "sshlogin.h"
++ #endif
++ 
+  #ifndef O_NOCTTY
+  #define O_NOCTTY	0
+  #endif
+***************
+*** 2028,2033 ****
+--- 2032,2041 ----
+  #endif
+  #ifdef USE_PAM
+  	if (options.use_pam) {
++ #ifdef LASTLOG_FIX
++ 		store_lastlog_message(authctxt->pw->pw_name,
++ 		    authctxt->pw->pw_uid);
++ #endif
+  		do_pam_setcred(1);
+  		do_pam_session();
+  	}
+*** orig/sshlogin.h	Thu Oct  4 16:08:54 2012
+--- new/sshlogin.h	Thu Oct  4 16:06:31 2012
+***************
+*** 14,19 ****
+--- 14,22 ----
+  
+  void	record_login(pid_t, const char *, const char *, uid_t,
+      const char *, struct sockaddr *, socklen_t);
++ #ifdef LASTLOG_FIX
++ void store_lastlog_message(const char *, uid_t);
++ #endif
+  void   record_logout(pid_t, const char *, const char *);
+  time_t	get_last_login_time(uid_t, const char *, char *, u_int);
+  
+*** orig/sshlogin.c	Thu Oct  4 16:08:42 2012
+--- new/sshlogin.c	Thu Oct  4 16:35:27 2012
+***************
+*** 83,89 ****
+--- 83,93 ----
+   * Generate and store last login message.  This must be done before
+   * login_login() is called and lastlog is updated.
+   */
++ #ifndef LASTLOG_FIX
+  static void
++ #else
++ void
++ #endif
+  store_lastlog_message(const char *user, uid_t uid)
+  {
+  #ifndef NO_SSH_LASTLOG
+***************
+*** 128,133 ****
+--- 132,141 ----
+  {
+  	struct logininfo *li;
+  
++ #ifdef LASTLOG_FIX
++ 	/* In Solaris, PAM takes care of last login tracking */
++         if (!options.use_pam) {
++ #endif
+  	/* save previous login details before writing new */
+  	store_lastlog_message(user, uid);
+  
+***************
+*** 135,140 ****
+--- 143,152 ----
+  	login_set_addr(li, addr, addrlen);
+  	login_login(li);
+  	login_free_entry(li);
++ 
++ #ifdef LASTLOG_FIX
++ 	}
++ #endif
+  }
+  
+  #ifdef LOGIN_NEEDS_UTMPX