diff options
Diffstat (limited to 'hs20')
| -rw-r--r-- | hs20/client/Android.mk | 19 | ||||
| -rw-r--r-- | hs20/client/oma_dm_client.c | 17 | ||||
| -rw-r--r-- | hs20/client/osu_client.c | 22 |
3 files changed, 49 insertions, 9 deletions
diff --git a/hs20/client/Android.mk b/hs20/client/Android.mk index 63cbc6f2..212aefe4 100644 --- a/hs20/client/Android.mk +++ b/hs20/client/Android.mk @@ -12,19 +12,21 @@ ifneq ($(wildcard external/icu),) INCLUDES += external/icu/icu4c/source/common else INCLUDES += external/icu4c/common +else +# The LOCAL_EXPORT_C_INCLUDE_DIRS from ICU did not seem to fully resolve the +# build (e.g., "mm -B" failed to build, but following that with "mm" allowed +# the build to complete). For now, add the include directory manually here for +# Android 5.0. +ver = $(filter 5.0%,$(PLATFORM_VERSION)) +ifneq (,$(strip $(ver))) +INCLUDES += external/icu/icu4c/source/common +endif endif -#GTKCFLAGS := $(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -#GTKLIBS := $(shell pkg-config --libs gtk+-2.0 webkit-1.0) -#CFLAGS += $(GTKCFLAGS) -#LIBS += $(GTKLIBS) - L_CFLAGS += -DCONFIG_CTRL_IFACE L_CFLAGS += -DCONFIG_CTRL_IFACE_UNIX L_CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/data/misc/wifi/sockets\" -L_CFLAGS += -DLIBXML_SCHEMAS_ENABLED -L_CFLAGS += -DLIBXML_REGEXP_ENABLED OBJS = spp_client.c OBJS += oma_dm_client.c @@ -53,8 +55,7 @@ OBJS += ../../src/crypto/sha256-internal.c L_CFLAGS += -DEAP_TLS_OPENSSL -#CFLAGS += $(shell xml2-config --cflags) -#LIBS += $(shell xml2-config --libs) +L_CFLAGS += -Wno-unused-parameter ######################## diff --git a/hs20/client/oma_dm_client.c b/hs20/client/oma_dm_client.c index 82e91062..6eaeeb47 100644 --- a/hs20/client/oma_dm_client.c +++ b/hs20/client/oma_dm_client.c @@ -394,6 +394,10 @@ static int oma_dm_exec_browser(struct hs20_osu_client *ctx, xml_node_t *exec) } data = xml_node_get_text(ctx->xml, node); + if (data == NULL) { + wpa_printf(MSG_INFO, "Invalid data"); + return DM_RESP_BAD_REQUEST; + } wpa_printf(MSG_INFO, "Data: %s", data); wpa_printf(MSG_INFO, "Launch browser to URI '%s'", data); write_summary(ctx, "Launch browser to URI '%s'", data); @@ -428,6 +432,10 @@ static int oma_dm_exec_get_cert(struct hs20_osu_client *ctx, xml_node_t *exec) } data = xml_node_get_text(ctx->xml, node); + if (data == NULL) { + wpa_printf(MSG_INFO, "Invalid data"); + return DM_RESP_BAD_REQUEST; + } wpa_printf(MSG_INFO, "Data: %s", data); getcert = xml_node_from_buf(ctx->xml, data); xml_node_get_text_free(ctx->xml, data); @@ -576,6 +584,11 @@ static int oma_dm_run_add(struct hs20_osu_client *ctx, const char *locuri, if (node) { char *type; type = xml_node_get_text(ctx->xml, node); + if (type == NULL) { + wpa_printf(MSG_ERROR, "Could not find type text"); + os_free(uri); + return DM_RESP_BAD_REQUEST; + } use_tnds = node && os_strstr(type, "application/vnd.syncml.dmtnds+xml"); } @@ -648,6 +661,10 @@ static int oma_dm_add(struct hs20_osu_client *ctx, xml_node_t *add, return DM_RESP_BAD_REQUEST; } locuri = xml_node_get_text(ctx->xml, node); + if (locuri == NULL) { + wpa_printf(MSG_ERROR, "No LocURI node text found"); + return DM_RESP_BAD_REQUEST; + } wpa_printf(MSG_INFO, "Target LocURI: %s", locuri); if (os_strncasecmp(locuri, "./Wi-Fi/", 8) != 0) { wpa_printf(MSG_INFO, "Unsupported Add Target LocURI"); diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c index e452aa70..de7f351d 100644 --- a/hs20/client/osu_client.c +++ b/hs20/client/osu_client.c @@ -9,6 +9,9 @@ #include "includes.h" #include <time.h> #include <sys/stat.h> +#ifdef ANDROID +#include "private/android_filesystem_config.h" +#endif /* ANDROID */ #include "common.h" #include "utils/browser.h" @@ -571,6 +574,21 @@ int hs20_add_pps_mo(struct hs20_osu_client *ctx, const char *uri, } } +#ifdef ANDROID + /* Allow processes running with Group ID as AID_WIFI, + * to read files from SP/<fqdn> directory */ + if (chown(fname, -1, AID_WIFI)) { + wpa_printf(MSG_INFO, "CTRL: Could not chown directory: %s", + strerror(errno)); + /* Try to continue anyway */ + } + if (chmod(fname, S_IRWXU | S_IRGRP | S_IXGRP) < 0) { + wpa_printf(MSG_INFO, "CTRL: Could not chmod directory: %s", + strerror(errno)); + /* Try to continue anyway */ + } +#endif /* ANDROID */ + snprintf(fname, fname_len, "SP/%s/pps.xml", fqdn); if (os_file_exists(fname)) { @@ -669,6 +687,10 @@ int update_pps_file(struct hs20_osu_client *ctx, const char *pps_fname, wpa_printf(MSG_INFO, "Updating PPS MO %s", pps_fname); str = xml_node_to_str(ctx->xml, pps); + if (str == NULL) { + wpa_printf(MSG_ERROR, "No node found"); + return -1; + } wpa_printf(MSG_MSGDUMP, "[hs20] Updated PPS: '%s'", str); snprintf(backup, sizeof(backup), "%s.bak", pps_fname); |
