usr/src/cmd/bash/Patches-4.0/disable-function-imports
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
permissions -rw-r--r--
Bash patch catchup including shellshock
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
254
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     1
--- shell.c.orig	2009-01-04 19:32:41.000000000 +0000
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     2
+++ shell.c	2014-10-07 21:32:58.976889335 +0100
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     3
@@ -225,7 +225,7 @@
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     4
 #else
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     5
 int posixly_correct = 0;	/* Non-zero means posix.2 superset. */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     6
 #endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     7
-
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     8
+int import_functions = 0;       /* Import functions from environment */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     9
 
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    10
 /* Some long-winded argument names.  These are obviously new. */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    11
 #define Int 1
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    12
@@ -245,6 +245,7 @@
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    13
   { "help", Int, &want_initial_help, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    14
   { "init-file", Charp, (int *)0x0, &bashrc_file },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    15
   { "login", Int, &make_login_shell, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    16
+  { "import-functions", Int, &import_functions, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    17
   { "noediting", Int, &no_line_editing, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    18
   { "noprofile", Int, &no_profile, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    19
   { "norc", Int, &no_rc, (char **)0x0 },
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    20
--- variables.c.orig	2014-10-07 23:39:11.759973975 +0100
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    21
+++ variables.c	2014-10-08 12:29:14.858891509 +0100
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    22
@@ -102,6 +102,7 @@
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    23
 extern time_t shell_start_time;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    24
 extern int assigning_in_environment;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    25
 extern int executing_builtin;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    26
+extern int import_functions;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    27
 
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    28
 #if defined (READLINE)
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    29
 extern int no_line_editing;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    30
@@ -339,7 +340,7 @@
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    31
 
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    32
       /* If exported function, define it now.  Don't import functions from
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    33
 	 the environment in privileged mode. */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    34
-      if (privmode == 0 && read_but_dont_execute == 0 &&
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    35
+      if (import_functions && privmode == 0 && read_but_dont_execute == 0 &&
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    36
 	  STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) &&
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    37
 	  STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) &&
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    38
 	  STREQN ("() {", string, 4))