9bfad79
diff -uNrp -x '*~' coreutils-5.97-orig/src/su.c coreutils-5.97/src/su.c
9bfad79
--- coreutils-5.97-orig/src/su.c	2006-07-13 12:14:40.000000000 +0100
9bfad79
+++ coreutils-5.97/src/su.c	2006-07-13 12:24:33.000000000 +0100
9bfad79
@@ -131,11 +131,15 @@
9bfad79
 
9bfad79
 #include "error.h"
9bfad79
 
9bfad79
-/* The official name of this program (e.g., no `g' prefix).  */
9bfad79
+/* The official name of this program (e.g., no `g' prefix).
9bfad79
+ * - Add a "-l" to the name passed to PAM if this is a login simulation
9bfad79
+ */
9bfad79
 #ifndef RUNUSER
9bfad79
 #define PROGRAM_NAME "su"
9bfad79
+#define PROGRAM_NAME_L "su-l"
9bfad79
 #else
9bfad79
 #define PROGRAM_NAME "runuser"
9bfad79
+#define PROGRAM_NAME_L "runuser-l"
9bfad79
 #endif
9bfad79
 
9bfad79
 #ifndef AUTHORS
9bfad79
@@ -310,7 +314,8 @@ correct_password (const struct passwd *p
9bfad79
 #ifdef USE_PAM
9bfad79
   struct passwd *caller;
9bfad79
   char *tty_name, *ttyn;
9bfad79
-  retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
9bfad79
+  retval = pam_start(simulate_login ? PROGRAM_NAME_L : PROGRAM_NAME,
9bfad79
+		     pw->pw_name, &conv, &pamh);
9bfad79
   PAM_BAIL_P;
9bfad79
 
9bfad79
 #ifndef RUNUSER