Subject: Bug#612: x2goclient does not honor export from broker

From: MIng Song <[email-masked]>
Date: Tue, 16 Sep 2014 14:57:42 +0700

Package: x2goclient
Version: 4.0.2.1
Severity: major

Hi,

it seems x2goclient does not load export (local folder sharing) from
broker. Direct connect with local session profile is ok.

My x2gobroker_sessionprofiles.conf contains export directory and disable
printing, however, when using x2goclient with broker, it still forwards
spooling directory & does not mount exported directory.

If i create a session profile in client workstation, and use x2goclient
directly, printing can be disabled and local directory can be forwarded.

Look at the source code, file onmainwindow.cpp, method exportDefaultDirs
load X2goSettings directly without consult config.iniFile.

I have attached here a patch that modifies exportDefaultDirs() to use
config.iniFile incase x2goclient using broker mode. The patch works with
x2goclient linux.

I am not familiar with compiling x2goclient in Windows env, therefore I am
unable to test with x2goclient in Windows.

Any comments?

Thank you very much for such a wonderful project.

Regards,
msongd.
--- x2goclient-4.0.2.1/onmainwindow.cpp	2014-07-11 18:22:42.000000000 +0700
+++ x2goclient-4.0.2.1-new/onmainwindow.cpp	2014-09-16 13:54:32.395544628 +0700
@@ -7655,18 +7655,24 @@
 {
     QStringList dirs;
     bool clientPrinting= ( useLdap && LDAPPrintSupport );
+    X2goSettings* st;
 
     if ( !useLdap )
     {
         if ( !embedMode )
         {
 
-            X2goSettings st ( "sessions" );
-            clientPrinting= st.setting()->value (
+           if (!brokerMode)
+               st= new X2goSettings( "sessions" );
+           else
+               st= new X2goSettings(config.iniFile,QSettings::IniFormat);
+
+            //X2goSettings st ( "sessions" );
+            clientPrinting= st->setting()->value (
                                 lastSession->id() +
                                 "/print", true ).toBool();
 
-            QString exd=st.setting()->value (
+            QString exd=st->setting()->value (
                             lastSession->id() +"/export",
                             ( QVariant ) QString::null ).toString();
             QStringList lst=exd.split ( ";",
@@ -7752,6 +7758,7 @@
                   SLOT ( slotCheckPrintSpool() ) );
         spoolTimer->start ( 2000 );
     }
+    delete st;
     if ( dirs.size() <=0 )
         return;
     exportDirs ( dirs.join ( ":" ) );