mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
fix(windows): refine authentication UI and rotate desktop logs
Brand browser callbacks as GP Connect Login and refine the native recovery controls. Share bounded rotating logs between the GUI and authentication helper. Make OpenSSL interoperability tests opt-in, retain them in full CI, and correct platform-specific test guards and dependencies.
This commit is contained in:
23 files changed
+344
-60
No files matched your search
@@ -306,12 +306,16 @@ impl<'a> SamlAuthLauncher<'a> {
|
||||
}
|
||||
};
|
||||
let mut diagnostic = StderrDiagnostic::default();
|
||||
#[cfg(feature = "logger")]
|
||||
let mut stderr = crate::logger::diagnostic_writer();
|
||||
#[cfg(not(feature = "logger"))]
|
||||
let mut stderr = std::io::stderr();
|
||||
let output = run_observed(
|
||||
command,
|
||||
&check,
|
||||
Some(MAX_AUTH_RESULT_BYTES),
|
||||
&mut |bytes| diagnostic.push(bytes),
|
||||
&mut std::io::stderr(),
|
||||
&mut stderr,
|
||||
stdin,
|
||||
)?;
|
||||
Ok::<_, std::io::Error>((output.output, diagnostic.matched()))
|
||||
@@ -366,11 +370,14 @@ fn decode_auth_output(output: std::process::Output, rendering_failure: bool) ->
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::os_profile::{ClientOs, OsProfileBuilder};
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
#[cfg(windows)]
|
||||
use std::os::windows::process::ExitStatusExt;
|
||||
|
||||
#[test]
|
||||
fn server_tls_result_survives_process_decoding_as_a_typed_error() {
|
||||
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let output = std::process::Output {
|
||||
status: std::process::ExitStatus::from_raw(0),
|
||||
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com:8443","kind":"certificate"}}"#.to_vec(),
|
||||
@@ -389,7 +396,6 @@ mod tests {
|
||||
#[test]
|
||||
fn client_certificate_required_result_survives_process_decoding() {
|
||||
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let output = std::process::Output {
|
||||
status: std::process::ExitStatus::from_raw(0),
|
||||
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com","kind":"clientCertificateRequired"}}"#.to_vec(),
|
||||
@@ -549,11 +555,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn failed_authenticator_discards_partial_or_valid_stdout_before_decoding() {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
#[cfg(unix)]
|
||||
let status = std::process::ExitStatus::from_raw(71 << 8);
|
||||
#[cfg(windows)]
|
||||
let status = std::process::ExitStatus::from_raw(0xC0000005);
|
||||
for stdout in [b"{partial".to_vec(), br#"{"cancelled":null}"#.to_vec()] {
|
||||
let error = decode_auth_output(
|
||||
std::process::Output {
|
||||
status: std::process::ExitStatus::from_raw(71 << 8),
|
||||
status,
|
||||
stdout,
|
||||
stderr: Vec::new(),
|
||||
},
|
||||
@@ -566,7 +575,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn successful_malformed_auth_output_is_not_a_rendering_crash() {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let error = decode_auth_output(
|
||||
std::process::Output {
|
||||
status: std::process::ExitStatus::from_raw(0),
|
||||
@@ -580,6 +588,7 @@ mod tests {
|
||||
assert_eq!(error.to_string(), "Failed to parse auth data");
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn custom_authenticator_crash_does_not_request_recovery() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
@@ -615,8 +624,11 @@ mod tests {
|
||||
std::fs::write(&custom, "custom").unwrap();
|
||||
assert!(is_bundled_authenticator(&bundled, &bundled));
|
||||
assert!(!is_bundled_authenticator(&custom, &bundled));
|
||||
let alias = directory.path().join("auth-alias");
|
||||
std::os::unix::fs::symlink(&bundled, &alias).unwrap();
|
||||
assert!(is_bundled_authenticator(&alias, &bundled));
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let alias = directory.path().join("auth-alias");
|
||||
std::os::unix::fs::symlink(&bundled, &alias).unwrap();
|
||||
assert!(is_bundled_authenticator(&alias, &bundled));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user