nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone

Blame SOURCES/bash-4.2-env-inject.patch

62649d
*** ../bash-4.3-patched/builtins/common.h	2013-07-08 16:54:47.000000000 -0400
62649d
--- builtins/common.h	2014-09-12 14:25:47.000000000 -0400
62649d
***************
62649d
*** 34,37 ****
62649d
--- 49,54 ----
62649d
  #define SEVAL_PARSEONLY	0x020
62649d
  #define SEVAL_NOLONGJMP 0x040
62649d
+ #define SEVAL_FUNCDEF	0x080		/* only allow function definitions */
62649d
+ #define SEVAL_ONECMD	0x100		/* only allow a single command */
62649d
  
62649d
  /* Flags for describe_command, shared between type.def and command.def */
62649d
*** ../bash-4.3-patched/builtins/evalstring.c	2014-02-11 09:42:10.000000000 -0500
62649d
--- builtins/evalstring.c	2014-09-14 14:15:13.000000000 -0400
62649d
***************
62649d
*** 309,312 ****
62649d
--- 313,324 ----
62649d
  	      struct fd_bitmap *bitmap;
62649d
  
62649d
+ 	      if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def)
62649d
+ 		{
62649d
+ 		  internal_warning ("%s: ignoring function definition attempt", from_file);
62649d
+ 		  should_jump_to_top_level = 0;
62649d
+ 		  last_result = last_command_exit_value = EX_BADUSAGE;
62649d
+ 		  break;
62649d
+ 		}
62649d
+ 
62649d
  	      bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
62649d
  	      begin_unwind_frame ("pe_dispose");
62649d
***************
62649d
*** 369,372 ****
62649d
--- 381,387 ----
62649d
  	      dispose_fd_bitmap (bitmap);
62649d
  	      discard_unwind_frame ("pe_dispose");
62649d
+ 
62649d
+ 	      if (flags & SEVAL_ONECMD)
62649d
+ 		break;
62649d
  	    }
62649d
  	}
62649d
*** ../bash-4.3-patched/variables.c	2014-05-15 08:26:50.000000000 -0400
62649d
--- variables.c	2014-09-14 14:23:35.000000000 -0400
62649d
***************
62649d
*** 359,368 ****
62649d
  	  strcpy (temp_string + char_index + 1, string);
62649d
  
62649d
! 	  parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST);
62649d
! 
62649d
! 	  /* Ancient backwards compatibility.  Old versions of bash exported
62649d
! 	     functions like name()=() {...} */
62649d
! 	  if (name[char_index - 1] == ')' && name[char_index - 2] == '(')
62649d
! 	    name[char_index - 2] = '\0';
62649d
  
62649d
  	  if (temp_var = find_function (name))
62649d
--- 364,372 ----
62649d
  	  strcpy (temp_string + char_index + 1, string);
62649d
  
62649d
! 	  /* Don't import function names that are invalid identifiers from the
62649d
! 	     environment, though we still allow them to be defined as shell
62649d
! 	     variables. */
62649d
! 	  if (legal_identifier (name))
62649d
! 	    parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
62649d
  
62649d
  	  if (temp_var = find_function (name))
b0c87f
***************
b0c87f
*** 362,369 ****
b0c87f
  	  else
b0c87f
  	    report_error (_("error importing function definition for `%s'"), name);
b0c87f
- 
b0c87f
- 	  /* ( */
b0c87f
- 	  if (name[char_index - 1] == ')' && name[char_index - 2] == '\0')
b0c87f
- 	    name[char_index - 2] = '(';		/* ) */
b0c87f
  	}
b0c87f
  #if defined (ARRAY_VARS)
b0c87f
--- 360,363 ----