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

x2go pushed a commit to branch master
in repository x2goclient.

commit 88a01f28c1932467ab7f25605159f53fe86e8627
Author: Oleksandr Shneyder <o.shney...@phoca-gmbh.de>
Date:   Thu Nov 16 09:01:19 2023 -0600

    Fix crashes in broker mode when server key check has failed
---
 debian/changelog     |  1 +
 src/onmainwindow.cpp | 64 ++++++++++++++++------------------------------------
 src/onmainwindow.h   |  2 +-
 3 files changed, 22 insertions(+), 45 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 152e2f4..97b53dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ x2goclient (4.1.2.4-0x2go1) UNRELEASED; urgency=medium
       using broker
     - In direct RDP mode, when using broker, forward username and password to
       the RDP client if user entered any.
+  * Fix crashes in broker mode when server key check has failed
 
   [ Mihai Moldovan ]
   * New upstream version (4.1.2.4):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index b66ec92..5362cc3 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -3306,6 +3306,18 @@ void 
ONMainWindow::slotSshServerAuthChallengeResponse(SshMasterConnection* conne
     }
 }
 
+void ONMainWindow::startBrokerSyncTimer()
+{
+    if(brokerMode)
+    {
+        ignoreBrokerSessions=false;
+    }
+
+    if(brokerMode && config.brokerSyncTimeout && 
!(brokerSyncTimer->isActive()))
+    {
+            brokerSyncTimer->start();
+    }
+}
 
 void ONMainWindow::slotSshServerAuthError ( int error, QString sshMessage, 
SshMasterConnection* connection )
 {
@@ -3319,15 +3331,6 @@ void ONMainWindow::slotSshServerAuthError ( int error, 
QString sshMessage, SshMa
         activateWindow();
         raise();
     }
-    if(brokerMode)
-    {
-        ignoreBrokerSessions=false;
-    }
-
-    if(brokerMode && config.brokerSyncTimeout && 
!(brokerSyncTimer->isActive()))
-    {
-            brokerSyncTimer->start();
-    }
     QString errMsg;
     switch ( error )
     {
@@ -3350,6 +3353,7 @@ void ONMainWindow::slotSshServerAuthError ( int error, 
QString sshMessage, SshMa
             }
             slotSshUserAuthError ( tr ( "Host key verification failed." ) );
             sshConnection=0;
+            startBrokerSyncTimer();
             return;
         }
         else
@@ -3378,6 +3382,7 @@ void ONMainWindow::slotSshServerAuthError ( int error, 
QString sshMessage, SshMa
             }
             slotSshUserAuthError ( tr ( "Host key verification failed." ) );
             sshConnection=0;
+            startBrokerSyncTimer();
             return;
         }
         else
@@ -3397,6 +3402,7 @@ void ONMainWindow::slotSshServerAuthError ( int error, 
QString sshMessage, SshMa
         }
         sshConnection=0;
         slotSshUserAuthError ( sshMessage );
+        startBrokerSyncTimer();
         return ;
     case SSH_SERVER_FILE_NOT_FOUND:
         errMsg=tr ( "Could not find known hosts file. "
@@ -3421,6 +3427,7 @@ void ONMainWindow::slotSshServerAuthError ( int error, 
QString sshMessage, SshMa
         }
         sshConnection=0;
         slotSshUserAuthError ( tr ( "Host key verification failed." ) );
+        startBrokerSyncTimer();
         return;
     }
     connection->writeKnownHosts(true);
@@ -3463,15 +3470,7 @@ void ONMainWindow::slotSshUserAuthError ( QString error )
     pass->setFocus();
     pass->selectAll();
     passForm->setEnabled ( true );
-    if(brokerMode)
-    {
-        ignoreBrokerSessions=false;
-    }
-
-    if(brokerMode && config.brokerSyncTimeout && 
!(brokerSyncTimer->isActive()))
-    {
-            brokerSyncTimer->start();
-    }
+    startBrokerSyncTimer();
 }
 
 void ONMainWindow::slotSessEnter()
@@ -3896,14 +3895,7 @@ bool ONMainWindow::startSession ( const QString& sid, 
CONTYPE conType )
 
             setEnabled(true);
             passForm->setEnabled(true);
-            if(brokerMode)
-            {
-                ignoreBrokerSessions=false;
-            }
-            if(config.brokerSyncTimeout && !(brokerSyncTimer->isActive()))
-            {
-                brokerSyncTimer->start();
-            }
+            startBrokerSyncTimer();
             return false;
         }
     }
@@ -5595,14 +5587,7 @@ void ONMainWindow::slotRetSuspSess ( bool result, 
QString output,
     }
     else
     {
-        if(brokerMode)
-        {
-            ignoreBrokerSessions=false;
-        }
-        if(brokerMode && config.brokerSyncTimeout && 
!(brokerSyncTimer->isActive()))
-        {
-            brokerSyncTimer->start();
-        }
+        startBrokerSyncTimer();
     }
 }
 
@@ -5700,16 +5685,7 @@ void ONMainWindow::slotRetTermSess ( bool result,  
QString output,
     }
     if ( selectSessionDlg->isVisible() )
         selectSessionDlg->setEnabled ( true );
-    if(brokerMode)
-    {
-        ignoreBrokerSessions=false;
-    }
-
-    if(brokerMode && config.brokerSyncTimeout && 
!(brokerSyncTimer->isActive()))
-    {
-            brokerSyncTimer->start();
-    }
-
+    startBrokerSyncTimer();
 }
 
 void ONMainWindow::slotRetResumeSess ( bool result,
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index 9b4a0bd..2a69494 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -1025,7 +1025,7 @@ private:
      */
     static bool get_translator (const QString file_name_start, QTranslator 
**translator);
     void getClientKeyboardConfig(QString& layout, QString& model, QString& 
variant);
-
+    void startBrokerSyncTimer();
 
 protected:
     virtual void closeEvent ( QCloseEvent* event );

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on 
/srv/git/code.x2go.org/x2goclient.git
_______________________________________________
x2go-commits mailing list
x2go-commits@lists.x2go.org
https://lists.x2go.org/listinfo/x2go-commits

Reply via email to