From 9c8da0e6eac4c406588dd6bd4e332d9bbe09d250 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 22 Oct 2026 12:25:37 +0800 Subject: [PATCH] fix(linux): no false "Sorry, try again." in gtk sudo after a PAM info line The gtk sudo dialog takes the password before sudo starts and drops it when sudo prints a non-prompt line first, such as pam_fprintd's "Place your finger on the fingerprint reader". The real password prompt then came up labelled as a retry, "Sorry, try again.", although no password had been sent, so users took it as a rejected password. Treat the next prompt as a first prompt when the typed password is dropped. The dialog comes back prefilled and without the error. Keeping the password and sending it to the next prompt instead is not safe: when sudo authenticates without a prompt (fingerprint, NOPASSWD), use_pty, the default since sudo 1.9.14, holds the tty in raw mode while the command runs, so any output line ending in ':' would receive it. Fixes #16647 Co-Authored-By: Claude Opus 5.5 --- src/platform/gtk_sudo.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/platform/gtk_sudo.rs b/src/platform/gtk_sudo.rs index ccd7d8ace..b84d08c24 100644 --- a/src/platform/gtk_sudo.rs +++ b/src/platform/gtk_sudo.rs @@ -419,6 +419,7 @@ fn ui_parent( if !last_line.is_empty() && initial_password.is_some() { log::error!("received not empty line: {last_line}, clear initial password"); initial_password = None; + first = true; } } }