aboutsummaryrefslogtreecommitdiffstats
path: root/hs20
diff options
context:
space:
mode:
authorKanchanapally, Vidyullatha <vkanchan@qti.qualcomm.com>2016-03-01 07:36:53 +0530
committerVidyullatha Kanchanapally <vidyullatha@codeaurora.org>2016-03-08 13:09:25 +0530
commit054ade673640a55494976ef3f1484ef55cc28e82 (patch)
tree7bd2a89323f5eec53cea655e73f4229f2d1ba934 /hs20
parentd6a504c2add7fcca73b70e3161fe292b50906f91 (diff)
downloadandroid_external_wpa_supplicant_8-054ade673640a55494976ef3f1484ef55cc28e82.tar.gz
android_external_wpa_supplicant_8-054ade673640a55494976ef3f1484ef55cc28e82.tar.bz2
android_external_wpa_supplicant_8-054ade673640a55494976ef3f1484ef55cc28e82.zip
Android: Allow wpa_supplicant to write files to osu-info dir
This commit allows any process running with group id of AID_WIFI to read/write files to osu-info directory. Also, it allows other users to read and search the osu-info directory. This fixes issues with hs20-osu-client creating a directory for wpa_supplicant use without wpa_supplicant actually having privileges to write there on Android where the wpa_supplicant process does not run as root. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Git-commit: 61697c7ecc0095d65218bc3f8203cabf370b2f27 Git-repo : git://w1.fi/srv/git/hostap.git Change-Id: I2ecf0e91b03d942a3c28ea0ecdcae76754f55daf CRs-Fixed: 985459
Diffstat (limited to 'hs20')
-rw-r--r--hs20/client/osu_client.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index 0315f7b7..6e875efa 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -2339,12 +2339,23 @@ static int cmd_signup(struct hs20_osu_client *ctx, int no_prod_assoc,
return -1;
snprintf(fname, sizeof(fname), "%s/osu-info", dir);
- if (mkdir(fname, S_IRWXU | S_IRWXG) < 0 && errno != EEXIST) {
+ if (mkdir(fname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0 &&
+ errno != EEXIST) {
wpa_printf(MSG_INFO, "mkdir(%s) failed: %s",
fname, strerror(errno));
return -1;
}
+#ifdef ANDROID
+ /* Allow processes running with Group ID as AID_WIFI
+ * to read/write files from osu-info directory
+ */
+ if (chown(fname, -1, AID_WIFI)) {
+ wpa_printf(MSG_INFO, "Could not chown osu-info directory: %s",
+ strerror(errno));
+ }
+#endif /* ANDROID */
+
snprintf(buf, sizeof(buf), "SET osu_dir %s", fname);
if (wpa_command(ifname, buf) < 0) {
wpa_printf(MSG_INFO, "Failed to configure osu_dir to wpa_supplicant");