usr/src/cmd/bash/Patches-4.0/bash40-029
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
			     BASH PATCH REPORT
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     2
			     =================
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     3
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     4
Bash-Release: 4.0
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     5
Patch-ID: bash40-029
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     6
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     7
Bug-Reported-by:	Christian Krause <[email protected]>
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     8
Bug-Reference-ID:	Thu, 25 Jun 2009 21:47:59 +0200
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
     9
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2009-06/msg00078.html
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    10
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    11
Bug-Description:
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    12
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    13
Previous versions of bash accepted strings in the initial environment
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    14
that were not valid shell variable assignments, usually because the
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    15
names were invalid, but still created shell variables from them and
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    16
passed them to child processes in the environment.
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    17
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    18
Bash-4.0 ignores those names and does not pass them to child processes.
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    19
Some users and automated processes depend on invalid variables being
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    20
ignored and passed to child processes.
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    21
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    22
This patch makes bash continue to ignore the invalid names, but pass
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    23
them to child processes in the export environment.
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    24
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    25
Patch:
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    26
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    27
*** ../bash-4.0-patched/variables.c	2009-01-04 14:32:46.000000000 -0500
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    28
--- variables.c	2009-06-29 09:17:20.000000000 -0400
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    29
***************
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    30
*** 253,256 ****
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    31
--- 255,259 ----
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    32
  static int visible_var __P((SHELL_VAR *));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    33
  static int visible_and_exported __P((SHELL_VAR *));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    34
+ static int export_environment_candidate __P((SHELL_VAR *));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    35
  static int local_and_exported __P((SHELL_VAR *));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    36
  static int variable_in_context __P((SHELL_VAR *));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    37
***************
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    38
*** 376,383 ****
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    39
  #  endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    40
  #endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    41
        else if (legal_identifier (name))
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    42
  	{
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    43
  	  temp_var = bind_variable (name, string, 0);
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    44
! 	  VSETATTR (temp_var, (att_exported | att_imported));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    45
  	  array_needs_making = 1;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    46
  	}
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    47
--- 379,393 ----
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    48
  #  endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    49
  #endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    50
+ #if 0
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    51
        else if (legal_identifier (name))
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    52
+ #else
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    53
+       else
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    54
+ #endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    55
  	{
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    56
  	  temp_var = bind_variable (name, string, 0);
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    57
! 	  if (legal_identifier (name))
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    58
! 	    VSETATTR (temp_var, (att_exported | att_imported));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    59
! 	  else
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    60
! 	    VSETATTR (temp_var, (att_exported | att_imported | att_invisible));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    61
  	  array_needs_making = 1;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    62
  	}
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    63
***************
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    64
*** 3083,3086 ****
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    65
--- 3098,3111 ----
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    66
  }
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    67
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    68
+ /* Candidate variables for the export environment are either valid variables
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    69
+    with the export attribute or invalid variables inherited from the initial
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    70
+    environment and simply passed through. */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    71
+ static int
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    72
+ export_environment_candidate (var)
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    73
+      SHELL_VAR *var;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    74
+ {
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    75
+   return (exported_p (var) && (invisible_p (var) == 0 || imported_p (var)));
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    76
+ }
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    77
+ 
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    78
  /* Return non-zero if VAR is a local variable in the current context and
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    79
     is exported. */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    80
***************
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    81
*** 3439,3443 ****
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    82
--- 3464,3472 ----
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    83
    SHELL_VAR **vars;
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    84
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    85
+ #if 0
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    86
    vars = map_over (visible_and_exported, vcxt);
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    87
+ #else
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    88
+   vars = map_over (export_environment_candidate, vcxt);
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    89
+ #endif
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    90
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    91
    if (vars == 0)
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    92
*** ../bash-4.0/patchlevel.h	2009-01-04 14:32:40.000000000 -0500
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    93
--- patchlevel.h	2009-02-22 16:11:31.000000000 -0500
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    94
***************
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    95
*** 26,30 ****
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    96
     looks for to find the patch level (for the sccs version string). */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    97
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    98
! #define PATCHLEVEL 28
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
    99
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   100
  #endif /* _PATCHLEVEL_H_ */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   101
--- 26,30 ----
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   102
     looks for to find the patch level (for the sccs version string). */
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   103
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   104
! #define PATCHLEVEL 29
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   105
  
9c2a4ac793f0 Bash patch catchup including shellshock
Jon Tibble <meths@btinternet.com>
parents:
diff changeset
   106
  #endif /* _PATCHLEVEL_H_ */