mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
feat: release GP Connect 3.3.0 with Native Shell support
This commit is contained in:
226 files changed
+7700
-5225
No files matched your search
@@ -98,7 +98,7 @@ impl Drop for AuthCallbackReceiver {
|
||||
}
|
||||
|
||||
pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
|
||||
validate_callback(callback)?;
|
||||
validate_auth_callback(callback)?;
|
||||
forward_auth_callback_to(callback, &callback_socket_path()).await
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
async fn forward_auth_callback_to(callback: &str, socket_path: &Path) -> anyhow::Result<()> {
|
||||
validate_callback(callback)?;
|
||||
validate_auth_callback(callback)?;
|
||||
|
||||
let (version, status) = timeout(IO_TIMEOUT, async {
|
||||
let mut stream = UnixStream::connect(socket_path)
|
||||
@@ -232,7 +232,7 @@ fn remove_stale_socket(socket_path: &Path) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_callback(callback: &str) -> anyhow::Result<()> {
|
||||
pub fn validate_auth_callback(callback: &str) -> anyhow::Result<()> {
|
||||
if callback.len() > MAX_CALLBACK_SIZE {
|
||||
bail!("Authentication callback exceeds the maximum supported size");
|
||||
}
|
||||
@@ -276,7 +276,7 @@ async fn read_callback(stream: &mut UnixStream) -> Result<String, CallbackReadEr
|
||||
.await
|
||||
.map_err(|_| CallbackReadError::Io)?;
|
||||
let callback = String::from_utf8(payload).map_err(|_| CallbackReadError::Invalid)?;
|
||||
validate_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
|
||||
validate_auth_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
|
||||
Ok(callback)
|
||||
}
|
||||
|
||||
@@ -296,10 +296,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn validates_supported_callback_scheme() {
|
||||
assert!(validate_callback(VALID_CALLBACK).is_ok());
|
||||
assert!(validate_callback("https://example.com").is_err());
|
||||
assert!(validate_callback("globalprotectcallback:").is_err());
|
||||
assert!(validate_callback(&format!("globalprotectcallback:{}", "x".repeat(MAX_CALLBACK_SIZE))).is_err());
|
||||
assert!(validate_auth_callback(VALID_CALLBACK).is_ok());
|
||||
assert!(validate_auth_callback("https://example.com").is_err());
|
||||
assert!(validate_auth_callback("globalprotectcallback:").is_err());
|
||||
assert!(validate_auth_callback(&format!("globalprotectcallback:{}", "x".repeat(MAX_CALLBACK_SIZE))).is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -21,6 +21,19 @@ mod recovery_row;
|
||||
#[path = "gtk_tls.rs"]
|
||||
mod tls;
|
||||
|
||||
pub(super) fn open_okta_verify(url: &tauri::Url) -> bool {
|
||||
if url.scheme() != "com-okta-authenticator" {
|
||||
return true;
|
||||
}
|
||||
|
||||
// FastPass loads this URI in a hidden iframe. Hand it to the desktop instead of WebKitGTK.
|
||||
info!("Opening Okta Verify");
|
||||
if let Err(error) = gtk::gio::AppInfo::launch_default_for_uri(url.as_str(), None::<>k::gio::AppLaunchContext>) {
|
||||
warn!("Failed to open Okta Verify: {error}");
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn action_button(label: &str) -> anyhow::Result<gtk::Button> {
|
||||
let button = gtk::Button::with_label(label);
|
||||
let spacing = gtk::CssProvider::new();
|
||||
|
||||
@@ -129,6 +129,8 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
.title(self.window_title)
|
||||
.theme(native_theme(self.window_theme))
|
||||
.devtools(cfg!(any(debug_assertions, feature = "release-devtools")));
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
let auth_window_builder = auth_window_builder.on_navigation(super::platform_impl::open_okta_verify);
|
||||
let auth_window = auth_window_builder
|
||||
.inner_size(900.0, 650.0 + get_title_bar_height() + TOOLBAR_HEIGHT)
|
||||
.min_inner_size(400.0, 300.0)
|
||||
|
||||
Reference in new issue
Block a user