[X2Go-Commits] [x2goclient] 02/02: Fix quotes when calling remote commands via SSH (esp. allow same quoting/ escaping style for libssh and openSSH+Krb based connections). (Fixes: #720).

git-admin at x2go.org git-admin at x2go.org
Fri Jan 9 21:41:53 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 a86676d05d21c91700500dea0f84a08b006cbfa7
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Jan 9 21:41:46 2015 +0100

    Fix quotes when calling remote commands via SSH (esp. allow same quoting/ escaping style for libssh and openSSH+Krb based connections). (Fixes: #720).
---
 debian/changelog        |    2 ++
 httpbrokerclient.cpp    |    4 ++--
 onmainwindow.cpp        |    9 +--------
 sshmasterconnection.cpp |    2 +-
 sshprocess.cpp          |    4 ++--
 5 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3e67cf4..21e06c5 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 (esp. allow same quoting/
+      escaping style for libssh and openSSH+Krb based connections). (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/onmainwindow.cpp b/onmainwindow.cpp
index baf69f7..ff50656 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -5445,14 +5445,7 @@ void ONMainWindow::slotSetModMap()
             }
         }
     }
-    if(sshConnection->useKerberos())
-    {
-        sshConnection->executeCommand("export DISPLAY=:"+resumingSession.display+"; echo '"+kbMap+"' | xmodmap -");
-    }
-    else
-    {
-        sshConnection->executeCommand("export DISPLAY=:"+resumingSession.display+"; echo \\\""+kbMap+"\\\" | xmodmap -");
-    }
+    sshConnection->executeCommand("export DISPLAY=:"+resumingSession.display+"; echo \""+kbMap+"\" | xmodmap -");
 }
 #endif
 
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