mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
Main changes: - Refactor connect/auth flows around a single OS profile and host identity model, including gateway fallback and cookie-on-stdin handling. - Align request parameters, HIP host-id propagation, SAML webview user-agent behavior, and portal default-browser handling with observed official client behavior. - Add opt-in cookie cache support and Microsoft Defender HIP reporting while keeping host-id validation explicit. - Add BSD build, packaging, release artifact, and provenance support with FreeBSD/OpenBSD path and dependency cleanup. - Update NixOS install documentation and dependency compatibility fixes.
102 lines
3.4 KiB
Diff
102 lines
3.4 KiB
Diff
From 78078b21f53801b31fef352ec0de40d319edcae9 Mon Sep 17 00:00:00 2001
|
|
From: Kevin Yue <[email protected]>
|
|
Date: Sat, 13 Jun 2026 12:00:00 +0800
|
|
Subject: [PATCH 6/6] Add host ID to GlobalProtect HIP script arguments
|
|
|
|
---
|
|
gpst.c | 4 ++++
|
|
library.c | 15 +++++++++++++++
|
|
openconnect-internal.h | 4 ++++
|
|
openconnect.h | 3 +++
|
|
4 files changed, 26 insertions(+)
|
|
|
|
diff --git a/gpst.c b/gpst.c
|
|
index 78c16d1c..f1e1f6bb 100644
|
|
--- a/gpst.c
|
|
+++ b/gpst.c
|
|
@@ -1019,6 +1019,10 @@ static int run_hip_script(struct openconnect_info *vpninfo)
|
|
hip_argv[i++] = "--client-os";
|
|
hip_argv[i++] = gpst_os_name(vpninfo);
|
|
hip_argv[i++] = "--os-version";
|
|
hip_argv[i++] = openconnect_get_gp_os_version(vpninfo);
|
|
+ if (openconnect_get_gp_host_id(vpninfo)) {
|
|
+ hip_argv[i++] = "--host-id";
|
|
+ hip_argv[i++] = openconnect_get_gp_host_id(vpninfo);
|
|
+ }
|
|
hip_argv[i++] = "--cookie";
|
|
hip_argv[i++] = vpninfo->cookie;
|
|
if (vpninfo->ip_info.addr) {
|
|
diff --git a/library.c b/library.c
|
|
index 03f47004..9e585119 100644
|
|
--- a/library.c
|
|
+++ b/library.c
|
|
@@ -900,6 +900,7 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo)
|
|
free(vpninfo->useragent);
|
|
free(vpninfo->gp_app_version);
|
|
free(vpninfo->gp_os_version);
|
|
+ free(vpninfo->gp_host_id);
|
|
free(vpninfo->authgroup);
|
|
#ifdef HAVE_LIBSTOKEN
|
|
if (vpninfo->stoken_pin)
|
|
@@ -1049,6 +1050,20 @@ const char *openconnect_get_gp_os_version(struct openconnect_info *vpninfo)
|
|
return vpninfo->gp_os_version ?: vpninfo->platname;
|
|
}
|
|
|
|
+int openconnect_set_gp_host_id(struct openconnect_info *vpninfo,
|
|
+ const char *gp_host_id)
|
|
+{
|
|
+ UTF8CHECK(gp_host_id);
|
|
+
|
|
+ STRDUP(vpninfo->gp_host_id, gp_host_id);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+const char *openconnect_get_gp_host_id(struct openconnect_info *vpninfo)
|
|
+{
|
|
+ return vpninfo->gp_host_id;
|
|
+}
|
|
+
|
|
int openconnect_set_urlpath(struct openconnect_info *vpninfo,
|
|
const char *urlpath)
|
|
{
|
|
diff --git a/openconnect-internal.h b/openconnect-internal.h
|
|
index a7e80659..76034fbd 100644
|
|
--- a/openconnect-internal.h
|
|
+++ b/openconnect-internal.h
|
|
@@ -788,6 +788,7 @@ struct openconnect_info {
|
|
char *version_string;
|
|
char *gp_app_version;
|
|
char *gp_os_version;
|
|
+ char *gp_host_id;
|
|
|
|
const char *quit_reason;
|
|
const char *delay_tunnel_reason; /* If non-null, provides a reason why protocol is not yet ready for tunnel setup */
|
|
@@ -1684,6 +1685,9 @@ const char *openconnect_get_gp_app_version(struct openconnect_info *vpninfo);
|
|
/* Get the OS version string for GP */
|
|
const char *openconnect_get_gp_os_version(struct openconnect_info *vpninfo);
|
|
|
|
+/* Get the host ID string for GP */
|
|
+const char *openconnect_get_gp_host_id(struct openconnect_info *vpninfo);
|
|
+
|
|
/* version.c */
|
|
extern const char openconnect_version_str[];
|
|
|
|
diff --git a/openconnect.h b/openconnect.h
|
|
index 40de2811..3c65c090 100644
|
|
--- a/openconnect.h
|
|
+++ b/openconnect.h
|
|
@@ -472,8 +472,11 @@ int openconnect_set_useragent(struct openconnect_info *vpninfo,
|
|
int openconnect_set_gp_app_version(struct openconnect_info *vpninfo,
|
|
const char *gp_app_version);
|
|
int openconnect_set_gp_os_version(struct openconnect_info *vpninfo,
|
|
const char *gp_os_version);
|
|
+int openconnect_set_gp_host_id(struct openconnect_info *vpninfo,
|
|
+ const char *gp_host_id);
|
|
+
|
|
|
|
int openconnect_passphrase_from_fsid(struct openconnect_info *vpninfo);
|
|
int openconnect_obtain_cookie(struct openconnect_info *vpninfo);
|
|
int openconnect_init_ssl(void);
|
|
--
|
|
2.50.1 (Apple Git-155)
|