This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from 5a70b2d macbuild.sh: switch to bundling PulseAudio 12.2 since it's now available in MacPorts. new 517231b res/i18n/x2goclient_cs.ts: whitespace and other fixups. new 4806e62 src/x2goclient.cpp: change HTTP to HTTPS links where needed. new 74a54a1 src/x2goclient.cpp: do not spawn UNIX cleanup helper if arguments that let X2Go Client terminate right away have been passed. new 785d5f8 src/onmainwindow.{cpp,h}: remove left-over references to agentCheckTimer and slotCheckAgentProcess (). new 05ce22d src/onmainwindow.cpp: fix various broken qCritical () calls. new 0125db0 src/{onmainwindow.{cpp,h},{sshmasterconnection,help}.cpp}: let users control libssh debugging via the new parameters --libssh-debug and --libssh-packetlog. new 0764597 src/sshmasterconnection.cpp: drop DEBUG preprocessor conditional blocks. The 7 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 | 16 ++++ res/i18n/x2goclient_cs.ts | 48 +++++----- src/help.cpp | 6 ++ src/onmainwindow.cpp | 24 +++-- src/onmainwindow.h | 3 +- src/sshmasterconnection.cpp | 219 +++----------------------------------------- src/x2goclient.cpp | 89 ++++++++++++++---- 7 files changed, 150 insertions(+), 255 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/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 517231b21ec76c5502215a876e2493675aaf7058 Author: Mihai Moldovan <ionic@ionic.de> Date: Tue Mar 26 13:48:46 2019 +0100 res/i18n/x2goclient_cs.ts: whitespace and other fixups. --- debian/changelog | 1 + res/i18n/x2goclient_cs.ts | 48 ++++++++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/debian/changelog b/debian/changelog index 902c960..237405c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -42,6 +42,7 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium rules are really weird. - macbuild.sh: switch to bundling PulseAudio 12.2 since it's now available in MacPorts. + - res/i18n/x2goclient_cs.ts: whitespace and other fixups. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/res/i18n/x2goclient_cs.ts b/res/i18n/x2goclient_cs.ts index 5426671..a0630f0 100644 --- a/res/i18n/x2goclient_cs.ts +++ b/res/i18n/x2goclient_cs.ts @@ -614,7 +614,7 @@ Některá standardní umístění: <message> <location filename="../../src/exportdialog.cpp" line="51"/> <source>&share</source> - <translation>S&dílet</translation> + <translation>s&dílet</translation> </message> <message> <location filename="../../src/exportdialog.cpp" line="52"/> @@ -666,17 +666,17 @@ Některá standardní umístění: <message> <location filename="../../src/folderexplorer.cpp" line="81"/> <source>Rename Folder ...</source> - <translation>Přejmenovat složku</translation> + <translation>Přejmenovat složku ...</translation> </message> <message> <location filename="../../src/folderexplorer.cpp" line="82"/> <source>Change Icon ...</source> - <translation>Změnit ikonu</translation> + <translation>Změnit ikonu ...</translation> </message> <message> <location filename="../../src/folderexplorer.cpp" line="83"/> <source>Delete Folder ...</source> - <translation>Smazat složku</translation> + <translation>Smazat složku ...</translation> </message> <message> <location filename="../../src/folderexplorer.cpp" line="97"/> @@ -774,7 +774,7 @@ Některá standardní umístění: <message> <location filename="../../src/help.cpp" line="117"/> <source>Starts hidden (minimized to system tray where available.)</source> - <translation>Hlavní okno X2Go Client se spustí skryté (v oznamovací části hlavního panelu, pokud je k dispozici)</translation> + <translation>Hlavní okno X2Go Client se spustí skryté (v oznamovací části hlavního panelu, pokud je k dispozici.)</translation> </message> <message> <location filename="../../src/help.cpp" line="118"/> @@ -909,7 +909,7 @@ Některá standardní umístění: <message> <location filename="../../src/help.cpp" line="146"/> <source>Automatically launches the application(s) "app", "app2", ... on session start in Published Applications mode.</source> - <translation>Automaticky spustí aplikaci/aplikace "app","app2", ... při spuštění relace v režimu sdílených aplikací.</translation> + <translation>Automaticky spustí aplikaci/aplikace "app", "app2", ... při spuštění relace v režimu sdílených aplikací.</translation> </message> <message> <location filename="../../src/help.cpp" line="147"/> @@ -1206,7 +1206,8 @@ Hodnota hash veřejného klíče: </translation> <location filename="../../src/mediawidget.cpp" line="69"/> <source>Use SSH port forwarding to tunnel sound system connections through firewalls</source> - <translation>Tunelovat připojení zvukových systémů skrz SSH</translation> + <translation>Tunelovat připojení zvukových +systémů skrz SSH</translation> </message> <message> <location filename="../../src/mediawidget.cpp" line="71"/> @@ -2437,7 +2438,8 @@ Prosím zaktualizujte X2Go Server.</translation> <message> <location filename="../../src/onmainwindow.cpp" line="10611"/> <source>Unable to find the sftp-server binary. Neither bundled, nor found in $PATH nor additional directories.</source> - <translation>Nepoařilo se nalézt program sftp-server.</translation> + <translatorcomment>Please also specify the "bundled, $PATH, ..." stuff in the second sentence.</translatorcomment> + <translation type="unfinished">Nepoařilo se nalézt program sftp-server.</translation> </message> <message> <location filename="../../src/onmainwindow.cpp" line="10612"/> @@ -2534,7 +2536,8 @@ Je-li program sftp-server ve vašem systému nainstalován, vytvořte prosím ch <message> <location filename="../../src/onmainwindow.cpp" line="11272"/> <source>Error getting window geometry. (Did you close the window?)</source> - <translation>Nepodařilo se načíst vlastnosti okna.</translation> + <translatorcomment>Please keep/also translate the second sentence.</translatorcomment> + <translation type="unfinished">Nepodařilo se načíst vlastnosti okna.</translation> </message> <message> <location filename="../../src/onmainwindow.cpp" line="11498"/> @@ -2756,7 +2759,8 @@ používaným pro sdílení složek a tiskáren.</translation> <location filename="../../src/onmainwindow.cpp" line="12609"/> <source>SSH daemon failed to open the application's authorized_keys file.</source> - <translation>SSH službě se nezdařilo otevřít soubor autorizovanými klíči.</translation> + <translation>SSH službě se nezdařilo otevřít soubor +autorizovanými klíči.</translation> </message> <message> <location filename="../../src/onmainwindow.cpp" line="12650"/> @@ -2771,7 +2775,7 @@ authorized_keys file.</source> <message> <location filename="../../src/onmainwindow.cpp" line="12696"/> <source><br><b> Click this button <br> to restore toolbar </b><br></source> - <translation><br><b> Pro obnovení panelu nástrojů <br> klikněte na toto tlačítko </b><br></translation> + <translation><br><b> Pro obnovení panelu nástrojů <br> klikněte na toto tlačítko </b><br></translation> </message> <message> <location filename="../../src/onmainwindow.cpp" line="12976"/> @@ -2929,8 +2933,8 @@ kprinter lpr -P hp_laserjet</source> <translation>Prosím nastavte příkaz pro tisk. Příklady: - kprinter - lpr -P hp_laserjet</translation> +kprinter +lpr -P hp_laserjet</translation> </message> <message> <location filename="../../src/ui/printercmddialog.ui" line="46"/> @@ -2984,7 +2988,7 @@ Příklady: <message> <location filename="../../src/printercmddialog.cpp" line="51"/> <source><Path to gsprint.exe> -query -color</source> - <translation><cesta k gsprint.exe> -query -color</translation> + <translation><Cesta k gsprint.exe> -query -color</translation> </message> </context> <context> @@ -3030,8 +3034,8 @@ Příklady: <message> <location filename="../../src/pulsemanager.cpp" line="472"/> <source>Supposed to skip major version number. Something is wrong.</source> - <translatorcomment>This code block should never be executed I think...</translatorcomment> - <translation>Něco se pokazilo.</translation> + <translatorcomment>This code block should never be executed I think... || Yes, but please translate either way. Just because it should never be executed doesn't mean it WON't. Think stack corruptions and the like - that' why this message is included here.</translatorcomment> + <translation type="unfinished">Něco se pokazilo.</translation> </message> <message> <location filename="../../src/pulsemanager.cpp" line="486"/> @@ -3465,6 +3469,7 @@ Přepnout X2Go Client do skrytého režimu?</translation> <message> <location filename="../../src/sessionwidget.cpp" line="174"/> <source>RSA/DSA key:</source> + <translatorcomment>Remind me to change this in the source code, please. Since libssh now supports other types than RSA and DSA, we should probably rename this.</translatorcomment> <translation>SSH klíč:</translation> </message> <message> @@ -3507,7 +3512,7 @@ Přepnout X2Go Client do skrytého režimu?</translation> <message> <location filename="../../src/sessionwidget.cpp" line="227"/> <source>X2Go/X11 Desktop Sharing</source> - <translation>X2Go Desktop Sharing</translation> + <translation>X2Go/X11 Desktop Sharing</translation> </message> <message> <source>Connect to local desktop</source> @@ -3652,7 +3657,8 @@ Přepnout X2Go Client do skrytého režimu?</translation> <message> <location filename="../../src/settingswidget.cpp" line="64"/> <source>Custom</source> - <translation>Okno</translation> + <translatorcomment>Doesn't that mean window? Something's weird here... it refers to a custom window size.</translatorcomment> + <translation type="unfinished">Okno</translation> </message> <message> <location filename="../../src/settingswidget.cpp" line="66"/> @@ -3757,12 +3763,12 @@ Přepnout X2Go Client do skrytého režimu?</translation> <message> <location filename="../../src/settingswidget.cpp" line="208"/> <source>FreeRDP/X11 (pre-2.x style options)</source> - <translation>FreeRDP (verze starší než 2.x)</translation> + <translation>FreeRDP/X11 (verze starší než 2.x)</translation> </message> <message> <location filename="../../src/settingswidget.cpp" line="209"/> <source>FreeRDP/X11 (2.x style options)</source> - <translation>FreeRDP (verze 2.x a novější)</translation> + <translation>FreeRDP/X11 (verze 2.x a novější)</translation> </message> <message> <location filename="../../src/settingswidget.cpp" line="219"/> @@ -4029,7 +4035,7 @@ Přepnout X2Go Client do skrytého režimu?</translation> <message> <location filename="../../src/ui/xsettingsui.ui" line="61"/> <source> do not use primary clipboard</source> - <translation>Nepoužívat primární schránku</translation> + <translation> Nepoužívat primární schránku</translation> </message> <message> <location filename="../../src/ui/xsettingsui.ui" line="68"/> -- Alioth's /home/x2go-admin/maintenancescripts/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 4806e62fc39bcad8bb8b5cb632b52c91a97db984 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 08:01:18 2019 +0100 src/x2goclient.cpp: change HTTP to HTTPS links where needed. --- debian/changelog | 1 + src/x2goclient.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 237405c..77f028c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -43,6 +43,7 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium - macbuild.sh: switch to bundling PulseAudio 12.2 since it's now available in MacPorts. - res/i18n/x2goclient_cs.ts: whitespace and other fixups. + - src/x2goclient.cpp: change HTTP to HTTPS links where needed. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp index 32801c3..0817bf2 100644 --- a/src/x2goclient.cpp +++ b/src/x2goclient.cpp @@ -61,7 +61,7 @@ int fork_helper (int argc, char **argv) { const int saved_errno = errno; std::cerr << "Failed to re-execute process as UNIX cleanup helper tool: " << std::strerror (saved_errno) << "\n" << "Terminating and killing parent." << "\n" - << "Please report a bug, refer to this documentation: http://wiki.x2go.org/doku.php/wiki:bugs" << std::endl; + << "Please report a bug, refer to this documentation: https://wiki.x2go.org/doku.php/wiki:bugs" << std::endl; pid_t parent_pid = getppid (); if (0 != kill (parent_pid, SIGTERM)) { @@ -79,7 +79,7 @@ int fork_helper (int argc, char **argv) { else if (-1 == tmp_pid) { const int saved_errno = errno; std::cerr << "Unable to create a new process for the UNIX cleanup watchdog: " << std::strerror (saved_errno) << "\n"; - std::cerr << "Terminating. Please report a bug, refer to this documentation: http://wiki.x2go.org/doku.php/wiki:bugs" << std::endl; + std::cerr << "Terminating. Please report a bug, refer to this documentation: https://wiki.x2go.org/doku.php/wiki:bugs" << std::endl; std::exit (EXIT_FAILURE); } -- Alioth's /home/x2go-admin/maintenancescripts/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 74a54a122517b03071ca541145a97fecf57b5035 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 08:01:53 2019 +0100 src/x2goclient.cpp: do not spawn UNIX cleanup helper if arguments that let X2Go Client terminate right away have been passed. More work is needed here, but that should cover the most basic bits. --- debian/changelog | 3 ++ src/x2goclient.cpp | 85 ++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 77f028c..f480bc5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -44,6 +44,9 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium in MacPorts. - res/i18n/x2goclient_cs.ts: whitespace and other fixups. - src/x2goclient.cpp: change HTTP to HTTPS links where needed. + - src/x2goclient.cpp: do not spawn UNIX cleanup helper if arguments that + let X2Go Client terminate right away have been passed. More work is + needed here, but that should cover the most basic bits. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp index 0817bf2..b3306b0 100644 --- a/src/x2goclient.cpp +++ b/src/x2goclient.cpp @@ -27,6 +27,7 @@ #include <cctype> #include <vector> #include <csignal> +#include <array> #include "unixhelper.h" #include "ongetpass.h" @@ -93,34 +94,86 @@ int fork_helper (int argc, char **argv) { int main (int argc, char **argv) { #ifdef Q_OS_UNIX - /* Scan program arguments for --unixhelper flag. */ + /* + * Flags we don't need a cleanup helper for, since we know that X2Go Client + * will never spawn other processes. + * + * FIXME: What we'd actually want to have at this point (instead of a + * hardcoded list of parameters, anyway) is to use the argument parser + * from ONMainWindow (parseParameter). If this function returns false + * for any parameter, we know that we won't ever need the UNIX cleanup + * helper tool. Sadly, ONMainWindow is only started/available later, + * so we can't use any of its functionality here. We'd also need to + * make the function side-effect free. It should probably be + * refactored into a special options parser class. + */ + const std::array<const std::string, 6> bypass_flags = { + "--help", + "--help-pack", + "--version", + "-v", + "--changelog", + "--git-info" + }; + + bool bypass_unix_helper = 0; bool unix_helper_request = 0; for (int i = 0; i < argc; ++i) { + /* No need to continue scanning if we got the information we were looking for. */ + if ((bypass_unix_helper) && (unix_helper_request)) { + break; + } + std::string cur_arg (argv[i]); /* Make the current argument lowercase. */ std::transform (cur_arg.begin (), cur_arg.end (), cur_arg.begin (), ::tolower); - if ((!cur_arg.empty ()) && (cur_arg.compare ("--unixhelper") == 0)) { - unix_helper_request = 1; - break; + if (!(cur_arg.empty ())) { + /* Scan program arguments for --unixhelper flag. */ + if ((!(unix_helper_request)) && (0 == cur_arg.compare ("--unixhelper"))) { + unix_helper_request = 1; + } + + /* Scan for flags bypassing the unix helper. */ + if (!(bypass_unix_helper)) { + for (std::array<const std::string, 6>::const_iterator cit = bypass_flags.cbegin (); cit != bypass_flags.cend (); ++cit) { + if (0 == cur_arg.compare (*cit)) { + bypass_unix_helper = 1; + } + } + } } } - if (unix_helper_request) { - /* We were instructed to start as the UNIX cleanup helper tool. */ - return (unixhelper::unix_cleanup (getppid ())); + /* Sanity checks! */ + if ((unix_helper_request) && (bypass_unix_helper)) { + std::cerr << "Re-execution in UNIX cleanup helper mode was requested, but a command line parameter that is supposed to " + << "disable the UNIX cleanup helper was found.\n" + << "Terminating. Please report a bug, refer to this documentation: https://wiki.x2go.org/doku.php/wiki:bugs" << std::endl; + + return (EXIT_FAILURE); + } + + if (bypass_unix_helper) { + return (wrap_x2go_main (argc, argv)); } else { - /* - * setsid() may succeed and we become a session and process - * group leader, or it may fail indicating that we already - * are a process group leader. Either way is fine. - */ - setsid (); - - /* We should be process group leader by now. */ - return (fork_helper (argc, argv)); + if (unix_helper_request) { + /* We were instructed to start as the UNIX cleanup helper tool. */ + return (unixhelper::unix_cleanup (getppid ())); + } + else { + /* + * setsid() may succeed and we become a session and process + * group leader, or it may fail indicating that we already + * are a process group leader. Either way is fine. + */ + setsid (); + + /* We should be process group leader by now. */ + return (fork_helper (argc, argv)); + } } #else /* defined (Q_OS_UNIX) */ return (wrap_x2go_main (argc, argv)); -- Alioth's /home/x2go-admin/maintenancescripts/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 785d5f8475cdbf6738ca731151a6f8fc15e7f802 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 08:09:12 2019 +0100 src/onmainwindow.{cpp,h}: remove left-over references to agentCheckTimer and slotCheckAgentProcess (). --- debian/changelog | 2 ++ src/onmainwindow.cpp | 4 ---- src/onmainwindow.h | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index f480bc5..79b0048 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,8 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium - src/x2goclient.cpp: do not spawn UNIX cleanup helper if arguments that let X2Go Client terminate right away have been passed. More work is needed here, but that should cover the most basic bits. + - src/onmainwindow.{cpp,h}: remove left-over references to agentCheckTimer + and slotCheckAgentProcess (). * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index dbdefaa..f95a81a 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -228,10 +228,6 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) #endif #endif - agentCheckTimer=new QTimer ( this ); - connect ( agentCheckTimer,SIGNAL ( timeout() ),this, - SLOT ( slotCheckAgentProcess() ) ); - #ifdef CFGCLIENT QStringList args; if(!X2goSettings::centralSettings()) diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 3fa35dd..1e2b61a 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -722,7 +722,6 @@ private: QString currentKey; QTimer *exportTimer; QTimer *extTimer; - QTimer *agentCheckTimer; QTimer *spoolTimer; QTimer *proxyWinTimer; QTimer *xineramaTimer; -- Alioth's /home/x2go-admin/maintenancescripts/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 05ce22d365d4353e558b3ed4677fef0c424e88c9 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 08:19:59 2019 +0100 src/onmainwindow.cpp: fix various broken qCritical () calls. --- debian/changelog | 1 + src/onmainwindow.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 79b0048..bb37f7c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -49,6 +49,7 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium needed here, but that should cover the most basic bits. - src/onmainwindow.{cpp,h}: remove left-over references to agentCheckTimer and slotCheckAgentProcess (). + - src/onmainwindow.cpp: fix various broken qCritical () calls. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index f95a81a..5b8098c 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -8088,7 +8088,7 @@ void ONMainWindow::showHelpPack() msg+=pc+"\n"; } file.close(); - qCritical()<<msg; + qCritical().nospace () << qPrintable (msg); if (!startHidden && !haveTerminal) { HelpDialog dlg(this); @@ -8106,7 +8106,7 @@ void ONMainWindow::showTextFile(QString fname, QString title) QTextStream in ( &file ); QString msg=in.readAll(); file.close(); - qCritical()<<msg; + qCritical().nospace () << qPrintable (msg); if (!startHidden && !haveTerminal) { HelpDialog dlg(this); @@ -8140,7 +8140,7 @@ void ONMainWindow::showGit() void ONMainWindow::showVersion() { - qCritical()<<VERSION; + qCritical().nospace () << VERSION; if (!startHidden && !haveTerminal) { -- Alioth's /home/x2go-admin/maintenancescripts/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 0125db0b973c663bf55c63e85c9b8c90c89f0c8e Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 11:17:49 2019 +0100 src/{onmainwindow.{cpp,h},{sshmasterconnection,help}.cpp}: let users control libssh debugging via the new parameters --libssh-debug and --libssh-packetlog. Properly document the new switches and their implications. --- debian/changelog | 4 ++++ src/help.cpp | 6 ++++++ src/onmainwindow.cpp | 14 ++++++++++++++ src/onmainwindow.h | 2 ++ src/sshmasterconnection.cpp | 17 +++++++++-------- 5 files changed, 35 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index bb37f7c..e37add9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -50,6 +50,10 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.{cpp,h}: remove left-over references to agentCheckTimer and slotCheckAgentProcess (). - src/onmainwindow.cpp: fix various broken qCritical () calls. + - src/{onmainwindow.{cpp,h},{sshmasterconnection,help}.cpp}: let users + control libssh debugging via the new parameters --libssh-debug and + --libssh-packetlog. Properly document the new switches and their + implications. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/help.cpp b/src/help.cpp index cec2a40..8956b17 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -110,6 +110,12 @@ help::params_t help::build_params () { ADD_OPT ("--debug", QT_TRANSLATE_NOOP ("Help", "Enables extensive debug output to the console." NEWLINE "On Windows, also enables PulseAudio logging to a file under \".x2go/pulse\" & cygwin sshd logging to a file under \".x2go/sshLogs\" directory, both under the USERPROFILE directory." NEWLINE "The logs are not deleted when X2Go Client terminates.")); + ADD_OPT ("--libssh-debug", QT_TRANSLATE_NOOP ("Help", "Instructs libssh to print out extensive debug output to the console." NEWLINE + "This will only have an effect if libssh is being used. It tends to generate a lot of output." NEWLINE + "WARNING: Enabling this option could reveal sensitive information about client and server configuration, and, if libssh has been compiled with password debugging, user credentials. Do not publish log files created with this option.")); + ADD_OPT ("--libssh-packetlog", QT_TRANSLATE_NOOP ("Help", "Instructs libssh to print out all network packets sent and received, including their contents." NEWLINE + "This will only have an effect if libssh is being used. It tends to generate huge amounts of output." NEWLINE + "WARNING: The same caveats as explained in the --libssh-debug option help text apply.")); ADD_OPT ("--no-autoresume", QT_TRANSLATE_NOOP ("Help", "Do not resume sessions automatically.")); ADD_OPT ("--no-menu", QT_TRANSLATE_NOOP ("Help", "Hides menu bar.")); ADD_OPT ("--no-session-edit", QT_TRANSLATE_NOOP ("Help", "Disables session editing.")); diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 5b8098c..ec7cb77 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -42,6 +42,8 @@ QString ONMainWindow::u3Device; #endif bool ONMainWindow::debugging=false; +bool ONMainWindow::libssh_debugging = false; +bool ONMainWindow::libssh_packetlog = false; ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) { @@ -60,6 +62,8 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) #endif x2goInfof(1) << tr("Starting X2Go Client %1...").arg (QString (VERSION)); debugging = false; + libssh_debugging = false; + libssh_packetlog = false; setFocusPolicy ( Qt::NoFocus ); installTranslator(); @@ -7367,6 +7371,16 @@ bool ONMainWindow::parseParameter ( QString param ) return true; } + if ("--libssh-debug" == param) { + ONMainWindow::libssh_debugging = true; + return true; + } + + if ("--libssh-packetlog" == param) { + ONMainWindow::libssh_packetlog = true; + return true; + } + #if defined (Q_OS_DARWIN) || defined (Q_OS_WIN) if (param == "--disable-pulse") { diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 1e2b61a..1896b1a 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -312,6 +312,8 @@ public: }; static bool debugging; + static bool libssh_debugging; + static bool libssh_packetlog; static bool portable; ONMainWindow ( QWidget *parent = 0 ); diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 049bee0..038865a 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -51,9 +51,6 @@ #define DEBUG -#undef SSH_DEBUG -// #define SSH_DEBUG - const QString SshMasterConnection::challenge_auth_code_prompts_[] = { "Verification code:", // GA (http://github.com/google/google-authenticator) "One-time password (OATH) for", // OATH (http://www.nongnu.org/oath-toolkit/pam_oath.html) @@ -563,11 +560,15 @@ void SshMasterConnection::run() } disconnectSessionFlag=false; -#ifdef SSH_DEBUG - int verbosity=SSH_LOG_PACKET; -#else - int verbosity=SSH_LOG_NOLOG; -#endif + int verbosity = SSH_LOG_NOLOG; + + if (ONMainWindow::libssh_debugging) { + verbosity = SSH_LOG_DEBUG; + } + + if (ONMainWindow::libssh_packetlog) { + verbosity = SSH_LOG_PACKET; + } long timeout = 60; -- Alioth's /home/x2go-admin/maintenancescripts/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 0764597fc65219606f0048575df1bf99e2b6fe24 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 28 11:31:23 2019 +0100 src/sshmasterconnection.cpp: drop DEBUG preprocessor conditional blocks. We have never actually disabled it and x2goDebug () will not write out anything if debugging has not been requested, so we already have a soft condition check for every x2goDebug () call. --- debian/changelog | 4 + src/sshmasterconnection.cpp | 202 +------------------------------------------- 2 files changed, 6 insertions(+), 200 deletions(-) diff --git a/debian/changelog b/debian/changelog index e37add9..456da4c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -54,6 +54,10 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium control libssh debugging via the new parameters --libssh-debug and --libssh-packetlog. Properly document the new switches and their implications. + - src/sshmasterconnection.cpp: drop DEBUG preprocessor conditional blocks. + We have never actually disabled it and x2goDebug () will not write out + anything if debugging has not been requested, so we already have a soft + condition check for every x2goDebug () call. * debian/control: + Add build-depend on pkg-config. * x2goclient.spec: diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index 038865a..6a1bc86 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -49,8 +49,6 @@ #define PROXYTUNNELPORT 44444 -#define DEBUG - const QString SshMasterConnection::challenge_auth_code_prompts_[] = { "Verification code:", // GA (http://github.com/google/google-authenticator) "One-time password (OATH) for", // OATH (http://www.nongnu.org/oath-toolkit/pam_oath.html) @@ -140,10 +138,8 @@ void SshMasterConnection::parseKnownHosts() //first element is a type of key, we don't need it fields.removeFirst(); settings.setValue(keyName,fields.join(",")); -#ifdef DEBUG x2goDebug<<"Writing key to registry: HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\SshHostKeys"<<endl; x2goDebug<<keyName<<"="<<fields.join(",")<<endl; -#endif } settings.sync(); } @@ -200,9 +196,7 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por if (!tmp_session) { QString error_msg = tr ("Cannot create SSH session."); error_msg += " " + tr ("Using environment-provided username."); -#ifdef DEBUG x2goDebug << error_msg; -#endif } else { QByteArray tmp_BA; @@ -235,7 +229,6 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por #endif } -#ifdef DEBUG if (kerberos) { x2goDebug<<"Starting SSH connection with Kerberos authentication."; @@ -244,18 +237,13 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por { x2goDebug<<"Starting SSH connection without Kerberos authentication."; } -#endif -#ifdef DEBUG x2goDebug<<"SshMasterConnection, instance "<<this<<" created."; -#endif } void SshMasterConnection::slotSshProxyConnectionOk() { -#ifdef DEBUG x2goDebug<<"SSH proxy connected."; -#endif localProxyPort=PROXYTUNNELPORT; @@ -326,16 +314,12 @@ void SshMasterConnection::addReverseTunnelConnections() if(rc==SSH_OK) { emit reverseTunnelOk(reverseTunnelRequest[i].creator); -#ifdef DEBUG x2goDebug<<"Listening for TCP/IP connections on "<<reverseTunnelRequest[i].forwardPort; -#endif } if(rc==SSH_ERROR) { QString err=ssh_get_error(my_ssh_session); -#ifdef DEBUG x2goDebug<<"Forward port "<<reverseTunnelRequest[i].forwardPort<<" failed:"<<err; -#endif emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err); } #if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 0) @@ -352,9 +336,7 @@ void SshMasterConnection::checkReverseTunnelConnections() ssh_channel chan=ssh_channel_accept_forward(my_ssh_session, 0, &port); if(chan) { -#ifdef DEBUG x2goDebug<<"New reverse connection on port "<<port; -#endif reverseTunnelRequestMutex.lock(); for(int i=0; i<reverseTunnelRequest.count(); ++i) @@ -362,9 +344,7 @@ void SshMasterConnection::checkReverseTunnelConnections() ReverseTunnelRequest req=reverseTunnelRequest[i]; if (static_cast<int> (req.forwardPort) == port) { -#ifdef DEBUG x2goDebug<<"Creating new channel for reverse tunnel "<<port; -#endif int sock=socket ( AF_INET, SOCK_STREAM,0 ); #ifndef Q_OS_WIN const int y=1; @@ -376,9 +356,7 @@ void SshMasterConnection::checkReverseTunnelConnections() struct sockaddr_in address; address.sin_family=AF_INET; address.sin_port=htons ( req.localPort ); -#ifdef DEBUG x2goDebug<<"Connecting to "<<req.localHost<<":"<<req.localPort<<endl; -#endif #ifndef Q_OS_WIN inet_aton ( req.localHost.toLatin1(), &address.sin_addr ); #else @@ -390,9 +368,7 @@ void SshMasterConnection::checkReverseTunnelConnections() { QString errMsg=tr ( "Cannot connect to " ) + req.localHost+":"+QString::number ( req.localPort ); -#ifdef DEBUG x2goDebug<<errMsg<<endl; -#endif emit ioErr ( req.creator, errMsg, "" ); break; } @@ -404,9 +380,7 @@ void SshMasterConnection::checkReverseTunnelConnections() channelConnectionsMutex.lock(); channelConnections<<con; channelConnectionsMutex.unlock(); -#ifdef DEBUG x2goDebug<<"New channel created"; -#endif break; } } @@ -440,9 +414,7 @@ int SshMasterConnection::startTunnel(const QString& forwardHost, uint forwardPor req.localHost=localHost; req.forwardPort=forwardPort; req.listen=false; -#ifdef DEBUG x2goDebug<<"Requesting reverse tunnel from port "<<forwardPort<< " to "<<localPort; -#endif reverseTunnelRequestMutex.lock(); reverseTunnelRequest<<req; reverseTunnelRequestMutex.unlock(); @@ -491,9 +463,7 @@ void SshMasterConnection::slotSshProxyUserAuthError(QString err) void SshMasterConnection::slotSshProxyTunnelOk(int) { -#ifdef DEBUG x2goDebug<<"SSH proxy tunnel established."; -#endif sshProxyReady=true; } @@ -513,9 +483,7 @@ void SshMasterConnection::slotSshProxyServerAuthAborted() void SshMasterConnection::run() { -#ifdef DEBUG x2goDebug<<"SshMasterConnection, instance "<<this<<" entering thread."; -#endif if(useproxy && proxytype==PROXYSSH) { x2goDebug << "proxyserver: " << proxyserver << "; proxyport: " << proxyport << "; proxylogin: " << proxylogin; @@ -576,9 +544,7 @@ void SshMasterConnection::run() if ( my_ssh_session == NULL ) { QString err=tr ( "Cannot create SSH session." ); -#ifdef DEBUG x2goDebug<<err<<endl; -#endif emit connectionError ( err,"" ); quit(); return; @@ -589,9 +555,7 @@ void SshMasterConnection::run() QByteArray tmp_BA = (mainWnd->getHomeDirectory () + "/ssh").toLocal8Bit (); ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, tmp_BA.data ()); -#ifdef DEBUG x2goDebug << "Setting SSH directory to " << tmp_BA.data (); -#endif if (kerberos) { parseKnownHosts(); @@ -615,40 +579,30 @@ void SshMasterConnection::run() if (!tcpProxySocket->waitForConnected(30000)) { QString message=tr ( "Cannot connect to proxy server." ); -#ifdef DEBUG x2goDebug<<message<<endl; -#endif emit connectionError ( "Proxy", message ); ssh_free ( my_ssh_session ); quit(); return; } proxysocket = tcpProxySocket->socketDescriptor(); -#ifdef DEBUG x2goDebug << "Created HTTP proxy socket: " << proxysocket << endl; -#endif ssh_options_set( my_ssh_session, SSH_OPTIONS_FD, &proxysocket); ssh_set_fd_toread( my_ssh_session); -#ifdef DEBUG x2goDebug<<"Connected to HTTP proxy server: " << proxyserver << ":" << proxyport <<endl; -#endif } if ( !sshConnect() ) { if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } QString err=ssh_get_error ( my_ssh_session ); QString message=tr ( "Cannot connect to " ) +host+":"+QString::number ( port ); -#ifdef DEBUG x2goDebug<<message<<" - "<<err; -#endif emit connectionError ( message, err ); ssh_free ( my_ssh_session ); quit(); @@ -656,9 +610,7 @@ void SshMasterConnection::run() } if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } QString errMsg; @@ -667,9 +619,7 @@ void SshMasterConnection::run() { if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } writeHostKey=writeHostKeyReady=false; @@ -694,9 +644,7 @@ void SshMasterConnection::run() if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } @@ -708,9 +656,7 @@ void SshMasterConnection::run() QByteArray tmp_BA = (mainWnd->getHomeDirectory () + "/ssh").toLocal8Bit (); ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, tmp_BA.data () ); -#ifdef DEBUG x2goDebug << "Setting SSH directory to " << tmp_BA.data (); -#endif } #endif @@ -718,14 +664,10 @@ void SshMasterConnection::run() { if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } -#ifdef DEBUG x2goDebug<<"User authentication OK."; -#endif // checkLogin() is currently specific to libssh. if(kerberos) emit connectionOk(host); @@ -754,9 +696,7 @@ void SshMasterConnection::run() { if(disconnectSessionFlag) { -#ifdef DEBUG x2goDebug<<"Session is already disconnected, exiting."<<endl; -#endif return; } QString err; @@ -769,9 +709,7 @@ void SshMasterConnection::run() err=sshProcErrString; } QString message=tr ( "Authentication failed." ); -#ifdef DEBUG x2goDebug<<message<<" - "<<err; -#endif emit userAuthError ( authErrors.join ( "\n" ) ); ssh_disconnect ( my_ssh_session ); ssh_free ( my_ssh_session ); @@ -799,20 +737,14 @@ SshMasterConnection::~SshMasterConnection() disconnectFlagMutex.lock(); disconnectSessionFlag=true; disconnectFlagMutex.unlock(); -#ifdef DEBUG x2goDebug<<"SshMasterConnection, instance "<<this<<" waiting for thread to finish."; -#endif wait(15000); -#ifdef DEBUG x2goDebug<<"SshMasterConnection, instance "<<this<<" thread finished."; -#endif for(int i=processes.count()-1; i>=0; --i) { delete processes[i]; } -#ifdef DEBUG x2goDebug<<"SshMasterConnection, instance "<<this<<" finished destructor."; -#endif } @@ -884,9 +816,7 @@ bool SshMasterConnection::sshConnect() if (!tmp_session) { QString error_msg = tr ("Cannot create SSH session."); -#ifdef DEBUG x2goDebug << error_msg; -#endif return (false); } else { @@ -947,9 +877,7 @@ void SshMasterConnection::writeKnownHosts(bool write) int SshMasterConnection::serverAuth ( QString& errorMsg ) { -#ifdef DEBUG x2goDebug<<"cserverAuth"; -#endif int state = SSH_SERVER_ERROR; unsigned char *hash = NULL; @@ -988,9 +916,7 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) if ( 0 >= hlen ) return SSH_SERVER_ERROR; -#ifdef DEBUG x2goDebug<<"state: "<<state<<endl; -#endif switch ( state ) { @@ -1057,11 +983,9 @@ bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt) QString name= ssh_userauth_kbdint_getname(my_ssh_session); instruction = ssh_userauth_kbdint_getinstruction(my_ssh_session); -#ifdef DEBUG x2goDebug<<"Have prompts: "<<prompts<<endl; x2goDebug<<"Name: "<<name<<endl; x2goDebug<<"Instruction: "<<instruction<<endl; -#endif } if(prompts>0) { @@ -1134,21 +1058,15 @@ bool SshMasterConnection::userChallengeAuth() { case SSH_AUTH_INFO: prompts=ssh_userauth_kbdint_getnprompts(my_ssh_session); -#ifdef DEBUG x2goDebug<<"Have prompts: "<<prompts<<endl; -#endif if(prompts) { const char *prompt= ssh_userauth_kbdint_getprompt(my_ssh_session,0,NULL); -#ifdef DEBUG x2goDebug<<"Prompt[0]: |"<<prompt<<"|"<<endl; -#endif QString pr=prompt; if(pr.startsWith ("Password:")) { -#ifdef DEBUG x2goDebug<<"Password request"<<endl; -#endif ssh_userauth_kbdint_setanswer(my_ssh_session,0,pass.toLatin1()); return userChallengeAuth(); } @@ -1184,9 +1102,7 @@ bool SshMasterConnection::userChallengeAuth() } if (has_challenge_auth_code_prompt) { -#ifdef DEBUG x2goDebug<<"Verification code request"<<endl; -#endif challengeAuthPasswordAccepted=true; if(challengeAuthVerificationCode == QString::null) @@ -1228,9 +1144,7 @@ bool SshMasterConnection::userChallengeAuth() return userChallengeAuth(); } case SSH_AUTH_SUCCESS: -#ifdef DEBUG x2goDebug<<"Challenge authentication OK."<<endl; -#endif return true; case SSH_AUTH_DENIED: if(!challengeAuthPasswordAccepted ) @@ -1366,9 +1280,7 @@ bool SshMasterConnection::userAuthAuto() { QString err=ssh_get_error ( my_ssh_session ); authErrors<<err; -#ifdef DEBUG x2goDebug << "userAuthAuto failed:" << err << " (code " << rc << ")" << endl; -#endif return false; } return true; @@ -1385,9 +1297,7 @@ void SshMasterConnection::setKeyPhrase(QString phrase) bool SshMasterConnection::userAuthWithKey() { -#ifdef DEBUG x2goDebug<<"Trying to authenticate user with private key."; -#endif QString keyName=key; bool autoRemove=false; if ( key.indexOf ( "PRIVATE KEY" ) !=-1 ) @@ -1403,9 +1313,7 @@ bool SshMasterConnection::userAuthWithKey() out<<key; fl.close(); autoRemove=true; -#ifdef DEBUG x2goDebug<<"Temporarily saved key in "<<keyName; -#endif } QByteArray tmp_ba = keyName.toLocal8Bit (); @@ -1501,9 +1409,7 @@ bool SshMasterConnection::userAuthWithKey() if (!priv_key) #endif { -#ifdef DEBUG x2goDebug<<"Failed to get private key from "<<keyName; -#endif if ( autoRemove ) QFile::remove ( keyName ); return false; @@ -1523,9 +1429,7 @@ bool SshMasterConnection::userAuthWithKey() if (!pub_key) #endif { -#ifdef DEBUG x2goDebug<<"Failed to get public key from private key."; -#endif #if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 0) ssh_key_free (priv_key); priv_key = NULL; @@ -1576,9 +1480,7 @@ bool SshMasterConnection::userAuthWithKey() ssh_string_free(pubkeyStr); #endif -#ifdef DEBUG x2goDebug<<"Authenticating with key: "<<rc<<endl; -#endif if ( autoRemove ) QFile::remove ( keyName ); @@ -1589,9 +1491,7 @@ bool SshMasterConnection::userAuthWithKey() QString err=ssh_get_error ( my_ssh_session ); authErrors<<err; -#ifdef DEBUG x2goDebug<<"userAuthWithKey failed:" <<err<<endl; -#endif return false; } @@ -1652,9 +1552,7 @@ bool SshMasterConnection::userAuthKrb() */ local_args << shcmd; -#ifdef DEBUG x2goDebug << "Starting ssh:" << local_cmd << " " << local_args.join (" ") << endl; -#endif ssh.start (local_cmd, local_args); @@ -1662,9 +1560,7 @@ bool SshMasterConnection::userAuthKrb() { sshProcErrString=ssh.errorString(); authErrors<<sshProcErrString; -#ifdef DEBUG x2goDebug<<"SSH start failed:" <<sshProcErrString<<endl; -#endif return false; } if (!ssh.waitForFinished(20000)) @@ -1672,20 +1568,16 @@ bool SshMasterConnection::userAuthKrb() sshProcErrString=ssh.errorString(); authErrors<<tr("Failed to start SSH client. Please check your installation and GSSApi configuration."); authErrors<<sshProcErrString; -#ifdef DEBUG x2goDebug<<"SSH did not finish:" <<sshProcErrString<<endl; -#endif return false; } QString outp=ssh.readAllStandardOutput(); QString err=ssh.readAllStandardError(); -#ifdef DEBUG x2goDebug<<"SSH exited."; x2goDebug<<"stdout: "<<outp<<endl; x2goDebug<<"stderr: "<<err<<endl; x2goDebug<<"Exit code: "<<ssh.exitCode()<<"; status: "<<ssh.exitStatus()<<endl; -#endif QString begin_marker = "X2GODATABEGIN:"+uuidStr+"\n"; QString end_marker = "X2GODATAEND:"+uuidStr+"\n"; @@ -1737,45 +1629,35 @@ bool SshMasterConnection::checkLogin() QString err = ssh_get_error (my_ssh_session); QString error_msg = tr ("%1 failed.").arg ("ssh_channel_new"); -#ifdef DEBUG x2goDebug << error_msg.left (error_msg.size () - 1) << ": " << err << endl; -#endif return false; } if ( ssh_channel_open_session ( channel ) !=SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_session"); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif return false; } if (ssh_channel_request_pty(channel)!=SSH_OK) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_request_pty"); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif return false; } if(ssh_channel_change_pty_size(channel, 80, 24)!=SSH_OK) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_change_pty_size"); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif return false; } if ( ssh_channel_request_exec ( channel, "echo \"LOGIN OK\"" ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_request_exec"); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif } else { @@ -1924,23 +1806,17 @@ void SshMasterConnection::copy() QString dstFile=lst.last(); lst.removeLast(); QString dstPath=lst.join ( "/" ); -#ifdef DEBUG x2goDebug<<"SSH Master Connection copy - dst path:"<<dstPath<<" file:"<<dstFile<<endl; -#endif ssh_scp scp=ssh_scp_new ( my_ssh_session, SSH_SCP_WRITE|SSH_SCP_RECURSIVE, dstPath.toLatin1() ); if ( scp == NULL ) { -#ifdef DEBUG x2goDebug<<"Error allocating SCP session: "<< ssh_get_error ( my_ssh_session ) <<endl; -#endif return; } int rc = ssh_scp_init ( scp ); if ( rc != SSH_OK ) { -#ifdef DEBUG x2goDebug<<"Error initializing SCP session: "<< ssh_get_error ( my_ssh_session ) <<endl; -#endif ssh_scp_free ( scp ); return; } @@ -1961,9 +1837,7 @@ void SshMasterConnection::copy() { QString errMsg=tr ( "Cannot create remote file " ) +copyRequests[i].dst; QString serr=ssh_get_error ( my_ssh_session ); -#ifdef DEBUG x2goDebug<<errMsg<<" - "<<serr<<endl; -#endif emit copyErr ( copyRequests[i].creator, errMsg, serr ); copyRequests.removeAt ( i ); ssh_scp_close ( scp ); @@ -1975,9 +1849,7 @@ void SshMasterConnection::copy() { QString serr=ssh_get_error ( my_ssh_session ); QString errMsg=tr ( "Cannot write to remote file " ) +copyRequests[i].dst; -#ifdef DEBUG x2goDebug<<errMsg<<" - "<<serr<<endl; -#endif emit copyErr ( copyRequests[i].creator, errMsg, serr ); copyRequests.removeAt ( i ); ssh_scp_close ( scp ); @@ -1985,9 +1857,7 @@ void SshMasterConnection::copy() continue; } emit copyOk ( copyRequests[i].creator ); -#ifdef DEBUG x2goDebug<<"scp ok: "<<copyRequests[i].src<<" -> "<<user<<"@"<<host<<":"<<copyRequests[i].dst<<endl; -#endif copyRequests.removeAt ( i ); ssh_scp_close ( scp ); ssh_scp_free ( scp ); @@ -2004,9 +1874,7 @@ void SshMasterConnection::channelLoop() if ( disconnect ) { -#ifdef DEBUG x2goDebug<<"Disconnecting ..."<<endl; -#endif if (useproxy && proxytype==PROXYSSH&&sshProxy) { @@ -2015,30 +1883,22 @@ void SshMasterConnection::channelLoop() } channelConnectionsMutex.lock(); -#ifdef DEBUG x2goDebug<<"Deleting channel connections."<<endl; -#endif for ( int i=0; i<channelConnections.size(); ++i ) { finalize ( i ); } channelConnectionsMutex.unlock(); -#ifdef DEBUG x2goDebug<<"Disconnecting session."<<endl; -#endif ssh_disconnect ( my_ssh_session ); ssh_free ( my_ssh_session ); -#ifdef DEBUG x2goDebug<<"Deleting sockets."<<endl; -#endif if (tcpProxySocket != NULL) delete tcpProxySocket; if (tcpNetworkProxy != NULL) delete tcpNetworkProxy; -#ifdef DEBUG x2goDebug<<"All channels closed and session disconnected. Quitting session loop."<<endl; -#endif quit(); return; } @@ -2065,9 +1925,7 @@ void SshMasterConnection::channelLoop() channelConnectionsMutex.lock(); if ( channelConnections.size() <=0 ) { -#ifdef DEBUG // x2goDebug<<"no channel connections, waiting\n"; -#endif channelConnectionsMutex.unlock(); usleep ( 500 ); continue; @@ -2085,9 +1943,7 @@ void SshMasterConnection::channelLoop() FD_SET ( tcpSocket, &rfds ); if ( channelConnections.at ( i ).channel==0l ) { -#ifdef DEBUG x2goDebug<<"Creating new channel."<<endl; -#endif ssh_channel channel = ssh_channel_new ( my_ssh_session ); if (!channel) { @@ -2096,24 +1952,18 @@ void SshMasterConnection::channelLoop() QString error_msg = tr ("%1 failed.").arg ("ssh_channel_new"); emit ioErr (channelConnections[i].creator, error_msg, err); -#ifdef DEBUG x2goDebug << error_msg.left (error_msg.size () - 1) << ": " << err << endl; -#endif continue; } -#ifdef DEBUG x2goDebug<<"New channel:"<<channel<<endl; -#endif channelConnections[i].channel=channel; if ( tcpSocket>0 ) { -#ifdef DEBUG x2goDebug << "Forwarding parameters: from remote (" << channelConnections.at (i).forwardHost << ":" << channelConnections.at (i).forwardPort << ") to local (" << channelConnections.at (i).localHost << ":" << channelConnections.at (i).localPort << ")"; -#endif /* * Cannot support config file parsing here with pre-0.6.0 libssh versions. @@ -2124,9 +1974,7 @@ void SshMasterConnection::channelLoop() if (!tmp_session) { QString error_msg = tr ("Cannot create SSH session."); -#ifdef DEBUG x2goDebug << error_msg; -#endif emit ioErr (channelConnections[i].creator, error_msg, ""); } else { @@ -2173,47 +2021,35 @@ void SshMasterConnection::channelLoop() QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_forward"); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif } -#ifdef DEBUG else { x2goDebug<<"New channel forwarded."<<endl; } } -#endif } else { -#ifdef DEBUG x2goDebug<<"Executing remote: "<<channelConnections.at ( i ).command<<endl; -#endif if ( ssh_channel_open_session ( channel ) !=SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_open_session"); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif } else if ( ssh_channel_request_exec ( channel, channelConnections[i].command.toLatin1() ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_request_exec"); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif } -#ifdef DEBUG else { x2goDebug<<"New exec channel created."<<endl; } -#endif } } @@ -2228,15 +2064,11 @@ void SshMasterConnection::channelLoop() if ( retval == -1 ) { -#ifdef DEBUG x2goDebug<<"select() error."; -#endif continue; } -#ifdef DEBUG // x2goDebug<<"select exited"<<endl; -#endif channelConnectionsMutex.lock(); for ( int i=channelConnections.size()-1; i>=0; --i ) @@ -2247,34 +2079,25 @@ void SshMasterConnection::channelLoop() continue; if ( ssh_channel_poll ( channel,1 ) > 0 ) { -#ifdef DEBUG // x2goDebug<<"read err data from channel\n"; -#endif nbytes = ssh_channel_read ( channel, buffer, sizeof ( buffer )-1, 1 ); emit stdErr ( channelConnections[i].creator, QByteArray ( buffer,nbytes ) ); -#ifdef DEBUG // x2goDebug<<nbytes<<" err from channel"<<endl; -#endif } int rez = ssh_channel_poll ( channel, 0 ); if ( rez==SSH_EOF ) { -#ifdef DEBUG x2goDebug<<"EOF on channel "<<channel<<"; SshProcess object: "<<channelConnections[i].creator->pid; -#endif + //////Finished//////// finalize ( i ); continue; } if ( rez>0 ) { -#ifdef DEBUG // x2goDebug<<"read data from channel "<<channel<<endl; -#endif nbytes = ssh_channel_read ( channel, buffer, sizeof ( buffer )-1, 0 ); -#ifdef DEBUG // x2goDebug<<nbytes<<" from channel "<<channel<<endl; -#endif if ( nbytes > 0 ) { if ( tcpSocket>0 ) @@ -2282,16 +2105,12 @@ void SshMasterConnection::channelLoop() if ( send ( tcpSocket,buffer, nbytes,0 ) != nbytes ) { QString errMsg=tr ( "Error writing to socket." ); -#ifdef DEBUG x2goDebug<<"Error writing "<<nbytes<<" to TCP socket"<<tcpSocket<<endl; -#endif emit ioErr ( channelConnections[i].creator,errMsg,"" ); finalize ( i ); continue; } -#ifdef DEBUG // x2goDebug<<"wrote "<<nbytes<<" to tcp socket "<<tcpSocket<<endl; -#endif } else { @@ -2305,18 +2124,15 @@ void SshMasterConnection::channelLoop() QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "Error reading channel." ); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg<<" - "<<err<<endl; -#endif finalize ( i ); continue; } if ( ssh_channel_is_eof ( channel ) ) { -#ifdef DEBUG x2goDebug<<"EOF on channel "<<channel<<"; SshProcess object: "<<channelConnections[i].creator->pid; -#endif + //////Finished//////// finalize ( i ); continue; @@ -2329,9 +2145,7 @@ void SshMasterConnection::channelLoop() if ( FD_ISSET ( tcpSocket,&rfds ) ) { nbytes = recv ( tcpSocket, buffer, sizeof ( buffer )-1,0 ); -#ifdef DEBUG // x2goDebug<<nbytes<<" bytes from tcp socket "<<tcpSocket<<endl; -#endif if ( nbytes > 0 ) { if ( ssh_channel_write ( channel, buffer, nbytes ) !=nbytes ) @@ -2339,15 +2153,11 @@ void SshMasterConnection::channelLoop() QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "%1 failed." ).arg ("ssh_channel_write"); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg.left (errorMsg.size () - 1)<<": "<<err<<endl; -#endif finalize ( i ); continue; } -#ifdef DEBUG // x2goDebug<<nbytes<<" bytes wrote to channel"<<channel<<endl; -#endif } if ( nbytes < 0 ) { @@ -2355,17 +2165,13 @@ void SshMasterConnection::channelLoop() QString err=""; QString errorMsg=tr ( "Error reading from TCP socket." ); emit ioErr ( channelConnections[i].creator, errorMsg, err ); -#ifdef DEBUG x2goDebug<<errorMsg<<" - "<<err<<endl; -#endif finalize ( i ); continue; } if ( nbytes==0 ) { -#ifdef DEBUG x2goDebug<<"Socket "<<tcpSocket<<" closed."<<endl; -#endif finalize ( i ); continue; } @@ -2382,13 +2188,9 @@ void SshMasterConnection::finalize ( int item ) if ( channel ) { ssh_channel_send_eof ( channel ); -#ifdef DEBUG x2goDebug<<"EOF sent."; -#endif ssh_channel_close ( channel ); -#ifdef DEBUG x2goDebug<<"Channel closed."; -#endif ssh_channel_free ( channel ); } if ( tcpSocket>0 ) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git