Download | Plain Text | No Line Numbers


  1. diff -Naur bash-4.2.orig/execute_cmd.c bash-4.2/execute_cmd.c
  2. --- bash-4.2.orig/execute_cmd.c 2014-11-14 19:32:13.985931788 +0100
  3. +++ bash-4.2/execute_cmd.c 2014-11-14 19:33:34.085291416 +0100
  4. @@ -4654,7 +4654,9 @@
  5. result = EXECUTION_SUCCESS;
  6. #if defined (RESTRICTED_SHELL)
  7. command = (char *)NULL;
  8. - if (restricted && mbschr (pathname, '/'))
  9. + if (restricted && php)
  10. + pathname = base_pathname (pathname);
  11. + else if (restricted && mbschr (pathname, '/'))
  12. {
  13. internal_error (_("%s: restricted: cannot specify `/' in command names"),
  14. pathname);
  15. diff -Naur bash-4.2.orig/flags.c bash-4.2/flags.c
  16. --- bash-4.2.orig/flags.c 2009-01-04 20:32:29.000000000 +0100
  17. +++ bash-4.2/flags.c 2014-11-14 19:33:12.854931035 +0100
  18. @@ -139,6 +139,7 @@
  19. output redirection. */
  20. int restricted = 0; /* currently restricted */
  21. int restricted_shell = 0; /* shell was started in restricted mode. */
  22. +int php = 0;
  23. #endif /* RESTRICTED_SHELL */
  24.  
  25. /* Non-zero means that this shell is running in `privileged' mode. This
  26. diff -Naur bash-4.2.orig/flags.h bash-4.2/flags.h
  27. --- bash-4.2.orig/flags.h 2009-01-04 20:32:29.000000000 +0100
  28. +++ bash-4.2/flags.h 2014-11-14 19:33:12.854931035 +0100
  29. @@ -64,6 +64,7 @@
  30. #if defined (RESTRICTED_SHELL)
  31. extern int restricted;
  32. extern int restricted_shell;
  33. +extern int php;
  34. #endif /* RESTRICTED_SHELL */
  35.  
  36. extern int *find_flag __P((int));
  37. diff -Naur bash-4.2.orig/redir.c bash-4.2/redir.c
  38. --- bash-4.2.orig/redir.c 2014-11-14 19:32:14.080933400 +0100
  39. +++ bash-4.2/redir.c 2014-11-14 19:33:12.854931035 +0100
  40. @@ -801,7 +801,7 @@
  41. return (AMBIGUOUS_REDIRECT);
  42.  
  43. #if defined (RESTRICTED_SHELL)
  44. - if (restricted && (WRITE_REDIRECT (ri)))
  45. + if (restricted && !php && (WRITE_REDIRECT (ri)))
  46. {
  47. free (redirectee_word);
  48. return (RESTRICTED_REDIRECT);
  49. diff -Naur bash-4.2.orig/shell.c bash-4.2/shell.c
  50. --- bash-4.2.orig/shell.c 2011-01-02 22:04:51.000000000 +0100
  51. +++ bash-4.2/shell.c 2014-11-14 19:33:12.855931052 +0100
  52. @@ -252,6 +252,7 @@
  53. { "rcfile", Charp, (int *)0x0, &bashrc_file },
  54. #if defined (RESTRICTED_SHELL)
  55. { "restricted", Int, &restricted, (char **)0x0 },
  56. + { "php", Int, &php, (char **)0x0 },
  57. #endif
  58. { "verbose", Int, &echo_input_at_read, (char **)0x0 },
  59. { "version", Int, &do_version, (char **)0x0 },
  60.