usr/src/cmd/bash/Patches-4.0/disable-function-imports
branchoi_151a
changeset 254 9c2a4ac793f0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/bash/Patches-4.0/disable-function-imports	Mon May 04 14:04:39 2015 +0100
@@ -0,0 +1,38 @@
+--- shell.c.orig	2009-01-04 19:32:41.000000000 +0000
++++ shell.c	2014-10-07 21:32:58.976889335 +0100
+@@ -225,7 +225,7 @@
+ #else
+ int posixly_correct = 0;	/* Non-zero means posix.2 superset. */
+ #endif
+-
++int import_functions = 0;       /* Import functions from environment */
+ 
+ /* Some long-winded argument names.  These are obviously new. */
+ #define Int 1
+@@ -245,6 +245,7 @@
+   { "help", Int, &want_initial_help, (char **)0x0 },
+   { "init-file", Charp, (int *)0x0, &bashrc_file },
+   { "login", Int, &make_login_shell, (char **)0x0 },
++  { "import-functions", Int, &import_functions, (char **)0x0 },
+   { "noediting", Int, &no_line_editing, (char **)0x0 },
+   { "noprofile", Int, &no_profile, (char **)0x0 },
+   { "norc", Int, &no_rc, (char **)0x0 },
+--- variables.c.orig	2014-10-07 23:39:11.759973975 +0100
++++ variables.c	2014-10-08 12:29:14.858891509 +0100
+@@ -102,6 +102,7 @@
+ extern time_t shell_start_time;
+ extern int assigning_in_environment;
+ extern int executing_builtin;
++extern int import_functions;
+ 
+ #if defined (READLINE)
+ extern int no_line_editing;
+@@ -339,7 +340,7 @@
+ 
+       /* If exported function, define it now.  Don't import functions from
+ 	 the environment in privileged mode. */
+-      if (privmode == 0 && read_but_dont_execute == 0 &&
++      if (import_functions && privmode == 0 && read_but_dont_execute == 0 &&
+ 	  STREQN (BASHFUNC_PREFIX, name, BASHFUNC_PREFLEN) &&
+ 	  STREQ (BASHFUNC_SUFFIX, name + char_index - BASHFUNC_SUFFLEN) &&
+ 	  STREQN ("() {", string, 4))