HS 2.0: hs20-client: Fix hostname extraction from URL

It was not properly handling cases like this:

https://foo.local:443

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2015-05-26 16:47:34 -04:00 committed by Jouni Malinen
parent dba68f2be2
commit 1b748e67ae

View 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);