[Pkg-shadow-devel] patch for login - 1

Nicolas François nicolas.francois@centraliens.net
Tue, 31 May 2005 21:22:42 +0200


--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello Tomasz,

The big Debian patch is now sorted out in smaller patches. I will now
start submitting them to you (I will start with the simplest).


Here is the first one.

When PAM is used, the username is in pam_user, not username.
This fix the log of successful logins (LOG_OK_LOGINS).

More info at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=47819

Kind Regards,
-- 
Nekral

--envbJBWh7q8WU6mo
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=008_login_log_pam_user_if_USE_PAM

Goal: fixed loggin of username on succesful login (was using
      the normal username, when it should have used pam_user)
Fixes: #47819
Status wrt upstream: It should be forwarded to upstream.
Index: shadow-4.0.3/src/login.c
===================================================================
--- shadow-4.0.3.orig/src/login.c	2005-05-28 22:21:25.134189000 +0200
+++ shadow-4.0.3/src/login.c	2005-05-28 22:21:29.434189000 +0200
@@ -1421,7 +1421,11 @@
 	if (pwent.pw_uid == 0)
 		SYSLOG ((LOG_NOTICE, "ROOT LOGIN %s", fromhost));
 	else if (getdef_bool ("LOG_OK_LOGINS"))
+#ifdef USE_PAM
+		SYSLOG ((LOG_INFO, "`%s' logged in %s", pam_user, fromhost));
+#else
 		SYSLOG ((LOG_INFO, "`%s' logged in %s", username, fromhost));
+#endif
 	closelog ();
 #ifdef RADIUS
 	if (is_rad_login) {

--envbJBWh7q8WU6mo--