From 2f158bc194f8d9900f0c36087b254ada611cf126 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 5 Oct 2018 20:53:31 +0300 Subject: [PATCH] HS 2.0: Use alternative OSU_NAI information in hs20-osu-client Extend hs20-osu-client to support the new osu_nai2 value for OSU connection with the shared BSS (Single SSID) case. Signed-off-by: Jouni Malinen --- hs20/client/osu_client.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c index b8791b671..02bde2f8a 100644 --- a/hs20/client/osu_client.c +++ b/hs20/client/osu_client.c @@ -1987,6 +1987,7 @@ struct osu_data { char osu_ssid[33]; char osu_ssid2[33]; char osu_nai[256]; + char osu_nai2[256]; struct osu_lang_text friendly_name[MAX_OSU_VALS]; size_t friendly_name_count; struct osu_lang_text serv_desc[MAX_OSU_VALS]; @@ -2057,6 +2058,12 @@ static struct osu_data * parse_osu_providers(const char *fname, size_t *count) continue; } + if (os_strncmp(buf, "osu_nai2=", 9) == 0) { + os_snprintf(last->osu_nai2, sizeof(last->osu_nai2), + "%s", buf + 9); + continue; + } + if (strncmp(buf, "friendly_name=", 14) == 0) { struct osu_lang_text *txt; if (last->friendly_name_count == MAX_OSU_VALS) @@ -2134,7 +2141,7 @@ static struct osu_data * parse_osu_providers(const char *fname, size_t *count) static int osu_connect(struct hs20_osu_client *ctx, const char *bssid, const char *ssid, const char *ssid2, const char *url, unsigned int methods, int no_prod_assoc, - const char *osu_nai) + const char *osu_nai, const char *osu_nai2) { int id; const char *ifname = ctx->ifname; @@ -2166,6 +2173,8 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid, return -1; if (set_network_quoted(ifname, id, "ssid", ssid) < 0) return -1; + if (ssid2) + osu_nai = osu_nai2; if (osu_nai && os_strlen(osu_nai) > 0) { char dir[255], fname[300]; if (getcwd(dir, sizeof(dir)) == NULL) @@ -2363,6 +2372,8 @@ static int cmd_osu_select(struct hs20_osu_client *ctx, const char *dir, fprintf(f, "SSID2: %s
\n", last->osu_ssid2); if (last->osu_nai[0]) fprintf(f, "NAI: %s
\n", last->osu_nai); + if (last->osu_nai2[0]) + fprintf(f, "NAI2: %s
\n", last->osu_nai2); fprintf(f, "URL: %s
\n" "methods:%s%s
\n" "

\n", @@ -2449,7 +2460,8 @@ selected: ret = osu_connect(ctx, last->bssid, last->osu_ssid, last->osu_ssid2, last->url, last->methods, - no_prod_assoc, last->osu_nai); + no_prod_assoc, last->osu_nai, + last->osu_nai2); } } else ret = -1;