[PATCH-v2 4/4] hs20-client: allow user to specify spp.xsd file.

greearb at candelatech.com greearb at candelatech.com
Tue Mar 31 20:14:20 EDT 2015


From: Ben Greear <greearb at candelatech.com>

Allow user to specify the path to the spp.xsd file.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
 hs20/client/osu_client.c | 8 +++++++-
 hs20/client/osu_client.h | 3 +++
 hs20/client/spp_client.c | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index 0519ef0..c816211 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -25,6 +25,8 @@
 #include "crypto/sha256.h"
 #include "osu_client.h"
 
+/* global variables */
+const char *spp_xsd_fname = "spp.xsd";
 
 void write_result(struct hs20_osu_client *ctx, const char *fmt, ...)
 {
@@ -2985,6 +2987,7 @@ static void usage(void)
 	       "    [-w<wpa_supplicant ctrl_iface dir>] "
 	       "[-r<result file>] [-f<debug file>] \\\n"
 	       "    [-s<summary file>] \\\n"
+	       "    [-x<spp.xsd file name>] \\\n"
 	       "    <command> [arguments..]\n"
 	       "commands:\n"
 	       "- to_tnds <XML MO> <XML MO in TNDS format> [URN]\n"
@@ -3026,7 +3029,7 @@ int main(int argc, char *argv[])
 		return -1;
 
 	for (;;) {
-		c = getopt(argc, argv, "df:hKNO:qr:s:S:tw:");
+		c = getopt(argc, argv, "df:hKNO:qr:s:S:tw:x:");
 		if (c < 0)
 			break;
 		switch (c) {
@@ -3064,6 +3067,9 @@ int main(int argc, char *argv[])
 		case 'w':
 			wpas_ctrl_path = optarg;
 			break;
+		case 'x':
+			spp_xsd_fname = strdup(optarg);
+			break;
 		case 'h':
 		default:
 			usage();
diff --git a/hs20/client/osu_client.h b/hs20/client/osu_client.h
index 9a7059e..339238e 100644
--- a/hs20/client/osu_client.h
+++ b/hs20/client/osu_client.h
@@ -115,4 +115,7 @@ int est_build_csr(struct hs20_osu_client *ctx, const char *url);
 int est_simple_enroll(struct hs20_osu_client *ctx, const char *url,
 		      const char *user, const char *pw);
 
+/* global variables */
+extern const char *spp_xsd_fname;
+
 #endif /* OSU_CLIENT_H */
diff --git a/hs20/client/spp_client.c b/hs20/client/spp_client.c
index d55095f..18eb53b 100644
--- a/hs20/client/spp_client.c
+++ b/hs20/client/spp_client.c
@@ -59,7 +59,7 @@ static int hs20_spp_validate(struct hs20_osu_client *ctx, xml_node_t *node,
 		return -1;
 	}
 
-	ret = xml_validate(xctx, node, "spp.xsd", &err);
+	ret = xml_validate(xctx, node, spp_xsd_fname, &err);
 	if (ret < 0) {
 		wpa_printf(MSG_INFO, "XML schema validation error(s)\n%s", err);
 		write_summary(ctx, "SPP XML schema validation failed");
-- 
1.9.3



More information about the HostAP mailing list