fix(credentials): run sudo without a password when the account has none

A passwordless sudo setup (NOPASSWD, or an account without a password) was
still asked for a password: leaving the field empty never satisfied the gate,
so the dialog reopened and the operation could not run at all.

The gate now asks sudo itself (`sudo -n true`) and lets the request through
when it needs nothing, privileged commands fall back to `sudo -n` when no
password is held, and an empty field cancels instead of looping. Releasing the
lock records its own pending request so an answered prompt is replayed rather
than lost.
This commit is contained in:
BlackAngelTV committed 2026-11-11 18:49:55 +01:00
1 parent d27792975e
commit 97d99c63a2
9 files changed
+131 -24

No files matched your search

+2 -1
View File
@@ -145,7 +145,8 @@ private:
// it needs before replaying it.
void handleStartResult(const AppCore::StartResult& result, const QString& title);
// Asks for the sudo password and hands it to the core. Returns false when
// the user cancelled.
// the user cancelled — or left the field empty while sudo requires one,
// which would only reopen the same dialog.
bool promptForSudoPassword();
// Names the process holding pacman's database and offers to close it — or to
// drop a stale lock — so the pending action can resume.