aboutsummaryrefslogtreecommitdiffstats
path: root/hs20
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2018-10-30 13:29:12 (GMT)
committerJouni Malinen <j@w1.fi>2018-10-30 13:29:12 (GMT)
commit1695b4dc371dbaa1ac6c40700f5f56e9eeeb1a6c (patch)
treef34eebc8d0f4d40476543aa2ddf0e4ce2b662014 /hs20
parent21895884ea7304f556ee2a97d118ac89b536ae82 (diff)
downloadhostap-1695b4dc371dbaa1ac6c40700f5f56e9eeeb1a6c.zip
hostap-1695b4dc371dbaa1ac6c40700f5f56e9eeeb1a6c.tar.gz
hostap-1695b4dc371dbaa1ac6c40700f5f56e9eeeb1a6c.tar.bz2
HS 2.0: Do not require devinfo.xml for all hs20-osu-client operations
hs20-osu-client refused to do anything if it could not find devinfo.xml from the current working directory. This is a bit excessive since that file was used in init_ctx() only to fill in ctx->devid which is used when constructing OMA DM messages. Move the check for ctx->devid into OMA DM specific code so that other hs20-osu-client functionality can be used without the devinfo.xml file. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Diffstat (limited to 'hs20')
-rw-r--r--hs20/client/oma_dm_client.c6
-rw-r--r--hs20/client/osu_client.c27
2 files changed, 16 insertions, 17 deletions
diff --git a/hs20/client/oma_dm_client.c b/hs20/client/oma_dm_client.c
index 5854b72..d75c845 100644
--- a/hs20/client/oma_dm_client.c
+++ b/hs20/client/oma_dm_client.c
@@ -111,6 +111,12 @@ static xml_node_t * oma_dm_build_hdr(struct hs20_osu_client *ctx,
xml_node_t *syncml, *synchdr;
xml_namespace_t *ns;
+ if (!ctx->devid) {
+ wpa_printf(MSG_ERROR,
+ "DevId from devinfo.xml is not available - cannot use OMA DM");
+ return NULL;
+ }
+
syncml = xml_node_create_root(ctx->xml, "SYNCML:SYNCML1.2", NULL, &ns,
"SyncML");
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index 9e1b0c7..636e106 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -3068,24 +3068,17 @@ static int init_ctx(struct hs20_osu_client *ctx)
return -1;
devinfo = node_from_file(ctx->xml, "devinfo.xml");
- if (!devinfo) {
- wpa_printf(MSG_ERROR, "devinfo.xml not found");
- return -1;
- }
-
- devid = get_node(ctx->xml, devinfo, "DevId");
- if (devid) {
- char *tmp = xml_node_get_text(ctx->xml, devid);
- if (tmp) {
- ctx->devid = os_strdup(tmp);
- xml_node_get_text_free(ctx->xml, tmp);
+ if (devinfo) {
+ devid = get_node(ctx->xml, devinfo, "DevId");
+ if (devid) {
+ char *tmp = xml_node_get_text(ctx->xml, devid);
+
+ if (tmp) {
+ ctx->devid = os_strdup(tmp);
+ xml_node_get_text_free(ctx->xml, tmp);
+ }
}
- }
- xml_node_free(ctx->xml, devinfo);
-
- if (ctx->devid == NULL) {
- wpa_printf(MSG_ERROR, "Could not fetch DevId from devinfo.xml");
- return -1;
+ xml_node_free(ctx->xml, devinfo);
}
ctx->http = http_init_ctx(ctx, ctx->xml);