[PATCH] Append vpninfo->urlpath to <group-access>

Murilo Opsfelder Araujo muriloo at linux.vnet.ibm.com
Thu Sep 12 13:53:54 EDT 2013


Some ASA gateways may need the relative path specified in <group-access> XML
entry so it makes sense to verify if it exists and append it.

Signed-off-by: Murilo Opsfelder Araujo <muriloo at linux.vnet.ibm.com>
---
 auth.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/auth.c b/auth.c
index 5acd04b..f28e350 100644
--- a/auth.c
+++ b/auth.c
@@ -780,11 +780,17 @@ int xmlpost_initial_req(struct openconnect_info *vpninfo, char *request_body, in
 	xmlNodePtr root, node;
 	xmlDocPtr doc = xmlpost_new_query(vpninfo, "init", &root);
 	char *url;
+	int result;
 
 	if (!doc)
 		return -ENOMEM;
 
-	if (asprintf(&url, "https://%s", vpninfo->hostname) == -1)
+	if (vpninfo->urlpath)
+		result = asprintf(&url, "https://%s/%s", vpninfo->hostname, vpninfo->urlpath);
+	else
+		result = asprintf(&url, "https://%s", vpninfo->hostname);
+
+	if (result == -1)
 		goto bad;
 	node = xmlNewTextChild(root, NULL, XCAST("group-access"), XCAST(url));
 	free(url);
-- 
1.8.4.273.ga194ead




More information about the openconnect-devel mailing list