1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Mon, 4 Jun 2012 01:37:48 +0000
Subject: 523_su_arguments_are_no_more_concatenated_by_default
This patch needs the su_arguments_are_concatenated patch.
This patch, and su_arguments_are_concatenated should be dropped after
Etch.
Status wrt upstream: This patch is Debian specific.
---
src/su.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
Index: b/src/su.c
===================================================================
--- a/src/su.c 2013-07-27 19:33:26.382799481 +0400
+++ b/src/su.c 2013-07-27 19:33:28.454184918 +0400
@@ -104,6 +104,19 @@
/* If nonzero, change some environment vars to indicate the user su'd to. */
static bool change_environment = true;
+/*
+ * If nonzero, keep the old Debian behavior:
+ * * concatenate all the arguments and provide them to the -c option of
+ * the shell
+ * * If there are some additional arguments, but no -c, add a -c
+ * argument anyway
+ * Drawbacks:
+ * * you can't provide options to the shell (other than -c)
+ * * you can't rely on the argument count
+ * See http://bugs.debian.org/276419
+ */
+static int old_debian_behavior;
+
#ifdef USE_PAM
static pam_handle_t *pamh = NULL;
static int caught = 0;
@@ -950,6 +963,8 @@
int ret;
#endif /* USE_PAM */
+ old_debian_behavior = (getenv("SU_NO_SHELL_ARGS") != NULL);
+
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
@@ -1157,7 +1172,7 @@
* resulting string is always given to the shell with its
* -c option.
*/
- {
+ if (old_debian_behavior) {
char **parg;
unsigned int cmd_len = 0;
char *cmd = NULL;
|