[X2Go-Commits] [x2goclient] 02/05: sshmasterconnection.{cpp, h}: support variable number of challenge-auth-code-based prompts.

git-admin at x2go.org git-admin at x2go.org
Fri Jan 29 00:58:11 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 104054813f4094c38ec79a7ba20dbad34d421346
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Jan 29 00:46:44 2016 +0100

    sshmasterconnection.{cpp,h}: support variable number of challenge-auth-code-based prompts.
---
 debian/changelog            |    2 ++
 src/sshmasterconnection.cpp |   20 ++++++++++++++++++--
 src/sshmasterconnection.h   |    2 ++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 879a379..7e6ffd4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,8 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low
     - sshmasterconnection.cpp: let challenge-auth-based login attempts
       fallback to normal password authentication if the initial
       challenge-auth-based attempt was unsuccessful.
+    - sshmasterconnection.{cpp,h}: support variable number of
+      challenge-auth-code-based prompts.
   * debian/control:
     - Change apache2-dev | libc6-dev build dependency back to apache2-dev
       only. Otherwise, apache2-dev is not installed at all, even though
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 942b374..0819822 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -55,6 +55,10 @@
 
 static bool isLibSshInited=false;
 
+const QString SshMasterConnection::challenge_auth_code_prompts_[] = {
+  "Verification code:"
+};
+
 
 #ifdef Q_OS_WIN
 #include <QSettings>
@@ -874,8 +878,20 @@ bool SshMasterConnection::userChallengeAuth()
                 ssh_userauth_kbdint_setanswer(my_ssh_session,0,pass.toAscii());
                 return userChallengeAuth();
             }
-            if(pr=="Verification code: ")
-            {
+
+            bool has_challenge_auth_code_prompt = false;
+            const std::size_t challenge_auth_code_prompts_size = (sizeof (challenge_auth_code_prompts_)/sizeof (*challenge_auth_code_prompts_));
+
+            for (std::size_t i = 0; i < challenge_auth_code_prompts_size; ++i) {
+                x2goDebug << "Checking against known prompt #" << i << ": " << challenge_auth_code_prompts_[i] << endl;
+
+                if (pr == challenge_auth_code_prompts_[i]) {
+                    has_challenge_auth_code_prompt = true;
+                    break;
+                }
+            }
+
+            if (has_challenge_auth_code_prompt) {
 #ifdef DEBUG
                 x2goDebug<<"Verification code request"<<endl;
 #endif
diff --git a/src/sshmasterconnection.h b/src/sshmasterconnection.h
index d721eff..0136ac4 100644
--- a/src/sshmasterconnection.h
+++ b/src/sshmasterconnection.h
@@ -198,6 +198,8 @@ private:
     bool challengeAuthPasswordAccepted;
     QString challengeAuthVerificationCode;
 
+    static const QString challenge_auth_code_prompts_[];
+
 signals:
     void stdErr(SshProcess* caller, QByteArray data);
     void stdOut(SshProcess* caller, QByteArray data);

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list