svn commit: trunk/busybox/shell
vda at busybox.net
vda at busybox.net
Sat Mar 3 23:12:18 UTC 2007
Author: vda
Date: 2007-03-03 15:12:17 -0800 (Sat, 03 Mar 2007)
New Revision: 18002
Log:
ash: do not use "safe applets" in non-standalone shell
Modified:
trunk/busybox/shell/ash.c
Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c 2007-03-03 20:06:59 UTC (rev 18001)
+++ trunk/busybox/shell/ash.c 2007-03-03 23:12:17 UTC (rev 18002)
@@ -6455,7 +6455,9 @@
/* ============ find_command */
-static int is_safe_applet(char *name)
+#if ENABLE_FEATURE_SH_STANDALONE_SHELL
+static int
+is_safe_applet(char *name)
{
/* It isn't a bug to have non-existent applet here... */
/* ...just a waste of space... */
@@ -6488,6 +6490,7 @@
return 0;
}
+#endif
struct builtincmd {
const char *name;
@@ -6551,28 +6554,27 @@
tryexec(char *cmd, char **argv, char **envp)
{
int repeated = 0;
- struct BB_applet *a;
- int argc = 0;
- char **c;
- if (strchr(cmd, '/') == NULL
- && (a = find_applet_by_name(cmd)) != NULL
- && is_safe_applet(cmd)
- ) {
- c = argv;
- while (*c != NULL) {
- c++; argc++;
+#if ENABLE_FEATURE_SH_STANDALONE_SHELL
+ if (strchr(cmd, '/') == NULL) {
+ struct BB_applet *a;
+ char **c;
+
+ a = find_applet_by_name(cmd);
+ if (a) {
+ if (is_safe_applet(cmd)) {
+ c = argv;
+ while (*c)
+ c++;
+ applet_name = cmd;
+ exit(a->main(c - argv, argv));
+ }
+ /* re-exec ourselves with the new arguments */
+ execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
}
- applet_name = cmd;
- exit(a->main(argc, argv));
}
-#if ENABLE_FEATURE_SH_STANDALONE_SHELL
- if (find_applet_by_name(cmd) != NULL) {
- /* re-exec ourselves with the new arguments */
- execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp);
- /* If they called chroot or otherwise made the binary no longer
- * executable, fall through */
- }
#endif
repeat:
@@ -6619,7 +6621,7 @@
clearredir(1);
envp = environment();
- if (strchr(argv[0], '/') || is_safe_applet(argv[0])
+ if (strchr(argv[0], '/')
#if ENABLE_FEATURE_SH_STANDALONE_SHELL
|| find_applet_by_name(argv[0])
#endif
@@ -11141,13 +11143,13 @@
entry->u.index = -1;
return;
}
-#endif
-
+ /* Already caught above
if (is_safe_applet(name)) {
entry->cmdtype = CMDNORMAL;
entry->u.index = -1;
return;
- }
+ }*/
+#endif
updatetbl = (path == pathval());
if (!updatetbl) {
More information about the busybox-cvs
mailing list