Compare commits

...

4 Commits

Author SHA1 Message Date
Kevin Yue
5c6a1c77f7 Fix the save credentials not working 2024-10-28 14:42:58 +00:00
Eric Dallo
511cc5ebd7 Fix flake.nix vpnc-script hardcoded path (#413) 2024-08-18 21:13:26 +08:00
Kevin Yue
30bec40338 Release 2.3.7 2024-08-16 01:34:19 +00:00
Kevin Yue
0bb9353a11 fix: build error with rust 1.80 2024-08-16 01:23:26 +00:00
5 changed files with 40 additions and 25 deletions

30
Cargo.lock generated
View File

@@ -570,7 +570,7 @@ dependencies = [
[[package]] [[package]]
name = "common" name = "common"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"is_executable", "is_executable",
] ]
@@ -1430,7 +1430,7 @@ dependencies = [
[[package]] [[package]]
name = "gpapi" name = "gpapi"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.21.5", "base64 0.21.5",
@@ -1465,7 +1465,7 @@ dependencies = [
[[package]] [[package]]
name = "gpauth" name = "gpauth"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -1486,7 +1486,7 @@ dependencies = [
[[package]] [[package]]
name = "gpclient" name = "gpclient"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -1508,7 +1508,7 @@ dependencies = [
[[package]] [[package]]
name = "gpgui-helper" name = "gpgui-helper"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -1526,7 +1526,7 @@ dependencies = [
[[package]] [[package]]
name = "gpservice" name = "gpservice"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
@@ -2426,6 +2426,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]] [[package]]
name = "num-integer" name = "num-integer"
version = "0.1.45" version = "0.1.45"
@@ -2549,7 +2555,7 @@ dependencies = [
[[package]] [[package]]
name = "openconnect" name = "openconnect"
version = "2.3.6" version = "2.3.7"
dependencies = [ dependencies = [
"cc", "cc",
"common", "common",
@@ -4143,12 +4149,13 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.31" version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa 1.0.10", "itoa 1.0.10",
"num-conv",
"powerfmt", "powerfmt",
"serde", "serde",
"time-core", "time-core",
@@ -4163,10 +4170,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.16" version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [ dependencies = [
"num-conv",
"time-core", "time-core",
] ]

View File

@@ -5,7 +5,7 @@ members = ["crates/*", "apps/gpclient", "apps/gpservice", "apps/gpauth", "apps/g
[workspace.package] [workspace.package]
rust-version = "1.70" rust-version = "1.70"
version = "2.3.6" version = "2.3.7"
authors = ["Kevin Yue <k3vinyue@gmail.com>"] authors = ["Kevin Yue <k3vinyue@gmail.com>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect" homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2021" edition = "2021"

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 2.3.7 - 2024-08-16
- Fix the Rust type inference regression [issue in 1.80](https://github.com/rust-lang/rust/issues/125319).
## 2.3.6 - 2024-08-15 ## 2.3.6 - 2024-08-15
- CLI: enhance the `gpauth` command to support external browser authentication - CLI: enhance the `gpauth` command to support external browser authentication

View File

@@ -111,11 +111,11 @@ impl AuthCookieCredential {
pub struct CachedCredential { pub struct CachedCredential {
username: String, username: String,
password: Option<String>, password: Option<String>,
auth_cookie: AuthCookieCredential, auth_cookie: Option<AuthCookieCredential>,
} }
impl CachedCredential { impl CachedCredential {
pub fn new(username: String, password: Option<String>, auth_cookie: AuthCookieCredential) -> Self { pub fn new(username: String, password: Option<String>, auth_cookie: Option<AuthCookieCredential>) -> Self {
Self { Self {
username, username,
password, password,
@@ -131,12 +131,12 @@ impl CachedCredential {
self.password.as_deref() self.password.as_deref()
} }
pub fn auth_cookie(&self) -> &AuthCookieCredential { pub fn auth_cookie(&self) -> Option<&AuthCookieCredential> {
&self.auth_cookie self.auth_cookie.as_ref()
} }
pub fn set_auth_cookie(&mut self, auth_cookie: AuthCookieCredential) { pub fn set_auth_cookie(&mut self, auth_cookie: AuthCookieCredential) {
self.auth_cookie = auth_cookie; self.auth_cookie = Some(auth_cookie);
} }
pub fn set_username(&mut self, username: String) { pub fn set_username(&mut self, username: String) {
@@ -150,11 +150,7 @@ impl CachedCredential {
impl From<PasswordCredential> for CachedCredential { impl From<PasswordCredential> for CachedCredential {
fn from(value: PasswordCredential) -> Self { fn from(value: PasswordCredential) -> Self {
Self::new( Self::new(value.username().to_owned(), Some(value.password().to_owned()), None)
value.username().to_owned(),
Some(value.password().to_owned()),
AuthCookieCredential::new("", "", ""),
)
} }
} }
#[derive(Debug, Serialize, Deserialize, Type, Clone)] #[derive(Debug, Serialize, Deserialize, Type, Clone)]
@@ -198,11 +194,16 @@ impl Credential {
Some(cred.prelogon_user_auth_cookie()), Some(cred.prelogon_user_auth_cookie()),
None, None,
), ),
// Use the empty string as the password if auth_cookie is present
Credential::Cached(cred) => ( Credential::Cached(cred) => (
cred.password(), if cred.auth_cookie.is_some() {
None
} else {
cred.password()
},
None, None,
Some(cred.auth_cookie.user_auth_cookie()), cred.auth_cookie.as_ref().map(|c| c.user_auth_cookie()),
Some(cred.auth_cookie.prelogon_user_auth_cookie()), cred.auth_cookie.as_ref().map(|c| c.prelogon_user_auth_cookie()),
None, None,
), ),
}; };

View File

@@ -42,6 +42,8 @@
overrideMain = {...}: { overrideMain = {...}: {
postPatch = '' postPatch = ''
substituteInPlace crates/common/src/vpn_utils.rs \
--replace-fail /etc/vpnc/vpnc-script ${pkgs.vpnc-scripts}/bin/vpnc-script
substituteInPlace crates/gpapi/src/lib.rs \ substituteInPlace crates/gpapi/src/lib.rs \
--replace-fail /usr/bin/gpclient $out/bin/gpclient \ --replace-fail /usr/bin/gpclient $out/bin/gpclient \
--replace-fail /usr/bin/gpservice $out/bin/gpservice \ --replace-fail /usr/bin/gpservice $out/bin/gpservice \