1
0

200-change-hardcoded-shell-to-sh.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. --- a/progs/capsh.c
  2. +++ b/progs/capsh.c
  3. @@ -24,6 +24,9 @@
  4. #include <sys/wait.h>
  5. #include <sys/prctl.h>
  6. +#ifndef SHELL
  7. +#define SHELL "/bin/sh"
  8. +#endif
  9. #define MAX_GROUPS 100 /* max number of supplementary groups for user */
  10. static char *binary(unsigned long value)
  11. @@ -692,10 +695,10 @@ int main(int argc, char *argv[], char *envp[])
  12. } else if (!strcmp("--print", argv[i])) {
  13. arg_print();
  14. } else if ((!strcmp("--", argv[i])) || (!strcmp("==", argv[i]))) {
  15. - argv[i] = strdup(argv[i][0] == '-' ? "/bin/bash" : argv[0]);
  16. + argv[i] = strdup(argv[i][0] == '-' ? SHELL : argv[0]);
  17. argv[argc] = NULL;
  18. execve(argv[i], argv+i, envp);
  19. - fprintf(stderr, "execve /bin/bash failed!\n");
  20. + fprintf(stderr, "execve " SHELL " failed!\n");
  21. exit(1);
  22. } else {
  23. usage:
  24. @@ -720,7 +723,7 @@ int main(int argc, char *argv[], char *envp[])
  25. " --killit=<n> send signal(n) to child\n"
  26. " --forkfor=<n> fork and make child sleep for <n> sec\n"
  27. " == re-exec(capsh) with args as for --\n"
  28. - " -- remaing arguments are for /bin/bash\n"
  29. + " -- remaing arguments are for " SHELL "\n"
  30. " (without -- [%s] will simply exit(0))\n",
  31. argv[0], argv[0]);