[X2go-Commits] x2goclient.git - master (branch) updated: 3.99.2.0-18-gadefcb0

X2Go dev team git-admin at x2go.org
Sat Jun 2 07:26:46 CEST 2012


The branch, master has been updated
       via  adefcb0cd27987107424e251a4d172b930390a14 (commit)
       via  f388d5f473a4939730a10ecb1e50611c45732717 (commit)
       via  1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd (commit)
       via  dd0a6376138afbaec5b5447360a32bf6bdf24d7b (commit)
       via  bad7a0bdb342649e5cad359d644bd5e33cbf7d54 (commit)
       via  367b245a575649a16fe01320f0ba412cc5fa73a5 (commit)
       via  ea3adb1cce7727a6114537ee3039e044f297d2dd (commit)
       via  82e8f77fc996de04b148ae9c6d53a78f37442ec9 (commit)
      from  4f41b1600794e06c5a9ec5e14b1621c52f867ae0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit adefcb0cd27987107424e251a4d172b930390a14
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 05:29:33 2012 +0200

    Add support for Mac OS X 10.4 Tiger. It won't be officially supported though.
    
    This patch enables a compatibility mode for Mac OS X 10.4.
    Using this, interaction with the local X11 server and a remote server
    works fine.
    
    Note however, that there is one limitation: x2goclient will start one
    X11 server per connection. For security reasons, this is necessary.
    It will *not* clean up X11 server processes. This is left to the user.
    
    More information about 10.4 support will be posted on the x2go-dev
    mailing list (shortly).

commit f388d5f473a4939730a10ecb1e50611c45732717
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 04:09:47 2012 +0200

    Add easy to turn on/off SSH packet logging to sshmasterconnection.cpp.
    
    From now on, simply use the defines at the beginning of the file.

commit 1b21d75f2c10609f3586f5b5e0b4ceb7fca83fdd
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 04:06:42 2012 +0200

    Fix a potential bug in the handling of ssh hosts given to libssh.
    
    Do the conversion as suggested by the Qt FAQ at
    http://qt-project.org/faq/answer/how_can_i_convert_a_qstring_to_char_and_vice_versa

commit dd0a6376138afbaec5b5447360a32bf6bdf24d7b
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 03:59:41 2012 +0200

    Fix copyright header on sshmasterconnection.cpp

commit bad7a0bdb342649e5cad359d644bd5e33cbf7d54
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 03:53:27 2012 +0200

    Change the Makefile to not delete more temporary files than necessary.
    
    A maxdepth of two will crush all temp files in the build directories.
    Do not mess with other stuff, especially if users are building bundled
    software inside a contrib/dist directory under the main tree.

commit 367b245a575649a16fe01320f0ba412cc5fa73a5
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 03:47:47 2012 +0200

    Add support for PowerPC on Mac OS X. Add the Info.plist file to x2goclient.pro

commit ea3adb1cce7727a6114537ee3039e044f297d2dd
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 03:41:05 2012 +0200

    Minor style/whitespace fixes for x2goclient.pro.

commit 82e8f77fc996de04b148ae9c6d53a78f37442ec9
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat May 26 03:38:05 2012 +0200

    Add translation file processing to x2goclient.pro.
    
    Automatically build the required x2goclient_*.qm files based on the
    x2goclient_*.ts translation files.

-----------------------------------------------------------------------

Summary of changes:
 Makefile                |    8 ++--
 onmainwindow.cpp        |  132 ++++++++++++++++++++++++++++++++++++++++++++---
 sshmasterconnection.cpp |   19 +++++--
 x2goclient.pro          |   31 +++++++++---
 4 files changed, 166 insertions(+), 24 deletions(-)

The diff of changes is:
diff --git a/Makefile b/Makefile
index 30c12dc..19d83db 100755
--- a/Makefile
+++ b/Makefile
@@ -41,10 +41,10 @@ build_man:
 	${MAKE} -f Makefile.man2html build
 
 clean: clean_client clean_plugin clean_man
-	find . -type f -name '*.o' -exec rm -vf {} +
-	find . -type f -name 'moc_*.cpp' -exec rm -vf {} +
-	find . -type f -name 'ui_*.h' -exec rm -vf {} +
-	find . -type f -name 'qrc_*.cpp' -exec rm -vf {} +
+	find . -type f -maxdepth 2 -name '*.o' -exec rm -vf {} +
+	find . -type f -maxdepth 2 -name 'moc_*.cpp' -exec rm -vf {} +
+	find . -type f -maxdepth 2 -name 'ui_*.h' -exec rm -vf {} +
+	find . -type f -maxdepth 2 -name 'qrc_*.cpp' -exec rm -vf {} +
 	rm -f x2goclient
 	rm -f x2goclient.tag
 
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 9a55755..7bda2ed 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -4730,10 +4730,22 @@ void ONMainWindow::slotTunnelOk()
     }
 #endif // Q_OS_WIN
 #if defined ( Q_OS_DARWIN )
-    //setting /usr/X11/bin to find xauth
+    // setting /usr/X11/bin to find xauth
+    // /usr/X11R6/bin is added for compatibility reasons with OS X 10.4.
     env.insert (
         0,
-        "PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" );
+        "PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin" );
+    // Set the NX base dir to bundle/exe/, used for finding nxauth.
+    {
+        QDir tmpDir (appDir);
+        tmpDir.cd ("../exe");
+        env.append ("NX_SYSTEM=" + tmpDir.absolutePath ());
+    }
+    if (dispInd == -1)
+    {
+        x2goDebug << "No DISPLAY variable found in global environment, using autodetected setting.";
+        env.append ("DISPLAY=" + disp);
+    }
 #endif
     nxproxy->setEnvironment ( env );
     /*	x2goDebug<<"new env:"<<endl;
@@ -7592,19 +7604,123 @@ QString ONMainWindow::getXDisplay()
     QLocalSocket unixSocket (this);
     QString xsocket (getenv ("DISPLAY"));
 
-    // OS X starts the X11 server automatically, as soon as the launchd UNIX socket
-    // is accessed.
+    if (xsocket.isEmpty ())
+    {
+        // Mac OS X 10.4 compatibility mode.
+        // There, it is possible no $DISPLAY variable is set.
+        // Start X11 manually. First, find a free display number.
+        x2goDebug << "entering 10.4 compat mode, checking for free X11 display";
+
+        int xFreeDisp = 0;
+        QDir xtmpdir ("/tmp/.X11-unix");
+
+        if (xtmpdir.exists ())
+        {
+            xtmpdir.setFilter (QDir::Files | QDir::System | QDir::NoSymLinks | QDir::NoDotAndDotDot);
+            xtmpdir.setSorting (QDir::Name);
+
+            QFileInfoList xtmpdirList = xtmpdir.entryInfoList ();
+            bool foundFreeDisp = FALSE;
+            xFreeDisp = -1;
+
+            for (int i = 0; (i < 2000) && (!foundFreeDisp); ++i)
+            {
+                QFileInfo xtmpdirFile (xtmpdir.absolutePath () + "/X" + QString::number (i));
+
+                if ((!xtmpdirFile.exists ()) && (!xtmpdirFile.isSymLink ()))
+                {
+                    xFreeDisp = i;
+                    foundFreeDisp = TRUE;
+                }
+            }
+        }
+
+        // Control flow will go to error condition if no free display port has been found.
+        if (xFreeDisp != -1)
+        {
+            xsocket = "/tmp/.X11-unix/X" + QString::number (xFreeDisp);
+            x2goDebug << "Successfully detected free socket " << xsocket << ".";
+        }
+
+        if (!(xsocket.isEmpty ()))
+        {
+            QString xname = ConfigDialog::getXDarwinDirectory () + "/Contents/MacOS/X11";
+            QString xopt = ":" + QString::number (xFreeDisp);
+            QProcessEnvironment env = QProcessEnvironment::systemEnvironment ();
+            QProcess* startx = new QProcess (this);
+
+            x2goDebug << "Starting the X server on free display port.";
+            env.insert (0, "PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin");
+
+            startx->setProcessEnvironment (env);
+            startx->start (xname + QString (" ") + xopt, QIODevice::NotOpen);
+            if (startx->waitForStarted (3000))
+            {
+                x2goDebug << "sleeping for three seconds";
+                int sleeptime = 3;
+                while ((sleeptime = sleep (sleeptime))) {};
+
+                x2goDebug << "Leaving OS X 10.4 compat mode.";
+            }
+        }
+    }
+
+    // OS X >= 10.5 starts the X11 server automatically, as soon as the
+    // launchd UNIX socket is accessed.
     // On user login, the DISPLAY environment variable is set to this said existing
     // socket.
-    // By now, we should have a socket. Test, if connecting works.
-    if ((!xsocket.isEmpty ()))
-    {
+    // By now, we should have a socket, even on 10.4. Test, if connecting works.
+    // Note: common sense may tell you to change this if into an else. Don't.
+    // We do not want to skip this part, if coming from the compat section above.
+    if (!(xsocket.isEmpty ()))
+    {
+        if (xsocket[0] == ':')
+        {
+            // Be backwards compatible with 10.4.
+            // Delete the ":" character.
+            xsocket.remove (0, 1);
+            // xsocket may now contain the display value (one integer),
+            // or something like "0.0" - we're only interested in the
+            // display value, so keep the first char only.
+            if (xsocket.indexOf (".") != -1)
+            {
+                xsocket = xsocket.left (xsocket.indexOf ("."));
+            }
+            // Prepend the well-known socket path.
+            xsocket.prepend ("/tmp/.X11-unix/X");
+            x2goDebug << "xsocket in compat mode: " << xsocket;
+        }
+
         unixSocket.connectToServer (xsocket);
 
         if (unixSocket.waitForConnected (10000))
         {
             unixSocket.disconnectFromServer ();
-            return (xsocket);
+
+            // Mac OS X 10.4 compat: nxproxy expects
+            // a DISPLAY variable like ":0", passing
+            // an UNIX socket will just make it error out.
+            // Instead of altering the nxproxy code, which does
+            // already try to connect to "/tmp/.X11-unix/Xi" with
+            // i = display number, pass ":i" as DISPLAY.
+            if (xsocket.left (16).compare ("/tmp/.x11-unix/x", Qt::CaseInsensitive) == 0)
+            {
+                bool ok = FALSE;
+                int tmp = -1;
+
+                xsocket = xsocket.mid (16);
+                tmp = xsocket.toInt (&ok);
+
+                if (ok)
+                {
+                    x2goDebug << "Returning" << QString (":") + xsocket;
+                    return (QString (":") + xsocket);
+                }
+            }
+            else
+            {
+              return (xsocket);
+            }
         }
     }
     // And if not, error out.
diff --git a/sshmasterconnection.cpp b/sshmasterconnection.cpp
index 1f7b724..9eba130 100644
--- a/sshmasterconnection.cpp
+++ b/sshmasterconnection.cpp
@@ -1,7 +1,7 @@
 
 /***************************************************************************
- *   Copyright (C) 2005-2012 by Oleksandr Shneyder   *
- *   oleksandr.shneyder at obviously-nice.de   *
+ *   Copyright (C) 2005-2012 by Oleksandr Shneyder                         *
+ *   oleksandr.shneyder at obviously-nice.de                                  *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -46,6 +46,9 @@
 #undef DEBUG
 //#define DEBUG
 
+//#define SSH_DEBUG
+#undef SSH_DEBUG
+
 static bool isLibSshInited=false;
 
 
@@ -142,7 +145,12 @@ void SshMasterConnection::run()
     }
 #endif
 
-//     int verbosity=SSH_LOG_PROTOCOL;
+#ifdef SSH_DEBUG
+    int verbosity=SSH_LOG_PACKET;
+#else
+    int verbosity=SSH_LOG_NOLOG;
+#endif
+
     long timeout = 60;
 
     my_ssh_session = ssh_new();
@@ -159,7 +167,7 @@ void SshMasterConnection::run()
 #ifdef Q_OS_WIN
     ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, (mainWnd->getHomeDirectory()+"/ssh").toAscii());
 #endif
-//     ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
+    ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
 
     ssh_options_set(my_ssh_session, SSH_OPTIONS_TIMEOUT, &timeout);
 
@@ -277,7 +285,8 @@ void SshMasterConnection::finalizeLibSsh()
 bool SshMasterConnection::sshConnect()
 {
     int rc;
-    ssh_options_set ( my_ssh_session, SSH_OPTIONS_HOST, host.toAscii() );
+    QByteArray tmpBA = host.toLocal8Bit();
+    ssh_options_set ( my_ssh_session, SSH_OPTIONS_HOST, tmpBA.data() );
     ssh_options_set ( my_ssh_session, SSH_OPTIONS_PORT, &port );
     rc = ssh_connect ( my_ssh_session );
     if ( rc != SSH_OK )
diff --git a/x2goclient.pro b/x2goclient.pro
index e9b3599..e831f5b 100755
--- a/x2goclient.pro
+++ b/x2goclient.pro
@@ -105,7 +105,7 @@ LIBS += -lssh
 plugin {
 	TARGET = x2goplugin
 }
-else{
+else {
 	RC_FILE = x2goclient.rc
 	SOURCES += x2goclient.cpp
 	TARGET = x2goclient
@@ -113,6 +113,24 @@ else{
 	message(if you want to build x2goplugin you should export X2GO_CLIENT_TARGET=plugin)
 }
 
+!isEmpty(TRANSLATIONS) {
+  isEmpty(QMAKE_LRELEASE) {
+    win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
+    else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
+  }
+
+  isEmpty(TS_DIR):TS_DIR = .
+
+  TSQM.name = lrelease ${QMAKE_FILE_IN}
+  TSQM.input = TRANSLATIONS
+  TSQM.output = $$TS_DIR/${QMAKE_FILE_BASE}.qm
+  TSQM.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN}
+  TSQM.CONFIG = no_link
+  QMAKE_EXTRA_COMPILERS += TSQM
+  PRE_TARGETDEPS += compiler_TSQM_make_all
+}
+else:message(No translation files in project)
+
 TEMPLATE = app
 DEPENDPATH += .
 INCLUDEPATH += .
@@ -136,7 +154,7 @@ x2go_linux_static {
 macx {
 	message(building $$TARGET with ldap and cups)
 	LIBS += -framework LDAP -lcups -lcrypto -lssl -lz
-	CONFIG += x86 x86_64
+	CONFIG += x86 x86_64 ppc
 }
 win32-* {
 	message(building $$TARGET for windows without ldap and cups)
@@ -144,12 +162,12 @@ win32-* {
 	CONFIG += static release
 }
 QT += svg network
-ICON =icons/x2go-mac.icns
+ICON = icons/x2go-mac.icns
+QMAKE_INFO_PLIST = Info.plist
 QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk
 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.5
 
-plugin{
-
+plugin {
 	DEFINES += CFGPLUGIN
 	linux-g++ {
 		include(qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.pri)
@@ -161,7 +179,6 @@ plugin{
 		DEFINES += QT_NODLL
 		CONFIG += qaxserver
 		include(qtbrowserplugin-2.4_1-opensource/src/qtbrowserplugin.pri)
-		}
+	}
 	RC_FILE = x2goplugin.rc
-
 }


hooks/post-receive
-- 
x2goclient.git (X2Go Client)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goclient.git" (X2Go Client).




More information about the x2go-commits mailing list