From: David Woodhouse <dwmw2@infradead.org>
Date: Fri, 29 Apr 2022 17:10:24 +0100
Subject: Use openconnect_set_useragent() where available
Origin: Origin: https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/commit/bad2d616d2bced3a83ad689daaadb25eed84931b

---
 auth-dialog/main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1885,6 +1885,16 @@ static auth_ui_data *init_ui_data (char
 							   nm_process_auth_form, write_progress,
 							   ui_data);
 
+#if OPENCONNECT_CHECK_VER(5,8)
+	/* The useragent provided to openconnect_vpninfo_new() gets the
+	 * OpenConnect version appended to it. But some servers need the
+	 * useragent to *precisely* match a known string; support for
+	 * that was added in OpenConnect 9.00 (API 5.8) with the
+	 * openconnect_set_useragent() function. */
+	if (vpn_useragent)
+		openconnect_set_useragent(ui_data->vpninfo, vpn_useragent);
+#endif
+
         openconnect_set_webview_callback(ui_data->vpninfo, open_webview);
 
 #if OPENCONNECT_CHECK_VER(1,4)
