summaryrefslogtreecommitdiff
path: root/hs20/client/osu_client.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2017-10-18 03:44:27 +0000
committerCy Schubert <cy@FreeBSD.org>2017-10-18 03:44:27 +0000
commit256810032c472505440606bd9c1c4f7dbf06b0a2 (patch)
treed019f4f1ae29b86cbd3e9e74f832689976a267cf /hs20/client/osu_client.c
parentb834757ea3bcd1bba3381ff7cab216458d8f7efb (diff)
downloadsrc-test2-256810032c472505440606bd9c1c4f7dbf06b0a2.tar.gz
src-test2-256810032c472505440606bd9c1c4f7dbf06b0a2.zip
Notes
Diffstat (limited to 'hs20/client/osu_client.c')
-rw-r--r--hs20/client/osu_client.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index 0315f7b75ad4..c05c57d44f89 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -2229,7 +2229,7 @@ static int cmd_osu_select(struct hs20_osu_client *ctx, const char *dir,
fprintf(f, "</table></a><br><small>BSSID: %s<br>\n"
"SSID: %s<br>\n",
last->bssid, last->osu_ssid);
- if (last->osu_nai)
+ if (last->osu_nai[0])
fprintf(f, "NAI: %s<br>\n", last->osu_nai);
fprintf(f, "URL: %s<br>\n"
"methods:%s%s<br>\n"
@@ -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");
@@ -2559,7 +2570,7 @@ static int cmd_pol_upd(struct hs20_osu_client *ctx, const char *address,
if (!pps_fname) {
char buf[256];
wpa_printf(MSG_INFO, "Determining PPS file based on Home SP information");
- if (os_strncmp(address, "fqdn=", 5) == 0) {
+ if (address && os_strncmp(address, "fqdn=", 5) == 0) {
wpa_printf(MSG_INFO, "Use requested FQDN from command line");
os_snprintf(buf, sizeof(buf), "%s", address + 5);
address = NULL;
@@ -3122,20 +3133,12 @@ int main(int argc, char *argv[])
usage();
exit(0);
}
- if (argc - optind < 2)
- wpa_printf(MSG_ERROR, "Server URL missing from command line");
- else
- ret = cmd_sub_rem(&ctx, argv[optind + 1],
- argc > optind + 2 ?
- argv[optind + 2] : NULL,
- argc > optind + 3 ?
- argv[optind + 3] : NULL);
+ ret = cmd_sub_rem(&ctx, argv[optind + 1],
+ argc > optind + 2 ? argv[optind + 2] : NULL,
+ argc > optind + 3 ? argv[optind + 3] : NULL);
} else if (strcmp(argv[optind], "pol_upd") == 0) {
- if (argc - optind < 2) {
- usage();
- exit(0);
- }
- ret = cmd_pol_upd(&ctx, argc > 2 ? argv[optind + 1] : NULL,
+ ret = cmd_pol_upd(&ctx,
+ argc > optind + 1 ? argv[optind + 1] : NULL,
argc > optind + 2 ? argv[optind + 2] : NULL,
argc > optind + 3 ? argv[optind + 3] : NULL);
} else if (strcmp(argv[optind], "prov") == 0) {