]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Use execve() with custom env PATH to launch browser using 'am'
authorPurushottam Kushwaha <pkushwah@codeaurora.org>
Fri, 12 Oct 2018 10:07:34 +0000 (15:37 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 12 Oct 2018 12:51:05 +0000 (15:51 +0300)
With new restriction in Android, if PATH env variable doesn't have
correct path of 'am' binary, execv() fails to launch wpadebug browser
(am starts, but something seems to fail within its internal processing).

This commit is a workaround to use execve() with custom environment PATH
which includes "/system/bin;/vendor/bin" to handle the cases where
hs20-osu-client fails to launch wpadebug browser through /system/bin/am.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/utils/browser-wpadebug.c

index 062e6fef1f5a6f321faf70d96f4291bc9f14ef09..dfb4b67977f876efb170b603d5017e667de4d989 100644 (file)
@@ -97,6 +97,7 @@ int hs20_web_browser(const char *url)
        if (pid == 0) {
                /* run the external command in the child process */
                char *argv[14];
+               char *envp[] = { "PATH=/system/bin:/vendor/bin", NULL };
 
                argv[0] = "browser-wpadebug";
                argv[1] = "start";
@@ -113,8 +114,8 @@ int hs20_web_browser(const char *url)
                argv[12] = "-3"; /* USER_CURRENT_OR_SELF */
                argv[13] = NULL;
 
-               execv("/system/bin/am", argv);
-               wpa_printf(MSG_ERROR, "execv: %s", strerror(errno));
+               execve("/system/bin/am", argv, envp);
+               wpa_printf(MSG_ERROR, "execve: %s", strerror(errno));
                exit(0);
                return -1;
        }