aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-03-08 15:12:52 +0000
committerRon Yorston <rmy@pobox.com>2019-03-08 15:12:52 +0000
commit3eaaac2f84e580246724725da380ac47e0ebc07e (patch)
tree5b5c2630ccbc1e09f30bfb6e4fb83de193028028
parent5627c61f0b382593fa74757036dcd1ffbd9d9ad3 (diff)
downloadbusybox-w32-3eaaac2f84e580246724725da380ac47e0ebc07e.tar.gz
busybox-w32-3eaaac2f84e580246724725da380ac47e0ebc07e.tar.bz2
busybox-w32-3eaaac2f84e580246724725da380ac47e0ebc07e.zip
su, wget: use magic '--busybox' flag
I've been a bit lax about ensuring the --busybox flag is passed in command lines. It's needed to avoid problems if the binary is called something like sh.exe.
-rw-r--r--loginutils/suw32.c7
-rw-r--r--networking/wget.c3
2 files changed, 4 insertions, 6 deletions
diff --git a/loginutils/suw32.c b/loginutils/suw32.c
index be1a5211e..d51a7f58c 100644
--- a/loginutils/suw32.c
+++ b/loginutils/suw32.c
@@ -28,7 +28,6 @@ int suw32_main(int argc UNUSED_PARAM, char **argv)
28{ 28{
29 char *opt_command = NULL; 29 char *opt_command = NULL;
30 SHELLEXECUTEINFO info; 30 SHELLEXECUTEINFO info;
31 char *cwd;
32 31
33 getopt32(argv, "c:", &opt_command); 32 getopt32(argv, "c:", &opt_command);
34 if (argv[optind]) 33 if (argv[optind])
@@ -40,12 +39,10 @@ int suw32_main(int argc UNUSED_PARAM, char **argv)
40 /* info.hwnd = NULL; */ 39 /* info.hwnd = NULL; */
41 info.lpVerb = "runas"; 40 info.lpVerb = "runas";
42 info.lpFile = bb_busybox_exec_path; 41 info.lpFile = bb_busybox_exec_path;
43 cwd = getcwd(NULL, 0); 42 info.lpParameters = xasprintf("--busybox ash -d \"%s\"", getcwd(NULL, 0));
44 if (opt_command) 43 if (opt_command)
45 info.lpParameters = 44 info.lpParameters =
46 xasprintf("ash -d \"%s\" -s -c \"%s\"", cwd, opt_command); 45 xasprintf("%s -s -c \"%s\"", info.lpParameters, opt_command);
47 else
48 info.lpParameters = xasprintf("ash -d \"%s\"", cwd);
49 /* info.lpDirectory = NULL; */ 46 /* info.lpDirectory = NULL; */
50 info.nShow = SW_SHOWNORMAL; 47 info.nShow = SW_SHOWNORMAL;
51 48
diff --git a/networking/wget.c b/networking/wget.c
index bb70039f9..d907cee30 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -789,7 +789,8 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
789 789
790 fflush_all(); 790 fflush_all();
791 791
792 cmd = xasprintf("%s ssl_client -h %p -n %s%s", bb_busybox_exec_path, 792 cmd = xasprintf("%s --busybox ssl_client -h %p -n %s%s",
793 bb_busybox_exec_path,
793 (void *)_get_osfhandle(network_fd), servername, 794 (void *)_get_osfhandle(network_fd), servername,
794 flags & TLSLOOP_EXIT_ON_LOCAL_EOF ? " -e" : ""); 795 flags & TLSLOOP_EXIT_ON_LOCAL_EOF ? " -e" : "");
795 796