This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from 5be62d3 onmainwindow.cpp: don't terminate if scdaemon exited with non-zero exit code. new 1f7f014 sshprocess.cpp: don't use QProcess::start (QString). new 3b04b53 sshprocess.cpp: add a bit more debugging - also print out the unmodified raw output of SSH commands. new cbab95c onmainwindow.cpp: remove now-bogus double quote escaping. new 6b163ca sshmasterconnection.cpp: port QProcess::start () change. new fadc705 sshprocess.cpp: whitespace/prettify only and a compile fix. The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 13 +++++++++ src/onmainwindow.cpp | 15 ---------- src/sshmasterconnection.cpp | 52 +++++++++++++++++++++++++++------ src/sshprocess.cpp | 67 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 113 insertions(+), 34 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 1f7f0144459f935621716ac03c3812755a31fc08 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jun 11 03:27:56 2015 +0200 sshprocess.cpp: don't use QProcess::start (QString). Qt is trying to be too smart and causes big trouble. Instead, use QProcess::start (QString, QStringList) and pass the arguments as a list. On Windows, Qt will automatically double quote the arguments and duplicate escaped double quotes or escape non-escaped double quotes. On UNIX-like platforms, each element of the list is passed as a unique argv element, so there's no need for quoting them (that's only a shell-internal thing to group arguments.) --- debian/changelog | 8 +++++++ src/sshprocess.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index ec86448..21eeb1c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -50,6 +50,14 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low valid C string representation for tr (). - onmainwindow.cpp: don't terminate if scdaemon exited with non-zero exit code. + - sshprocess.cpp: don't use QProcess::start (QString). Qt is trying to be + too smart and causes big trouble. Instead, use QProcess::start (QString, + QStringList) and pass the arguments as a list. On Windows, Qt will + automatically double quote the arguments and duplicate escaped double + quotes or escape non-escaped double quotes. On UNIX-like platforms, each + element of the list is passed as a unique argv element, so there's no + need for quoting them (that's only a shell-internal thing to group + arguments.) -- X2Go Release Manager <git-admin@x2go.org> Tue, 26 May 2015 21:42:09 +0200 diff --git a/src/sshprocess.cpp b/src/sshprocess.cpp index 8e8c4e5..03bf271 100644 --- a/src/sshprocess.cpp +++ b/src/sshprocess.cpp @@ -200,7 +200,7 @@ 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 +"\";'"; + 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) << "');"; masterCon->addChannelConnection(this, uuidStr, shcmd); connect(masterCon,SIGNAL(stdOut(SshProcess*,QByteArray)),this,SLOT(slotStdOut(SshProcess*,QByteArray))); @@ -210,30 +210,74 @@ void SshProcess::startNormal(const QString& cmd) { QString host=masterCon->getHost(); - QString shcmd = "bash -c 'echo \\\"X2GODATABEGIN:" + uuidStr + "\\\"; export PATH=\\\"/usr/local/bin:/usr/bin:/bin\\\"; "+cmd+"; echo \\\"X2GODATAEND:" + uuidStr +"\\\";'"; + QString shcmd = ""; + + /* On Windows, arguments are automatically wrapped in double quotes. + * Additionally, QProcess automatically doubles escape characters before + * double quotes and inserts an escape character before any non-escaped + * double quotes. + * Thus, we don't escape double quotes here and let Qt handle this stuff. + * + * On UNIX-like platforms, likewise, we MUST NOT escape double quotes, + * 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 + "\";'"; proc=new QProcess(this); + QString local_cmd = ""; + QStringList local_args; #ifdef Q_OS_WIN if(masterCon->get_kerberosDelegation()) { addPuttyReg(host, uuidStr); host = uuidStr; } - QString sshString="plink -batch -P "+ + local_cmd = "plink"; + + /* General options. */ + local_args << "-batch"; + + /* Port option. Must be the last one added! */ + local_args << "-P"; #else - QString krbDelegOption=" -k "; + local_cmd = "ssh"; + + /* General options. */ + local_args << QString (KEEPALIVE_OPTION).trimmed ().split (" "); + + /* Kerberos options. */ + local_args << "-k"; if(masterCon->get_kerberosDelegation()) { - krbDelegOption=" -K "; + local_args << "-K"; } - QString sshString=QString::null+"ssh"+ KEEPALIVE_OPTION +krbDelegOption+" -o GSSApiAuthentication=yes -o PasswordAuthentication=no -o PubkeyAuthentication=no -p "+ -#endif - QString::number(masterCon->getPort())+" -l "+ - masterCon->getUser()+" "+ host + " \""+shcmd+"\""; - x2goDebug<<"Evoking SSH command via SshProcess object "<<pid<<": "<<sshString; + /* Authentication options. */ + local_args << "-o" << "GSSApiAuthentication=yes"; + local_args << "-o" << "PasswordAuthentication=no"; + local_args << "-o" << "PubkeyAuthentication=no"; + + /* Port option. Must be the last one added! */ + local_args << "-p"; +#endif + local_args << QString::number (masterCon->getPort ()); + local_args << "-l" << masterCon->getUser (); + local_args << host; + + /* On Windows, arguments are automatically wrapped in double quotes. + * This means we do not have to wrap shcmd ourselves. + * + * On UNIX-like platforms, we likewise MUST NOT wrap the command in + * double quotes, as each entry in the arguments list is passed as + * one entry in argv. + */ + local_args << shcmd; + + x2goDebug << "Invoking SSH command via SshProcess object " << pid<< ": " + << local_cmd << local_args.join (" "); procUuid=uuidStr; - proc->start(sshString); + proc->start (local_cmd, local_args); if (!proc->waitForStarted(15000)) { -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 3b04b53b4ef0eb7b26194f8f8ef715aa739e687e Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jun 11 03:30:36 2015 +0200 sshprocess.cpp: add a bit more debugging - also print out the unmodified raw output of SSH commands. --- debian/changelog | 2 ++ src/sshprocess.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index 21eeb1c..0baa7b8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,6 +58,8 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low element of the list is passed as a unique argv element, so there's no need for quoting them (that's only a shell-internal thing to group arguments.) + - sshprocess.cpp: add a bit more debugging - also print out the unmodified + raw output of SSH commands. -- X2Go Release Manager <git-admin@x2go.org> Tue, 26 May 2015 21:42:09 +0200 diff --git a/src/sshprocess.cpp b/src/sshprocess.cpp index 03bf271..271ef01 100644 --- a/src/sshprocess.cpp +++ b/src/sshprocess.cpp @@ -514,6 +514,7 @@ void SshProcess::slotChannelClosed(SshProcess* creator, QString uuid) int output_begin=stdOutString.indexOf(begin_marker) + begin_marker.length(); int output_end=stdOutString.indexOf(end_marker); output = stdOutString.mid(output_begin, output_end-output_begin); + x2goDebug << "SSH finished: raw output (stdout): " << stdOutString; if ( output.length()<=0 && stdErrString.length() >0 ) { normalExited=false; -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit cbab95c6334d9440988b66b557ba009ccc76dd3d Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jun 11 03:32:15 2015 +0200 onmainwindow.cpp: remove now-bogus double quote escaping. --- debian/changelog | 1 + src/onmainwindow.cpp | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0baa7b8..16df554 100644 --- a/debian/changelog +++ b/debian/changelog @@ -60,6 +60,7 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low arguments.) - sshprocess.cpp: add a bit more debugging - also print out the unmodified raw output of SSH commands. + - onmainwindow.cpp: remove now-bogus double quote escaping. -- X2Go Release Manager <git-admin@x2go.org> Tue, 26 May 2015 21:42:09 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index f5e8984..c3b5df3 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -5056,11 +5056,6 @@ void ONMainWindow::slotRetResumeSess ( bool result, resumingSession.sessionId+ "/.pulse-client.conf\""; - /* Escape quotes - executing commands with Kerberos/GSSApi enabled adds another layer of quoting. */ - if (sshConnection->useKerberos ()) { - scmd.replace ('"', "\\\""); - } - sshConnection->executeCommand (scmd); bool sysPulse=false; @@ -5517,11 +5512,6 @@ void ONMainWindow::slotSetModMap() QString cmd = "export DISPLAY=\":" + resumingSession.display + "\"; echo \"" + kbMap + "\" | xmodmap -"; - /* Escape quotes - executing commands with Kerberos/GSSApi enabled adds another layer of quoting. */ - if (sshConnection->useKerberos ()) { - cmd.replace ('"', "\\\""); - } - sshConnection->executeCommand (cmd); } #endif @@ -6411,11 +6401,6 @@ void ONMainWindow::runApplication(QString exec) + resumingSession.display + " setsid " + exec + " 1> /dev/null 2>/dev/null & exit"; - /* Escape quotes - executing commands with Kerberos/GSSApi enabled adds another layer of quoting. */ - if (sshConnection->useKerberos ()) { - cmd.replace ('"', "\\\""); - } - sshConnection->executeCommand (cmd); } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 6b163ca1783a4c2e66a0f6dcc049d7c0a8599039 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jun 11 03:47:01 2015 +0200 sshmasterconnection.cpp: port QProcess::start () change. --- debian/changelog | 1 + src/sshmasterconnection.cpp | 52 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 16df554..79ef02d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -61,6 +61,7 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low - sshprocess.cpp: add a bit more debugging - also print out the unmodified raw output of SSH commands. - onmainwindow.cpp: remove now-bogus double quote escaping. + - sshmasterconnection.cpp: port QProcess::start () change. -- X2Go Release Manager <git-admin@x2go.org> Tue, 26 May 2015 21:42:09 +0200 diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index bae0410..78d4564 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -1137,25 +1137,61 @@ bool SshMasterConnection::userAuthWithKey() bool SshMasterConnection::userAuthKrb() { QProcess ssh; - QString sshCmd; QUuid uuid = QUuid::createUuid(); QString uuidStr = uuid.toString().mid(1, 36).toLower(); - QString shcmd = "sh -c 'echo X2GODATABEGIN:" + uuidStr + "; whoami; echo X2GODATAEND:" + uuidStr +";'"; + /* On Windows, arguments are automatically wrapped in double quotes. + * Additionally, QProcess automatically doubles escape characters before + * double quotes and inserts an escape character before any non-escaped + * double quotes. + * Thus, we don't escape double quotes here and let Qt handle this stuff. + * + * On UNIX-like platforms, likewise, we MUST NOT escape double quotes, + * 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 local_cmd = ""; + QStringList local_args; #ifdef Q_OS_WIN - sshCmd="plink -batch "+user+"@"+host+" -P "+ - QString::number(port)+ " "+shcmd; + local_cmd = "plink"; + + /* General options. */ + local_args << "-batch"; + + /* Port option. Must be the last one added! */ + local_args << "-P"; #else - sshCmd="ssh -o GSSApiAuthentication=yes "+user+"@"+host+" -p "+ - QString::number(port)+ " -o PasswordAuthentication=no -o PubkeyAuthentication=no "+shcmd; + local_cmd = "ssh"; + + /* Kerberos options. */ + local_args << "-o" << "GSSApiAuthentication=yes" + << "-o" << "PasswordAuthentication=no" + << "-o" << "PubkeyAuthentication=no"; + + /* Port option. Must be the last one added! */ + local_args << "-p"; #endif + local_args << QString::number (port) + << "-l" << user + << host; + + /* On Windows, arguments are automatically wrapped in double quotes. + * This means we do not have to wrap shcmd ourselves. + * + * On UNIX-like platforms, we likewise MUST NOT wrap the command in + * double quotes, as each entry in the arguments list is passed as + * one entry in argv. + */ + local_args << shcmd; #ifdef DEBUG - x2goDebug<<"Starting ssh:" <<sshCmd<<endl; + x2goDebug << "Starting ssh:" << local_cmd << " " << local_args.join (" ") << endl; #endif - ssh.start(sshCmd); + ssh.start (local_cmd, local_args); if (!ssh.waitForStarted(5000)) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit fadc7059aad55d70d1db2f0e382569bd61838588 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jun 11 03:48:46 2015 +0200 sshprocess.cpp: whitespace/prettify only and a compile fix. --- debian/changelog | 1 + src/sshprocess.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 79ef02d..067c09b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -62,6 +62,7 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low raw output of SSH commands. - onmainwindow.cpp: remove now-bogus double quote escaping. - sshmasterconnection.cpp: port QProcess::start () change. + - sshprocess.cpp: whitespace/prettify only and a compile fix. -- X2Go Release Manager <git-admin@x2go.org> Tue, 26 May 2015 21:42:09 +0200 diff --git a/src/sshprocess.cpp b/src/sshprocess.cpp index 271ef01..4866c2b 100644 --- a/src/sshprocess.cpp +++ b/src/sshprocess.cpp @@ -254,16 +254,16 @@ void SshProcess::startNormal(const QString& cmd) } /* Authentication options. */ - local_args << "-o" << "GSSApiAuthentication=yes"; - local_args << "-o" << "PasswordAuthentication=no"; - local_args << "-o" << "PubkeyAuthentication=no"; + local_args << "-o" << "GSSApiAuthentication=yes" + << "-o" << "PasswordAuthentication=no" + << "-o" << "PubkeyAuthentication=no"; /* Port option. Must be the last one added! */ local_args << "-p"; #endif - local_args << QString::number (masterCon->getPort ()); - local_args << "-l" << masterCon->getUser (); - local_args << host; + local_args << QString::number (masterCon->getPort ()) + << "-l" << masterCon->getUser () + << host; /* On Windows, arguments are automatically wrapped in double quotes. * This means we do not have to wrap shcmd ourselves. @@ -274,8 +274,8 @@ void SshProcess::startNormal(const QString& cmd) */ local_args << shcmd; - x2goDebug << "Invoking SSH command via SshProcess object " << pid<< ": " - << local_cmd << local_args.join (" "); + x2goDebug << "Invoking SSH command via SshProcess object " << pid << ": " + << local_cmd << " " << local_args.join (" "); procUuid=uuidStr; proc->start (local_cmd, local_args); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git