mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
feat: add HIP report generation functionality and related dependencies
This commit is contained in:
49 files changed
+2757
-1176
No files matched your search
@@ -13,6 +13,7 @@ pub(crate) struct ConnectOptions {
|
||||
|
||||
pub user_agent: *const c_char,
|
||||
pub os: *const c_char,
|
||||
pub os_version: *const c_char,
|
||||
pub client_version: *const c_char,
|
||||
|
||||
pub script: *const c_char,
|
||||
|
||||
@@ -94,11 +94,16 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
openconnect_set_protocol(vpninfo, "gp");
|
||||
openconnect_parse_url(vpninfo, options->server);
|
||||
openconnect_set_cookie(vpninfo, options->cookie);
|
||||
openconnect_set_useragent(vpninfo, options->user_agent);
|
||||
|
||||
if (options->os) {
|
||||
openconnect_set_reported_os(vpninfo, options->os);
|
||||
}
|
||||
|
||||
if (options->os_version) {
|
||||
openconnect_set_gp_os_version(vpninfo, options->os_version);
|
||||
}
|
||||
|
||||
if (options->client_version) {
|
||||
openconnect_set_gp_app_version(vpninfo,
|
||||
options->client_version);
|
||||
|
||||
@@ -13,6 +13,7 @@ typedef struct vpn_options {
|
||||
|
||||
const char *user_agent;
|
||||
const char *os;
|
||||
const char *os_version;
|
||||
const char *client_version;
|
||||
|
||||
const char *script;
|
||||
|
||||
@@ -17,6 +17,7 @@ pub struct Vpn {
|
||||
|
||||
user_agent: CString,
|
||||
os: CString,
|
||||
os_version: Option<CString>,
|
||||
client_version: Option<CString>,
|
||||
|
||||
script: CString,
|
||||
@@ -74,6 +75,7 @@ impl Vpn {
|
||||
|
||||
user_agent: self.user_agent.as_ptr(),
|
||||
os: self.os.as_ptr(),
|
||||
os_version: Self::option_to_ptr(&self.os_version),
|
||||
client_version: Self::option_to_ptr(&self.client_version),
|
||||
|
||||
script: self.script.as_ptr(),
|
||||
@@ -132,6 +134,7 @@ pub struct VpnBuilder {
|
||||
|
||||
user_agent: Option<String>,
|
||||
os: Option<String>,
|
||||
os_version: Option<String>,
|
||||
client_version: Option<String>,
|
||||
|
||||
certificate: Option<String>,
|
||||
@@ -161,6 +164,7 @@ impl VpnBuilder {
|
||||
|
||||
user_agent: None,
|
||||
os: None,
|
||||
os_version: None,
|
||||
client_version: None,
|
||||
|
||||
certificate: None,
|
||||
@@ -204,6 +208,11 @@ impl VpnBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn os_version<T: Into<Option<String>>>(mut self, os_version: T) -> Self {
|
||||
self.os_version = os_version.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client_version<T: Into<Option<String>>>(mut self, client_version: T) -> Self {
|
||||
self.client_version = client_version.into();
|
||||
self
|
||||
@@ -304,6 +313,7 @@ impl VpnBuilder {
|
||||
|
||||
user_agent: Self::to_cstring(&user_agent),
|
||||
os: Self::to_cstring(&os),
|
||||
os_version: self.os_version.as_deref().map(Self::to_cstring),
|
||||
client_version: self.client_version.as_deref().map(Self::to_cstring),
|
||||
|
||||
script: Self::to_cstring(&script),
|
||||
|
||||
@@ -15,6 +15,7 @@ const VPNC_SCRIPT_LOCATIONS: &[&str] = &[
|
||||
];
|
||||
|
||||
const CSD_WRAPPER_LOCATIONS: &[&str] = &[
|
||||
"/usr/libexec/gpclient/hipreport.sh",
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
"/usr/lib/x86_64-linux-gnu/openconnect/hipreport.sh",
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
|
||||
Reference in new issue
Block a user