[X2Go-Commits] [x2goclient] 06/07: src/{onmainwindow.{cpp, h}, {sshmasterconnection, help}.cpp}: let users control libssh debugging via the new parameters --libssh-debug and --libssh-packetlog.

git-admin at x2go.org git-admin at x2go.org
Thu Mar 28 11:33:34 CET 2019


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


More information about the x2go-commits mailing list