[PATCH 3/9] hs20-client: use configured ca-fname instead of cwd.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

This gives more flexibility to the hs20 client user.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
 hs20/client/osu_client.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index a94f40c51..9f9c307b6 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -2190,14 +2190,23 @@ static int osu_connect(struct hs20_osu_client *ctx, const char *bssid,
 	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)
-			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. */
+		}
 
 		if (ssid2 && set_network_quoted(ifname, id, "ssid", ssid2) < 0)
 			return -1;
 
+		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 ||
-- 
2.20.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux