[PATCH/RFC V3 11/13] auth: Parse second-auth-related properties from the auth form

Kevin Cernekee cernekee at gmail.com
Sun Dec 15 01:43:02 EST 2013


Add new fields to the internal __oc_form_opt and __oc_choice structs.

Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
 auth.c                 |    8 ++++++++
 openconnect-internal.h |    5 +++++
 2 files changed, 13 insertions(+)

diff --git a/auth.c b/auth.c
index 9f6e6d0..6ff0b01 100644
--- a/auth.c
+++ b/auth.c
@@ -173,6 +173,13 @@ static int parse_auth_choice(struct openconnect_info *vpninfo, struct __oc_auth_
 		choice->u.override_name = (char *)xmlGetProp(xml_node, (unsigned char *)"override-name");
 		choice->u.override_label = (char *)xmlGetProp(xml_node, (unsigned char *)"override-label");
 
+		choice->second_auth = prop_equals(xml_node, "second-auth", "1");
+		choice->secondary_username = (char *)xmlGetProp(xml_node,
+			(unsigned char *)"secondary_username");
+		choice->secondary_username_editable = prop_equals(xml_node,
+			"secondary_username_editable", "true");
+		choice->noaaa = prop_equals(xml_node, "noaaa", "1");
+
 		if (prop_equals(xml_node, "selected", "true"))
 			selection = opt->nr_choices - 1;
 	}
@@ -247,6 +254,7 @@ static int parse_form(struct openconnect_info *vpninfo, struct __oc_auth_form *f
 
 		opt->u.name = input_name;
 		opt->u.label = input_label;
+		opt->second_auth = prop_equals(xml_node, "second-auth", "1");
 
 		if (!strcmp(input_type, "hidden")) {
 			opt->u.type = OC_FORM_OPT_HIDDEN;
diff --git a/openconnect-internal.h b/openconnect-internal.h
index 1f52d5d..51ff7ad 100644
--- a/openconnect-internal.h
+++ b/openconnect-internal.h
@@ -125,10 +125,15 @@ struct pin_cache {
 struct __oc_form_opt {
 	struct __oc_form_opt *next;
 	struct oc_form_opt u;
+	int second_auth;
 };
 
 struct __oc_choice {
 	struct oc_choice u;
+	int second_auth;
+	char *secondary_username;
+	int secondary_username_editable;
+	int noaaa;
 };
 
 struct __oc_form_opt_select {
-- 
1.7.9.5




More information about the openconnect-devel mailing list