[plasma/ksshaskpass] src: prompt: Fix password change prompts

Kai Uwe Broulik <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 70934ca298d57b1e1f33481d47f865c32963ca19 by Kai Uwe Broulik.
Committed on 17/08/2026 at 14:09.
Pushed by broulik into branch 'master'.

prompt: Fix password change prompts

The PAM regexp was too greedy, matching "retype user's new password"
and friends.

Amends commit 97878893

M  +9    -1    src/main.cpp

https://invent.kde.org/plasma/ksshaskpass/-/commit/70934ca298d57b1e1f33481d47f865c32963ca19

diff --git a/src/main.cpp b/src/main.cpp
index a7bc851..a901d59 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -62,8 +62,16 @@ static void parsePrompt(PromptType promptType, const QString &prompt, QString &i
 
     // openssh sshconnect2.c
     // Case: password for authentication on remote ssh server
+    match = QRegularExpression(QStringLiteral("^(.*@.*)'s password: $")).match(prompt);
+    if (match.hasMatch()) {
+        identifier = match.captured(1);
+        displayType = DisplayType::Password;
+        ignoreKeychain = false;
+        return;
+    }
+
     // Case: password for authentication on remote ssh server, also supports PAM format
-    match = QRegularExpression(QStringLiteral("^\\(?(.*@.*?)\\)?('s)? [pP]assword: $")).match(prompt);
+    match = QRegularExpression(QStringLiteral("^\\((.*@.*)\\) Password: $")).match(prompt);
     if (match.hasMatch()) {
         identifier = match.captured(1);
         displayType = DisplayType::Password;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.