From ce480d433af7f974021d004f02777c34f477a367 Mon Sep 17 00:00:00 2001 From: Emil Hemdal Date: Wed, 5 Feb 2025 09:45:38 +0100 Subject: [PATCH] Add hostname to response to fix Cisco auth Adding hostname to the attribute `computer-name` for the tag `device-id` fixes authentication issues on some Cisco AnyConnect instances. Signed-off-by: Emil Hemdal --- auth.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/auth.c b/auth.c index cf12ea29e..4a9dfb075 100644 --- a/auth.c +++ b/auth.c @@ -833,6 +833,12 @@ static xmlDocPtr xmlpost_new_query(struct openconnect_info *vpninfo, const char goto bad; if (!xmlNewProp(node, XCAST("who"), XCAST("vpn"))) goto bad; + + char hostname[256]; + if (gethostname(hostname, sizeof(hostname)) == -1) { + perror("gethostname"); + goto bad; + } node = xmlNewTextChild(root, NULL, XCAST("device-id"), XCAST(vpninfo->platname)); if (!node) @@ -842,6 +848,8 @@ static xmlDocPtr xmlpost_new_query(struct openconnect_info *vpninfo, const char !xmlNewProp(node, XCAST("device-type"), XCAST(vpninfo->mobile_device_type)) || !xmlNewProp(node, XCAST("unique-id"), XCAST(vpninfo->mobile_device_uniqueid))) goto bad; + } else if(!xmlNewProp(node, XCAST("computer-name"), XCAST(hostname))) { + goto bad; } capabilities = xmlNewNode(NULL, XCAST("capabilities")); -- GitLab