[PATCH 3/3] hs20-client: Fix hostname extraction from url.

greearb at candelatech.com greearb
Tue May 26 13:47:34 PDT 2015


From: Ben Greear <greearb at candelatech.com>

It was not properly handling cases like this:

https://foo.local:443

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 hs20/client/osu_client.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index 40d5c61..c37f1df 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -2712,7 +2712,9 @@ static char * get_hostname(const char *url)
 
 	end = os_strchr(pos, '/');
 	end2 = os_strchr(pos, ':');
-	if (end && end2 && end2 < end)
+
+	if ((end && end2 && (end2 < end)) ||
+	    ((!end) && end2))
 		end = end2;
 	if (end)
 		end--;
@@ -2742,8 +2744,8 @@ static int osu_cert_cb(void *_ctx, struct http_cert *cert)
 	int found;
 	char *host = NULL;
 
-	wpa_printf(MSG_INFO, "osu_cert_cb(osu_cert_validation=%d)",
-		   !ctx->no_osu_cert_validation);
+	wpa_printf(MSG_INFO, "osu_cert_cb(osu_cert_validation=%d, url=%s)",
+		   !ctx->no_osu_cert_validation, ctx->server_url);
 
 	host = get_hostname(ctx->server_url);
 
-- 
1.9.3




More information about the Hostap mailing list