[X2Go-Commits] [x2goclient] 01/142: ssh{process, masterconnection}.cpp: run bash as a login shell when invoking any command remotely. Fixes: #928.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 14 05:09:47 CET 2016


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

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 256e30d47178a7d4c8f8e25317d60a4fca673a3d
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Thu Jan 14 03:16:49 2016 +0100

    ssh{process,masterconnection}.cpp: run bash as a login shell when invoking any command remotely. Fixes: #928.
    
    Because this opens the door for ~/.bash_logout and friend scripts to be
    executed, which may contain calls to ncurses' reset or clear, also set
    the TERM variable to dump to not have unexpected output on stderr at
    logout time.
---
 debian/changelog            |    8 ++++++++
 src/sshmasterconnection.cpp |    2 +-
 src/sshprocess.cpp          |    6 +++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7cee1e5..a3d37fa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,14 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low
     - Windows: Update bundled Win32 OpenSSL from 1.0.1p to 1.0.1q,
       which fixes the multiple CVEs announced on 2015-12-03.
 
+  [ Orion Poplawski ]
+  * New upstream release (4.0.5.1):
+    - ssh{process,masterconnection}.cpp: run bash as a login shell when
+      invoking any command remotely. Fixes: #928. Because this opens the door
+      for ~/.bash_logout and friend scripts to be executed, which may contain
+      calls to ncurses' reset or clear, also set the TERM variable to dump to
+      not have unexpected output on stderr at logout time.
+
  -- X2Go Release Manager <git-admin at x2go.org>  Tue, 28 Jul 2015 06:05:27 +0200
 
 x2goclient (4.0.5.0-0x2go1) unstable; urgency=low
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 78d4564..9aecdbf 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -1151,7 +1151,7 @@ bool SshMasterConnection::userAuthKrb()
      * as there is no preceding "outer double quote" the whole argument
      * is wrapped in.
      */
-    QString shcmd = "bash -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; whoami; echo \"X2GODATAEND:" + uuidStr + "\";'";
+    QString shcmd = "bash -l -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; export TERM=\"dumb\"; whoami; echo \"X2GODATAEND:" + uuidStr + "\";'";
 
     QString local_cmd = "";
     QStringList local_args;
diff --git a/src/sshprocess.cpp b/src/sshprocess.cpp
index 4866c2b..aa2dc6b 100644
--- a/src/sshprocess.cpp
+++ b/src/sshprocess.cpp
@@ -200,8 +200,8 @@ void SshProcess::startNormal(const QString& cmd)
 // #endif
     if(!masterCon->useKerberos())
     {
-        QString shcmd = "bash -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\"; "+cmd+"; echo \"X2GODATAEND:" + uuidStr + "\";'";
-        x2goDebug << "Running masterCon->addChannelConnection(this, '" << uuidStr << "', '" << shcmd.left (200) << "');";
+        QString shcmd = "bash -l -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\"; export TERM=\"dumb\"; "+cmd+"; echo \"X2GODATAEND:" + uuidStr + "\";'";
+        x2goDebug << "this="<<this<<" Running masterCon->addChannelConnection(this, '" << uuidStr << "', '" << shcmd.left (200) << "');";
         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)));
@@ -222,7 +222,7 @@ void SshProcess::startNormal(const QString& cmd)
          * as there is no preceding "outer double quote" the whole argument
          * is wrapped in.
          */
-        shcmd = "bash -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\"; "+cmd+"; echo \"X2GODATAEND:" + uuidStr + "\";'";
+        shcmd = "bash -l -c 'echo \"X2GODATABEGIN:" + uuidStr + "\"; export PATH=\"/usr/local/bin:/usr/bin:/bin\"; export TERM=\"dumb\"; "+cmd+"; echo \"X2GODATAEND:" + uuidStr + "\";'";
 
         proc=new QProcess(this);
         QString local_cmd = "";

--
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