summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Feck <cfeck@kde.org>2017-02-18 01:09:35 (GMT)
committerChristoph Feck <cfeck@kde.org>2017-02-18 01:09:35 (GMT)
commit408c284f6a35694f7e6be76c3416b80f3ef7fdba (patch)
tree639742cf5d026cd278305545baa2f0c5afac465c
parentd809e952e0d98e3731400b957048d9d3563d2ee6 (diff)
Fix git ssh password detection
Investigation and patch by Idekel Santana. BUG: 376228 FIXED-IN: 5.9.3 Differential Revision: https://phabricator.kde.org/D4540
-rw-r--r--src/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9739ce9..ff7ff6f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -59,7 +59,16 @@ static void parsePrompt(const QString &prompt, QString& keyFile, bool& wrongPass
return;
}
- // Case 3: nothing matched; either it was called by some sort of a script with a custom prompt (i.e. not ssh-add), or
+ // Case 3: password extraction from git, see bug 376228
+ QRegularExpression re3("^(Password|Username) for (.*?)[:] $");
+ QRegularExpressionMatch match3 = re3.match(prompt);
+ if (match3.hasMatch()) {
+ keyFile = match3.captured(2);
+ wrongPassphrase = false;
+ return;
+ }
+
+ // Case 4: nothing matched; either it was called by some sort of a script with a custom prompt (i.e. not ssh-add), or
// strings we're looking for were broken. Issue a warning and continue without keyFile.
qCWarning(LOG_KSSHASKPASS) << "Unable to extract keyFile from phrase" << prompt;
}