Skip to content

Commit

Permalink
Add support for Juniper's Post Sign-in Message
Browse files Browse the repository at this point in the history
Signed-off-by: Katelyn Schiesser <katelyn.schiesser@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
slowbro authored and David Woodhouse committed Jul 4, 2016
1 parent c9979db commit 7a4140a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
24 changes: 21 additions & 3 deletions auth-juniper.c
Expand Up @@ -123,15 +123,19 @@ static int parse_input_node(struct openconnect_info *vpninfo, struct oc_auth_for
}
} else if (!strcasecmp(type, "submit")) {
xmlnode_get_prop(node, "name", &opt->name);
if (!opt->name || strcmp(opt->name, submit_button)) {
if (opt->name && (!strcmp(opt->name, submit_button) ||
!strcmp(opt->name, "sn-postauth-proceed"))) {
/* Use this as the 'Submit' action for the form, by
implicitly adding it as a hidden option. */
xmlnode_get_prop(node, "value", &opt->_value);
opt->type = OC_FORM_OPT_HIDDEN;
} else {
vpn_progress(vpninfo, PRG_DEBUG,
_("Ignoring unknown form submit item '%s'\n"),
opt->name);
ret = -EINVAL;
goto out;
}
xmlnode_get_prop(node, "value", &opt->_value);
opt->type = OC_FORM_OPT_HIDDEN;
} else if (!strcasecmp(type, "checkbox")) {
opt->type = OC_FORM_OPT_HIDDEN;
xmlnode_get_prop(node, "name", &opt->name);
Expand Down Expand Up @@ -240,6 +244,20 @@ static struct oc_auth_form *parse_form_node(struct openconnect_info *vpninfo,
/* Skip its children */
while (child->children)
child = child->last;
} else if (!strcasecmp((char *)child->name, "textarea")) {
/* display the post sign-in message, if any */
char *fieldname = (char *)xmlGetProp(child, (unsigned char *)"name");
if (fieldname && !!strcasecmp(fieldname, "sn-postauth-text")) {
char *postauth_msg = (char *)xmlNodeGetContent(child);
if (postauth_msg) {
free(form->banner);
form->banner = postauth_msg;
}
} else {
vpn_progress(vpninfo, PRG_ERR,
_("Unknown textarea field: '%s'\n"), fieldname);
}
free(fieldname);
}
}
return form;
Expand Down
1 change: 1 addition & 0 deletions www/changelog.xml
Expand Up @@ -15,6 +15,7 @@
<ul>
<li><b>OpenConnect HEAD</b>
<ul>
<li>Support Juniper "Post Sign-in Message".</li>
<li>Add <tt>--protocol</tt> option.</li>
<li>Fix ChaCha20-Poly1305 cipher suite to reflect final standard.</li>
<li>Add ability to disable IPv6 support via library API.</li>
Expand Down

0 comments on commit 7a4140a

Please sign in to comment.