Skip to content

Commit

Permalink
hs20-client: use configured ca-fname instead of cwd.
Browse files Browse the repository at this point in the history
This gives more flexibility to the hs20 client user.

Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed May 19, 2015
1 parent 31fce2b commit 04545aa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions hs20/client/osu_client.c
Expand Up @@ -2039,11 +2039,19 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
if (set_network_quoted(ifname, id, "ssid", ssid) < 0)
return -1;
if (osu_nai && os_strlen(osu_nai) > 0) {
char dir[255], fname[300];
if (getcwd(dir, sizeof(dir)) == NULL)
return -1;
os_snprintf(fname, sizeof(fname), "%s/osu-ca.pem", dir);
char fname[300];
if (ctx->ca_fname) {
strncpy(fname, ctx->ca_fname, sizeof(fname));
}
else {
char dir[255];
if (getcwd(dir, sizeof(dir)) == NULL)
return -1;
os_snprintf(fname, sizeof(fname), "%s/osu-ca.pem", dir);
ctx->ca_fname = strdup(fname); /* so lib curl can use it. */
}

fname[sizeof(fname) - 1] = 0; /* ensure null termination */
if (set_network(ifname, id, "proto", "OSEN") < 0 ||
set_network(ifname, id, "key_mgmt", "OSEN") < 0 ||
set_network(ifname, id, "pairwise", "CCMP") < 0 ||
Expand Down

0 comments on commit 04545aa

Please sign in to comment.