mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
122 lines
4.5 KiB
Diff
122 lines
4.5 KiB
Diff
From dda2aceca7e614af65b968e632065ef223cb6612 Mon Sep 17 00:00:00 2001
|
|
From: Kevin Yue <[email protected]>
|
|
Date: Sun, 14 Dec 2025 17:14:08 +0800
|
|
Subject: [PATCH 3/4] Add support for OS version handling in GlobalProtect
|
|
authentication
|
|
|
|
---
|
|
auth-globalprotect.c | 2 +-
|
|
gpst.c | 4 ++--
|
|
library.c | 15 +++++++++++++++
|
|
openconnect-internal.h | 4 ++++
|
|
openconnect.h | 3 +++
|
|
5 files changed, 25 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/auth-globalprotect.c b/auth-globalprotect.c
|
|
index 27e41c2b..59d6de3b 100644
|
|
--- a/auth-globalprotect.c
|
|
+++ b/auth-globalprotect.c
|
|
@@ -731,7 +731,7 @@ static int gpst_login(struct openconnect_info *vpninfo, int portal, struct login
|
|
buf_append(request_body, "jnlpReady=jnlpReady&ok=Login&direct=yes&clientVer=4100&prot=https:&internal=no");
|
|
append_opt(request_body, "ipv6-support", vpninfo->disable_ipv6 ? "no" : "yes");
|
|
append_opt(request_body, "clientos", gpst_os_name(vpninfo));
|
|
- append_opt(request_body, "os-version", vpninfo->platname);
|
|
+ append_opt(request_body, "os-version", openconnect_get_gp_os_version(vpninfo));
|
|
append_opt(request_body, "server", vpninfo->hostname);
|
|
append_opt(request_body, "computer", vpninfo->localname);
|
|
if (ctx->portal_userauthcookie)
|
|
diff --git a/gpst.c b/gpst.c
|
|
index 5c24bbd2..0373fce0 100644
|
|
--- a/gpst.c
|
|
+++ b/gpst.c
|
|
@@ -657,7 +657,7 @@ static int gpst_get_config(struct openconnect_info *vpninfo)
|
|
append_opt(request_body, "app-version", app_version);
|
|
append_opt(request_body, "ipv6-support", vpninfo->disable_ipv6 ? "no" : "yes");
|
|
append_opt(request_body, "clientos", gpst_os_name(vpninfo));
|
|
- append_opt(request_body, "os-version", vpninfo->platname);
|
|
+ append_opt(request_body, "os-version", openconnect_get_gp_os_version(vpninfo));
|
|
append_opt(request_body, "hmac-algo", "sha1,md5,sha256");
|
|
append_opt(request_body, "enc-algo", "aes-128-cbc,aes-256-cbc");
|
|
if (old_addr || old_addr6) {
|
|
@@ -1044,7 +1044,7 @@ static int run_hip_script(struct openconnect_info *vpninfo)
|
|
*/
|
|
unsetenv("APP_VERSION");
|
|
if (setenv("APP_VERSION", openconnect_get_gp_app_version(vpninfo), 1))
|
|
- goto out;
|
|
+ goto out;
|
|
|
|
execv(hip_argv[0], (char **)hip_argv);
|
|
|
|
diff --git a/library.c b/library.c
|
|
index 18334c76..e2169054 100644
|
|
--- a/library.c
|
|
+++ b/library.c
|
|
@@ -897,6 +897,7 @@ void openconnect_vpninfo_free(struct openconnect_info *vpninfo)
|
|
free(vpninfo->localname);
|
|
free(vpninfo->useragent);
|
|
free(vpninfo->gp_app_version);
|
|
+ free(vpninfo->gp_os_version);
|
|
free(vpninfo->authgroup);
|
|
#ifdef HAVE_LIBSTOKEN
|
|
if (vpninfo->stoken_pin)
|
|
@@ -1034,6 +1035,20 @@ const char *openconnect_get_gp_app_version(struct openconnect_info *vpninfo)
|
|
return vpninfo->csd_ticket ?: (vpninfo->gp_app_version ?: "6.3.0-33");
|
|
}
|
|
|
|
+int openconnect_set_gp_os_version(struct openconnect_info *vpninfo,
|
|
+ const char *gp_os_version)
|
|
+{
|
|
+ UTF8CHECK(gp_os_version);
|
|
+
|
|
+ STRDUP(vpninfo->gp_os_version, gp_os_version);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+const char *openconnect_get_gp_os_version(struct openconnect_info *vpninfo)
|
|
+{
|
|
+ return vpninfo->gp_os_version ?: vpninfo->platname;
|
|
+}
|
|
+
|
|
int openconnect_set_urlpath(struct openconnect_info *vpninfo,
|
|
const char *urlpath)
|
|
{
|
|
diff --git a/openconnect-internal.h b/openconnect-internal.h
|
|
index 988f85f0..5c8d2909 100644
|
|
--- a/openconnect-internal.h
|
|
+++ b/openconnect-internal.h
|
|
@@ -787,6 +787,7 @@ struct openconnect_info {
|
|
char *useragent;
|
|
char *version_string;
|
|
char *gp_app_version;
|
|
+ char *gp_os_version;
|
|
|
|
const char *quit_reason;
|
|
const char *delay_tunnel_reason; /* If non-null, provides a reason why protocol is not yet ready for tunnel setup */
|
|
@@ -1681,6 +1682,9 @@ int handle_external_browser(struct openconnect_info *vpninfo);
|
|
/* Get the app version */
|
|
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);
|
|
+
|
|
/* version.c */
|
|
extern const char openconnect_version_str[];
|
|
|
|
diff --git a/openconnect.h b/openconnect.h
|
|
index 7d4f3399..aa96a53b 100644
|
|
--- a/openconnect.h
|
|
+++ b/openconnect.h
|
|
@@ -472,6 +472,9 @@ 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_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)
|
|
|