coreutils/coreutils-split-pam.patch

58 lines
2.3 KiB
Diff

diff -uNrp -x '*~' coreutils-5.97-orig/src/su.c coreutils-5.97/src/su.c
--- coreutils-5.97-orig/src/su.c 2006-07-13 12:14:40.000000000 +0100
+++ coreutils-5.97/src/su.c 2006-07-13 12:24:33.000000000 +0100
@@ -131,11 +131,15 @@
#include "error.h"
-/* The official name of this program (e.g., no `g' prefix). */
+/* The official name of this program (e.g., no `g' prefix).
+ * - Add a "-l" to the name passed to PAM if this is a login simulation
+ */
#ifndef RUNUSER
#define PROGRAM_NAME "su"
+#define PROGRAM_NAME_L "su-l"
#else
#define PROGRAM_NAME "runuser"
+#define PROGRAM_NAME_L "runuser-l"
#endif
#ifndef AUTHORS
@@ -310,7 +314,8 @@ correct_password (const struct passwd *p
#ifdef USE_PAM
struct passwd *caller;
char *tty_name, *ttyn;
- retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
+ retval = pam_start(simulate_login ? PROGRAM_NAME_L : PROGRAM_NAME,
+ pw->pw_name, &conv, &pamh);
PAM_BAIL_P;
#ifndef RUNUSER
diff -urp coreutils-6.10-orig/doc/coreutils.info coreutils-6.10/doc/coreutils.info
--- coreutils-6.10-orig/doc/coreutils.info 2008-01-22 00:32:44.000000000 +0100
+++ coreutils-6.10/doc/coreutils.info 2008-01-24 17:17:04.000000000 +0100
@@ -11006,7 +11006,8 @@ options::.
set, even for the super-user, as described above), and set `PATH'
to a compiled-in default value. Change to USER's home directory.
Prepend `-' to the shell's name, intended to make it read its
- login startup file(s).
+ login startup file(s). When this option is given, /etc/pam.d/su-l
+ PAM file is used instead of the default one.
`-m'
`-p'
diff -urp coreutils-6.10-orig/doc/coreutils.texi coreutils-6.10/doc/coreutils.texi
--- coreutils-6.10-orig/doc/coreutils.texi 2008-01-24 16:50:57.000000000 +0100
+++ coreutils-6.10/doc/coreutils.texi 2008-01-24 17:12:58.000000000 +0100
@@ -13670,7 +13670,9 @@ the exit status of @var{command} otherwi
@command{su} allows one user to temporarily become another user. It runs a
command (often an interactive shell) with the real and effective user
-ID, group ID, and supplemental groups of a given @var{user}. Synopsis:
+ID, group ID, and supplemental groups of a given @var{user}. When the -l
+option is given, the su-l PAM file is used instead of the default su PAM file.
+Synopsis:
@example
su [@var{option}]@dots{} [@var{user} [@var{arg}]@dots{}]