mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
Release 3.0.1
This commit is contained in:
14 files changed
+204
-43
No files matched your search
@@ -130,10 +130,7 @@ impl SamlAuthData {
|
||||
|
||||
Ok(auth_data)
|
||||
}
|
||||
Some(status) => Err(AuthDataParseError::Invalid(anyhow::anyhow!(
|
||||
"SAML auth status: {}",
|
||||
status
|
||||
))),
|
||||
Some(status) => Err(AuthDataParseError::AuthenticationFailed(status)),
|
||||
None => Err(AuthDataParseError::NotFound),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,17 @@ impl PortalError {
|
||||
pub enum AuthDataParseError {
|
||||
#[error("No auth data found")]
|
||||
NotFound,
|
||||
#[error("Authentication failed (SAML status: {0})")]
|
||||
AuthenticationFailed(String),
|
||||
#[error(transparent)]
|
||||
Invalid(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
impl AuthDataParseError {
|
||||
pub fn is_invalid(&self) -> bool {
|
||||
matches!(self, AuthDataParseError::Invalid(_))
|
||||
matches!(
|
||||
self,
|
||||
AuthDataParseError::Invalid(_) | AuthDataParseError::AuthenticationFailed(_)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -203,12 +203,20 @@ mod tests {
|
||||
let log_file = dir.path().join("desktop.log");
|
||||
fs::write(&log_file, "[gpservice] started\n").unwrap();
|
||||
let program = dir.path().join("gui");
|
||||
fs::write(&program, "#!/bin/sh\nprintf '[gpgui] initialized\\n' >&2\n").unwrap();
|
||||
fs::set_permissions(&program, fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let launcher = launcher(VERSION, vec![]).envs(HashMap::from([(
|
||||
"GP_LOG_FILE".to_owned(),
|
||||
log_file.to_str().unwrap().to_owned(),
|
||||
)]));
|
||||
let frame_len = launcher.credential.encode_frame().unwrap().len();
|
||||
// Consume the credential frame like the real GUI before exiting.
|
||||
fs::write(
|
||||
&program,
|
||||
format!(
|
||||
"#!/bin/sh\ndd bs=1 count={frame_len} of=/dev/null 2>/dev/null || exit 1\nprintf '[gpgui] initialized\\n' >&2\n"
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
fs::set_permissions(&program, fs::Permissions::from_mode(0o755)).unwrap();
|
||||
|
||||
assert!(launcher.launch_program(&program).await.unwrap().success());
|
||||
assert!(launcher.launch_program(&program).await.unwrap().success());
|
||||
|
||||
Reference in new issue
Block a user