mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
fix: improve authentication recovery and diagnostics
Recognize real GTK Wayland crash messages and keep remote authentication prompts readable. Preserve device identifiers without initializing OpenSSL, validate diagnostic executable paths, and improve release automation. Fixes #669
This commit is contained in:
15 files changed
+294
-15
No files matched your search
@@ -130,13 +130,17 @@ if [ "$os" = Darwin ]; then
|
||||
[ -n "$auth_path" ] || { [ ! -x "$bundle/Helpers/gpauth" ] || auth_path=$bundle/Helpers/gpauth; }
|
||||
[ -n "$gui_path" ] || { [ ! -d "$bundle" ] || { gui_path=$bundle/MacOS/gpgui; gui_bundle=$bundle; }; }
|
||||
fi
|
||||
is_executable_file() { [ -f "$1" ] && [ -x "$1" ]; }
|
||||
is_executable_file "$client_path" || client_path=
|
||||
is_executable_file "$auth_path" || auth_path=
|
||||
is_executable_file "$gui_path" || gui_path=
|
||||
for component in gpclient gpauth gpgui; do
|
||||
case "$component" in gpclient) location=$client_path ;; gpauth) location=$auth_path ;; gpgui) location=$gui_path ;; esac
|
||||
if [ -n "$location" ]; then emit "${component}_path" ok "$location"; else emit "${component}_path" unavailable ''; fi
|
||||
done
|
||||
if [ -n "$client_version" ]; then emit gpclient_version ok "$client_version"; elif [ -n "$client_path" ]; then field_probe gpclient_version "$client_path" --version; else emit gpclient_version unavailable ''; fi
|
||||
if [ -n "$auth_path" ]; then field_probe gpauth_version "$auth_path" --version; else emit gpauth_version unavailable ''; fi
|
||||
if [ "$os" = Darwin ] && [ -n "$gui_bundle" ]; then
|
||||
if [ "$os" = Darwin ] && [ -n "$gui_path" ] && [ -n "$gui_bundle" ]; then
|
||||
field_probe gpgui_version /usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$gui_bundle/Info.plist"
|
||||
else
|
||||
emit gpgui_version unavailable ''
|
||||
|
||||
@@ -95,6 +95,8 @@ cat > "$fixtures/bin/pkg_info" <<'MOCK'
|
||||
printf '%s\n' 'webkitgtk41-2.52.6 WebKitGTK browser engine' 'gtk+3-3.24.52 GTK3 toolkit' 'sway-1.11 Wayland compositor' 'private-package-1.0 Do not collect'
|
||||
MOCK
|
||||
chmod +x "$fixtures/bin/"*
|
||||
mkdir "$fixtures/home[regex]"
|
||||
ln -s "$fixtures/bin/gpclient" "$fixtures/home[regex]/gpclient"
|
||||
run() {
|
||||
env PATH="$fixtures/bin" HOME="$fixtures/home[regex]" TMPDIR="$fixtures" \
|
||||
TEST_OS="$1" TEST_PROBE="${2:-}" TEST_CHILD_PID="$fixtures/child.pid" \
|
||||
@@ -132,6 +134,23 @@ assert_contains "gpgui_path: ok: $fixtures/bin/gpgui"
|
||||
assert_contains 'gpgui_version: unavailable:'
|
||||
[ ! -e "$fixtures/gui-launched" ]
|
||||
printf '%s\n' 'PASS: nonbundle GUI path never borrows another installed app version'
|
||||
mkdir "$fixtures/not-a-file"
|
||||
printf '#!/bin/sh\nexit 0\n' > "$fixtures/not-executable"
|
||||
chmod 644 "$fixtures/not-executable"
|
||||
ln -s "$fixtures/missing" "$fixtures/broken-link"
|
||||
for os in Linux FreeBSD OpenBSD Darwin; do
|
||||
for invalid in missing not-a-file not-executable broken-link; do
|
||||
env PATH="$fixtures/bin" TEST_OS="$os" TEST_GUI_MARKER="$fixtures/gui-launched" \
|
||||
sh "$collector" --client-path "$fixtures/$invalid" \
|
||||
--auth-path "$fixtures/$invalid" --gui-path "$fixtures/$invalid" > "$fixtures/report"
|
||||
for component in gpclient gpauth gpgui; do
|
||||
assert_contains "${component}_path: unavailable:"
|
||||
assert_contains "${component}_version: unavailable:"
|
||||
done
|
||||
done
|
||||
done
|
||||
[ ! -e "$fixtures/gui-launched" ]
|
||||
printf '%s\n' 'PASS: missing files, directories, nonexecutables and broken links are unavailable on all platforms'
|
||||
# Successful probes must cancel their watchdog before doing any process-tree
|
||||
# traversal. A slow snapshot used to let a finished probe become timed_out.
|
||||
mv "$fixtures/bin/ps" "$fixtures/real-ps"
|
||||
|
||||
Reference in new issue
Block a user