Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/2.1.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yuezk committed Mar 29, 2024
2 parents e69de98 + b2ca82e commit d97b3ba
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 15 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main
- dev
- hotfix/*
- feature/*
- release/*
tags:
- latest
- v*.*.*
Expand Down Expand Up @@ -42,6 +45,7 @@ jobs:
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/GlobalProtect-openconnect
ref: ${{ github.ref }}
path: source/gp
- name: Create tarball
run: |
Expand Down Expand Up @@ -114,12 +118,14 @@ jobs:
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/GlobalProtect-openconnect
ref: ${{ github.ref }}
path: gpgui-source/gp
- name: Checkout gpgui
- name: Checkout gpgui@${{ github.ref_name }}
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
repository: yuezk/gpgui
ref: ${{ github.ref_name }}
path: gpgui-source/gpgui
- name: Tarball
run: |
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = ["crates/*", "apps/gpclient", "apps/gpservice", "apps/gpauth", "apps/g

[workspace.package]
rust-version = "1.70"
version = "2.1.1"
version = "2.1.2"
authors = ["Kevin Yue <[email protected]>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion apps/gpclient/src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl<'a> ConnectHandler<'a> {
}

async fn connect_gateway_with_prelogin(&self, gateway: &str) -> anyhow::Result<()> {
info!("Treat the portal as the gateway, connecting...");
info!("Performing the gateway authentication...");

let mut gp_params = self.build_gp_params();
gp_params.set_is_gateway(true);
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.1.2 - 2024-03-29

- Treat portal as gateway when the gateway login is failed (fix #338)

## 2.1.1 - 2024-03-25

- Add the `--hip` option to enable HIP report
Expand Down
4 changes: 2 additions & 2 deletions crates/gpapi/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pub enum PortalError {
PreloginError(String),
#[error("Portal config error: {0}")]
ConfigError(String),
#[error("Gateway error: {0}")]
GatewayError(String),
#[error("Network error: {0}")]
NetworkError(String),
}
2 changes: 1 addition & 1 deletion crates/gpapi/src/gateway/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub async fn gateway_login(gateway: &str, cred: &Credential, gp_params: &GpParam
.form(&params)
.send()
.await
.map_err(|e| anyhow::anyhow!(PortalError::GatewayError(e.to_string())))?;
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;

let status = res.status();

Expand Down
7 changes: 6 additions & 1 deletion crates/gpapi/src/portal/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ pub async fn retrieve_config(portal: &str, cred: &Credential, gp_params: &GpPara

info!("Portal config, user_agent: {}", gp_params.user_agent());

let res = client.post(&url).form(&params).send().await?;
let res = client
.post(&url)
.form(&params)
.send()
.await
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
let status = res.status();

if status == StatusCode::NOT_FOUND {
Expand Down
7 changes: 6 additions & 1 deletion crates/gpapi/src/portal/prelogin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ pub async fn prelogin(portal: &str, gp_params: &GpParams) -> anyhow::Result<Prel
.user_agent(user_agent)
.build()?;

let res = client.post(&prelogin_url).form(&params).send().await?;
let res = client
.post(&prelogin_url)
.form(&params)
.send()
.await
.map_err(|e| anyhow::anyhow!(PortalError::NetworkError(e.to_string())))?;
let status = res.status();

if status == StatusCode::NOT_FOUND {
Expand Down

0 comments on commit d97b3ba

Please sign in to comment.