[X2Go-Commits] [x2goclient] 01/01: Fix crashing if the path for automount in the session config file in wrong format. Supporting both Windows and Linux path in automount format. Check if path exists before mounting.

git-admin at x2go.org git-admin at x2go.org
Tue Sep 3 11:16:09 CEST 2019


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

x2go pushed a commit to branch master
in repository x2goclient.

commit bf08804c6e2b46d187b03913de7e90c4d25823b6
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Sep 3 11:15:44 2019 +0200

    Fix crashing if the path for automount in the session config file in wrong format. Supporting both Windows and Linux path in automount format. Check if path exists before mounting.
---
 debian/changelog     |  2 ++
 src/onmainwindow.cpp | 31 ++++++++++++++++++++++---------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index cd51a3e..5275843 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,8 @@ x2goclient (4.1.2.2-0x2go1) UNRELEASED; urgency=medium
       Client will display this information to user on session button.
     - update copyright years in about dialog.
     - Do not show password in debug output of HTTP broker.
+    - Fix crashing if the path for automount in the session config file in wrong
+      format. Supporting both Windows and Linux path in automount format. Check if path exists before mounting.
 
   [ Mihai Moldovan ]
   * New upstream version (4.1.2.2):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 38872bb..386c116 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -8657,17 +8657,21 @@ void ONMainWindow::exportDefaultDirs()
                                         QString::SkipEmptyParts );
             for ( int i=0; i<lst.size(); ++i )
             {
-#ifndef Q_OS_WIN
-                QStringList tails=lst[i].split (
-                                      ":",
-                                      QString::SkipEmptyParts );
-#else
-
+                //check if directory is in Windows client format
+                QChar splitChar='#';
+                if(lst[i].indexOf(splitChar)==-1)
+                {
+                    //Linux client format
+                    splitChar=':';
+                }
                 QStringList tails=lst[i].split (
-                                      "#",
+                                      splitChar,
                                       QString::SkipEmptyParts );
-#endif
-
+                if(tails.length()!=2)
+                {
+                    //wrong format
+                    continue;
+                }
                 if ( tails[1]=="1" )
                 {
 #ifdef Q_OS_WIN
@@ -8678,7 +8682,15 @@ void ONMainWindow::exportDefaultDirs()
                         tails[0].replace (
                             "(U3)",u3Device );
                     }
+#endif
 
+                    if(!QFile::exists(tails[0]))
+                    {
+                        x2goDebug<<"Path "<<tails[0]<<" not found";
+                        continue;
+                    }
+
+#ifdef Q_OS_WIN
                     tails[0]=cygwinPath (
                                  wapiShortFileName (
                                      tails[0] ) );
@@ -8739,6 +8751,7 @@ void ONMainWindow::exportDefaultDirs()
     }
     if ( dirs.size() <=0 )
         return;
+
     exportDirs ( dirs.join ( ":" ) );
 }
 

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