[X2Go-Commits] [x2goclient] 05/05: Fix quotes when calling remote commands via SSH. Use single backslash to quote quotation marks. (Fixes: #720).

git-admin at x2go.org git-admin at x2go.org
Fri Jan 9 21:34:24 CET 2015


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

x2go pushed a commit to branch master
in repository x2goclient.

commit 89105aa63ae77a40327fa680bc71e852957911c5
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jan 9 21:34:13 2015 +0100

    Fix quotes when calling remote commands via SSH. Use single backslash to quote quotation marks. (Fixes: #720).
---
 debian/changelog        |    2 ++
 httpbrokerclient.cpp    |    4 ++--
 sshmasterconnection.cpp |    2 +-
 sshprocess.cpp          |    4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3e67cf4..f16eca7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ x2goclient (4.0.3.2-0x2go1) UNRELEASED; urgency=medium
     - Fix string concatenation/layout of error message when tunnel I/O errors
       occur.
     - Improve debugging/logging the SSH connections made by X2Go Client.
+    - Fix quotes when calling remote commands via SSH. Use single backslash
+      to quote quotation marks. (Fixes: #720).
 
   [ Jason Alavaliant ]
   * New upstream verson (4.0.3.2):
diff --git a/httpbrokerclient.cpp b/httpbrokerclient.cpp
index 736f5e7..5f009d4 100644
--- a/httpbrokerclient.cpp
+++ b/httpbrokerclient.cpp
@@ -302,10 +302,10 @@ void HttpBrokerClient::selectUserSession(const QString& session)
     else
     {
         if (nextAuthId.length() > 0) {
-            sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+nextAuthId+ " --task selectsession --sid \\\""+session+"\\\"",
+            sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --authid "+nextAuthId+ " --task selectsession --sid \""+session+"\"",
                                             this,SLOT ( slotSelectSession(bool,QString,int)));
         } else {
-            sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --task selectsession --sid \\\""+session+"\\\"",
+            sshConnection->executeCommand ( config->sshBrokerBin+" --user "+ brokerUser +" --task selectsession --sid \""+session+"\"",
                                             this,SLOT ( slotSelectSession(bool,QString,int)));
         }
     }
diff --git a/sshmasterconnection.cpp b/sshmasterconnection.cpp
index 9ad8c1f..b09f04f 100755
--- a/sshmasterconnection.cpp
+++ b/sshmasterconnection.cpp
@@ -1139,7 +1139,7 @@ bool SshMasterConnection::userAuthKrb()
     QUuid uuid = QUuid::createUuid();
     QString uuidStr = uuid.toString().mid(1, 36).toLower();
 
-    QString shcmd = " echo X2GODATABEGIN:" + uuidStr + "; whoami; echo X2GODATAEND:" + uuidStr ;
+    QString shcmd = "sh -c 'echo X2GODATABEGIN:" + uuidStr + "; whoami; echo X2GODATAEND:" + uuidStr +";'";
 
 #ifdef Q_OS_WIN
     sshCmd="plink -batch "+user+"@"+host+" -P "+
diff --git a/sshprocess.cpp b/sshprocess.cpp
index 451425f..f605eb9 100755
--- a/sshprocess.cpp
+++ b/sshprocess.cpp
@@ -190,7 +190,7 @@ void SshProcess::startNormal(const QString& cmd)
 // #endif
     if(!masterCon->useKerberos())
     {
-        QString shcmd = "sh -c \"echo X2GODATABEGIN:" + uuidStr + "; PATH=/usr/local/bin:/usr/bin:/bin "+cmd+"; echo X2GODATAEND:" + uuidStr +"\";";
+        QString shcmd = "sh -c 'echo X2GODATABEGIN:" + uuidStr + "; PATH=/usr/local/bin:/usr/bin:/bin "+cmd+"; echo X2GODATAEND:" + uuidStr +";'";
         masterCon->addChannelConnection(this, uuidStr, shcmd);
         connect(masterCon,SIGNAL(stdOut(SshProcess*,QByteArray)),this,SLOT(slotStdOut(SshProcess*,QByteArray)));
         connect(masterCon,SIGNAL(channelClosed(SshProcess*,QString)), this,SLOT(slotChannelClosed(SshProcess*,QString)));
@@ -198,7 +198,7 @@ void SshProcess::startNormal(const QString& cmd)
     else
     {
         QString host=masterCon->getHost();
-        QString shcmd = "echo X2GODATABEGIN:" + uuidStr + "; PATH=/usr/local/bin:/usr/bin:/bin "+cmd+"; echo X2GODATAEND:" + uuidStr;
+        QString shcmd = "sh -c 'echo X2GODATABEGIN:" + uuidStr + "; PATH=/usr/local/bin:/usr/bin:/bin "+cmd+"; echo X2GODATAEND:" + uuidStr +";'";
         proc=new QProcess(this);
 #ifdef Q_OS_WIN
         if(masterCon->get_kerberosDelegation())

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


More information about the x2go-commits mailing list