]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: hs20-client: Fix hostname extraction from URL
authorBen Greear <greearb@candelatech.com>
Tue, 26 May 2015 20:47:34 +0000 (16:47 -0400)
committerJouni Malinen <j@w1.fi>
Wed, 27 May 2015 09:01:23 +0000 (12:01 +0300)
It was not properly handling cases like this:

https://foo.local:443

Signed-off-by: Ben Greear <greearb@candelatech.com>
hs20/client/osu_client.c

index 5cd823eeb5cd518f4be2d6af9bb25d04abcae3af..478d940e2e01a2415f1bb7b6263b5a226bd144ac 100644 (file)
@@ -2704,7 +2704,7 @@ 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--;
@@ -2734,8 +2734,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);