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

+4
View File
@@ -157,6 +157,10 @@ public:
void setSudoPassword(const QString& password);
void clearSudoPassword();
bool hasSudoPassword() const;
// Whether the view has to ask for a password at all: a passwordless sudo
// (NOPASSWD, or an account without one) has nothing to answer, so the
// prompt is skipped and privileged operations run straight away.
bool sudoRequiresPassword() const;
// ---- History, logs, package details ----
void clearHistory();