libnxcl: various updates from my work for the n810
authorwoglinde <heinold@inf.fu-berlin.de>
Thu, 27 Nov 2008 01:03:16 +0000 (02:03 +0100)
committerwoglinde <heinold@inf.fu-berlin.de>
Thu, 27 Nov 2008 01:03:16 +0000 (02:03 +0100)
* adding ssh proxy support
* delete the client logfiles option
* warnings about ssh errors
* better ssh-key handling
* bump PR

packages/nxcl/files/deletelogfiles.patch [new file with mode: 0644]
packages/nxcl/files/dodnx.patch [new file with mode: 0644]
packages/nxcl/files/gcc-warnings.patch [new file with mode: 0644]
packages/nxcl/files/gcc4.3-ftbfs.patch
packages/nxcl/files/publicKey.patch [new file with mode: 0644]
packages/nxcl/files/restorekeyboard.patch [new file with mode: 0644]
packages/nxcl/files/ssh_dnserror.patch [new file with mode: 0644]
packages/nxcl/libnxcl_0.9.bb

diff --git a/packages/nxcl/files/deletelogfiles.patch b/packages/nxcl/files/deletelogfiles.patch
new file mode 100644 (file)
index 0000000..9e5b10d
--- /dev/null
@@ -0,0 +1,136 @@
+Index: nxcl-0.9/lib/nxclientlib.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/nxclientlib.cpp  2008-10-15 15:09:17.000000000 +0200
++++ nxcl-0.9/lib/nxclientlib.cpp       2008-10-15 15:30:33.000000000 +0200
+@@ -27,6 +27,8 @@
+ #include "../config.h"
+ #include <fstream>
++#include <iostream>
++#include <string>
+ extern "C" {
+     #include <errno.h>
+@@ -966,4 +968,68 @@
+     free (buf);
+     return path;
+ }
++
++int NXClientLib::fmatch(const struct dirent *direntry)
++{
++        if (strncmp(direntry->d_name, "S", 1) == 0){
++                return 1;
++        }
++        return 0;
++}
++
++
++bool NXClientLib::deleteAllSessionfiles()
++{
++    struct dirent **filelist;
++    DIR *Directory;
++    int filescount = 0;
++    int i;
++    ifstream sessionfile;
++    string line, rmsesdir;
++
++    char * home;
++    stringstream ss;
++    string nxdir;
++
++    home = getenv ("HOME");
++
++    ss << home;
++
++    nxdir = ss.str() + "/.nx";
++
++    Directory = opendir(nxdir.c_str());
++
++    if( Directory )
++    {
++       filescount = scandir(nxdir.c_str(), &filelist, fmatch, alphasort);
++
++       for (i=0; i < filescount; i++)
++       {
++                rmsesdir = nxdir + "/" + string(filelist[i]->d_name) + "/";
++                sessionfile.open((rmsesdir + "session").c_str());
++
++                if ( sessionfile.is_open() )
++                {
++                    while( !sessionfile.eof() )
++                    {
++                        getline(sessionfile,line);
++                        if ( (line.find("Session terminated") != string::npos) ||
++                              (line.find("Exiting keeper") != string::npos) )
++                        {
++                                // lazy deletion but it works
++                                remove( (rmsesdir + "errors").c_str() );
++                                remove( (rmsesdir + "options").c_str() );
++                                remove( (rmsesdir + "session").c_str() );
++                                remove( (rmsesdir + "stats").c_str() );
++                                remove(rmsesdir.c_str());
++                                break;
++                        }
++                    }
++                }
++       }
++       return true;
++     }
++     return false;
++}
++
+ //@}
+Index: nxcl-0.9/lib/nxclientlib.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxclientlib.h    2008-10-15 15:09:17.000000000 +0200
++++ nxcl-0.9/lib/nxclientlib.h 2008-10-15 15:09:17.000000000 +0200
+@@ -25,10 +25,14 @@
+ #define _NXCLIENTLIB_H_
+ #include <iostream>
+-#include "nxsession.h"
+ #include <list>
++
++#include "nxsession.h"
+ #include "notQt.h"
++extern "C" {
++          #include <dirent.h>
++}
+ using namespace std;
+@@ -375,6 +379,11 @@
+             {
+                 return this->sessionRunning;
+             }
++
++          // static function so we do not need an explicit object
++          // for deleting the session files
++          static bool deleteAllSessionfiles(void);
++
+             //@}
+         private:
+@@ -493,6 +502,7 @@
+              */
+             int httpProxyPort;
++          static int fmatch(const struct dirent *direntry);
+     };
+ } // namespace
+Index: nxcl-0.9/lib/nxdata.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxdata.h 2008-10-15 15:09:17.000000000 +0200
++++ nxcl-0.9/lib/nxdata.h      2008-10-15 15:09:17.000000000 +0200
+@@ -77,6 +77,9 @@
+         bool proxyAuthenticated;
+         string proxyUser;
+         string proxyPass;
++      // small hack for storing this
++      // easier than workaround in the client
++      bool delSessionfiles;
+     };
+     struct NXSessionData {
diff --git a/packages/nxcl/files/dodnx.patch b/packages/nxcl/files/dodnx.patch
new file mode 100644 (file)
index 0000000..5bf606c
--- /dev/null
@@ -0,0 +1,329 @@
+Index: nxcl-0.9/lib/notQt.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/notQt.cpp        2008-10-10 20:09:53.000000000 +0200
++++ nxcl-0.9/lib/notQt.cpp     2008-10-10 20:10:26.000000000 +0200
+@@ -443,6 +443,9 @@
+     void
+ notQtUtilities::splitString (string& line, char token, vector<string>& rtn)
+ {
++    if (line.size() < 1)
++        return;
++
+     rtn.clear();
+     unsigned int i=0;
+     while (i < (line.size())-1) {
+@@ -459,6 +462,9 @@
+     void
+ notQtUtilities::splitString (string& line, char token, list<string>& rtn)
+ {
++    if (line.size() < 1)
++        return;
++
+     rtn.clear();
+     unsigned int i=0;
+     while (i < (line.size())-1) {
+Index: nxcl-0.9/lib/nxclientlib.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/nxclientlib.cpp  2008-10-10 20:09:53.000000000 +0200
++++ nxcl-0.9/lib/nxclientlib.cpp       2008-10-10 20:10:26.000000000 +0200
+@@ -152,6 +152,8 @@
+     this->sessionRunning = false;
+     this->proxyData.encrypted = false;
+     this->password = false;
++    this->useHttpProxy = false;
++    this->httpProxyAuthenticated = false;
+     dbgln ("In NXClientLib constructor");
+@@ -172,6 +174,22 @@
+     dbgln ("In NXClientLib destructor");
+ }
++void NXClientLib::setProxy (string proxyHost,
++                    string proxyUser,
++                    string proxyPass,
++                    int proxyPort)
++{
++    useHttpProxy = true;
++    httpProxyHost = proxyHost;
++
++    if (!httpProxyUser.empty())
++        httpProxyAuthenticated = true;
++
++    httpProxyUser = proxyUser;
++    httpProxyPass = proxyPass;
++    httpProxyPort = proxyPort;
++}
++
+ void NXClientLib::invokeNXSSH (string publicKey, string serverHost,
+         bool encryption, string key, int port)
+ {
+@@ -228,6 +246,21 @@
+     arguments.push_back ("-oRhostsRSAAuthentication no");
+     arguments.push_back ("-oPubkeyAuthentication yes");
++    // Proxy support
++
++    if (useHttpProxy) {
++        arguments.push_back("-P");
++
++        argtmp.str("");
++
++        if (httpProxyAuthenticated)
++            argtmp << this->httpProxyUser << ":" << this->httpProxyPass << "@";
++
++        argtmp << this->httpProxyHost << ":" << this->httpProxyPort;
++
++        arguments.push_back(argtmp.str());
++    }
++
+     if (encryption == true) {
+         arguments.push_back("-B");
+         session.setEncryption (true);
+@@ -785,7 +818,7 @@
+     nxwinArguments.push_back(fontPath.str());
+     nxwinArguments.push_back("-name");
+-    nxwinArguments.push_back("NXWin");
++    nxwinArguments.push_back("DoD");
+     nxwinArguments.push_back(":0");
+     nxwinArguments.push_back("-screen");
+Index: nxcl-0.9/lib/nxclientlib.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxclientlib.h    2008-10-10 20:09:53.000000000 +0200
++++ nxcl-0.9/lib/nxclientlib.h 2008-10-10 20:10:26.000000000 +0200
+@@ -178,6 +178,21 @@
+                     int port = 22);
+             /*!
++             * Set proxy server settings for nxssh.
++             *
++             * \param proxyHost is the hostname
++             *
++             * \param proxyUser is the username (null if not necessary)
++             *
++             * \param proxyPass is the password
++             *
++             * \param proxyPort is the port
++             */
++            void setProxy (string proxyHost,
++                    string proxyUser,
++                    string proxyPass,
++                    int proxyPort);
++            /*!
+              * Overloaded to give callback data on write.
+              * 
+              * Writes data to this->nxsshProcess stdin and also
+@@ -453,6 +468,31 @@
+              * Password for the connection
+              */
+             string nxpass;
++            /*!
++             * Whether to use an http proxy for nxssh
++             */
++            bool useHttpProxy;
++            /*!
++             * A proxy server to be used with nxssh
++             */
++            string httpProxyHost;
++            /*!
++             * Whether to use authentication
++             */
++            bool httpProxyAuthenticated;
++            /*!
++             * Username for the http proxy
++             */
++            string httpProxyUser;
++            /*!
++             * Password for the http proxy
++             */
++            string httpProxyPass;
++            /*!
++             * Port for the http proxy
++             */
++            int httpProxyPort;
++
+     };
+ } // namespace
+Index: nxcl-0.9/lib/nxdata.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxdata.h 2008-10-10 20:09:53.000000000 +0200
++++ nxcl-0.9/lib/nxdata.h      2008-10-10 20:10:26.000000000 +0200
+@@ -1,12 +1,12 @@
+ /***************************************************************************
+-                                nxdata.h
+-                             -------------------
+-    begin                : Wednesday 9th August 2006
+-    modifications        : July 2007
+-    copyright            : (C) 2006 by George Wright
+-    modifications        : (C) 2007 Embedded Software Foundry Ltd. (U.K.)
+-                         :     Author: Sebastian James
+-    email                : seb@esfnet.co.uk, gwright@kde.org
++  nxdata.h
++  -------------------
++begin                : Wednesday 9th August 2006
++modifications        : July 2007
++copyright            : (C) 2006 by George Wright
++modifications        : (C) 2007 Embedded Software Foundry Ltd. (U.K.)
++:     Author: Sebastian James
++email                : seb@esfnet.co.uk, gwright@kde.org
+  ***************************************************************************/
+ /***************************************************************************
+@@ -43,77 +43,83 @@
+ namespace nxcl {
+-      struct NXConfigData {
+-              string serverHost;
+-              int serverPort;
+-              string sessionUser;
+-              string sessionPass;
+-              string sessionName;
+-              string sessionType;
+-              int cache;
+-              int images;
+-              string linkType;
+-              bool render;
+-              string backingstore;
+-              int imageCompressionMethod;
+-              int imageCompressionLevel;
+-              string geometry;
+-              string keyboard;
+-              string kbtype;
+-              bool media;
+-              string agentServer;
+-              string agentUser;
+-              string agentPass;
+-              int cups;
+-              string key;
+-              bool encryption;
+-              bool fullscreen;
+-              bool virtualDesktop;
+-              string customCommand;
+-      };
+-
+-      struct NXSessionData {
+-              string sessionName;
+-              string sessionType;
+-              int cache;
+-              int images;
+-              string linkType;
+-              bool render;
+-              string backingstore;
+-              int imageCompressionMethod;
+-              int imageCompressionLevel;
+-              string geometry;
+-              string keyboard;
+-              string kbtype;
+-              bool media;
+-              string agentServer;
+-              string agentUser;
+-              string agentPass;
+-              int cups;
+-              string id;
+-              string key;
+-              bool encryption;
+-              bool fullscreen;
+-              bool virtualDesktop;
+-              string customCommand;
+-              bool suspended;
+-              int xRes;
+-              int yRes;
+-              int depth;
+-              int display;
+-              bool terminate;
+-      };
+-
+-      struct NXResumeData {
+-              int display;
+-              string sessionType;
+-              string sessionID;
+-              string options;
+-              int depth;
+-              string screen;
+-              string available;
+-              string sessionName;
+-      };
++    struct NXConfigData {
++        string serverHost;
++        int serverPort;
++        string sessionUser;
++        string sessionPass;
++        string sessionName;
++        string sessionType;
++        int cache;
++        int images;
++        string linkType;
++        bool render;
++        string backingstore;
++        int imageCompressionMethod;
++        int imageCompressionLevel;
++        string geometry;
++        string keyboard;
++        string kbtype;
++        bool media;
++        string agentServer;
++        string agentUser;
++        string agentPass;
++        int cups;
++        string key;
++        bool encryption;
++        bool fullscreen;
++        bool virtualDesktop;
++        string customCommand;
++        bool useProxy;
++        string proxyHost;
++        int proxyPort;
++        bool proxyAuthenticated;
++        string proxyUser;
++        string proxyPass;
++    };
++
++    struct NXSessionData {
++        string sessionName;
++        string sessionType;
++        int cache;
++        int images;
++        string linkType;
++        bool render;
++        string backingstore;
++        int imageCompressionMethod;
++        int imageCompressionLevel;
++        string geometry;
++        string keyboard;
++        string kbtype;
++        bool media;
++        string agentServer;
++        string agentUser;
++        string agentPass;
++        int cups;
++        string id;
++        string key;
++        bool encryption;
++        bool fullscreen;
++        bool virtualDesktop;
++        string customCommand;
++        bool suspended;
++        int xRes;
++        int yRes;
++        int depth;
++        int display;
++        bool terminate;
++    };
++
++    struct NXResumeData {
++        int display;
++        string sessionType;
++        string sessionID;
++        string options;
++        int depth;
++        string screen;
++        string available;
++        string sessionName;
++    };
+ } // namespace
+ #endif
diff --git a/packages/nxcl/files/gcc-warnings.patch b/packages/nxcl/files/gcc-warnings.patch
new file mode 100644 (file)
index 0000000..6f928db
--- /dev/null
@@ -0,0 +1,16 @@
+Index: nxcl-0.9/lib/nxsession.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/nxsession.cpp     2008-09-26 10:42:51.000000000 +0200
++++ nxcl-0.9/lib/nxsession.cpp  2008-09-26 10:43:37.000000000 +0200
+@@ -44,9 +44,9 @@
+ using namespace nxcl;
+
+ NXSession::NXSession() :
+-    devurand_fd(-1),
+-    stage(HELLO_NXCLIENT),
+     sessionDataSet(false),
++    stage(HELLO_NXCLIENT),
++    devurand_fd(-1),
+     nxUsername("nouser"),
+     nxPassword("nopass")
+ {
index d73e828..469209a 100644 (file)
@@ -22,8 +22,8 @@ Index: nxcl/lib/nxclientlib.cpp
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <unistd.h>
-+    #include <stdlib.h>
-+    #include <string.h>
++    #include <cstdlib>
++    #include <cstring>
  }
  
  /*
@@ -35,7 +35,7 @@ Index: nxcl/nxcl/nxcl.cpp
  extern "C" {
  #include <dbus/dbus.h>
  #include <X11/Xlib.h>
-+#include <stdlib.h>
++#include <cstdlib>
  }
  
  using namespace nxcl;
diff --git a/packages/nxcl/files/publicKey.patch b/packages/nxcl/files/publicKey.patch
new file mode 100644 (file)
index 0000000..bdb86f9
--- /dev/null
@@ -0,0 +1,12 @@
+Index: nxcl-0.9/lib/nxdata.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxdata.h 2008-10-13 16:36:53.000000000 +0200
++++ nxcl-0.9/lib/nxdata.h      2008-10-13 16:40:32.000000000 +0200
+@@ -66,6 +66,7 @@
+         string agentPass;
+         int cups;
+         string key;
++      string publicKey;
+         bool encryption;
+         bool fullscreen;
+         bool virtualDesktop;
diff --git a/packages/nxcl/files/restorekeyboard.patch b/packages/nxcl/files/restorekeyboard.patch
new file mode 100644 (file)
index 0000000..9fae42b
--- /dev/null
@@ -0,0 +1,25 @@
+Index: nxcl-0.9/lib/nxsession.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/nxsession.cpp    2008-10-10 14:17:04.000000000 +0200
++++ nxcl-0.9/lib/nxsession.cpp 2008-10-10 14:20:27.000000000 +0200
+@@ -284,9 +284,9 @@
+                             << "\" "
+                         // FIXME: This may be some other OS if you compile it on
+                         // Sun, Windows, etc.
+-                        << "--client=\"linux\" "
+-                        << "--keyboard=\"" << this->sessionData->keyboard
+-                            << "\" "
++                        //<< "--client=\"linux\" "
++                        << "--keyboard=\"" << this->sessionData->keyboard << "\" "
++                      << "--kbtype=\"" << this->sessionData->kbtype << "\" "
+                         << "--id=\"" << this->sessionData->id << "\" "
+                         // This may be the key?
+                         << "--display=\"0\" "
+@@ -334,6 +334,7 @@
+                         "M\" --images=\"" << this->sessionData->images <<
+                         "M\" --cookie=\"" << generateCookie() <<
+                         "\" --link=\"" << this->sessionData->linkType <<
++                      "\" --keyboard=\"" << this->sessionData->keyboard <<
+                         "\" --kbtype=\"" << this->sessionData->kbtype <<
+                         "\" --nodelay=\"1\" --encryption=\""
+                             << this->sessionData->encryption <<
diff --git a/packages/nxcl/files/ssh_dnserror.patch b/packages/nxcl/files/ssh_dnserror.patch
new file mode 100644 (file)
index 0000000..c4ad07c
--- /dev/null
@@ -0,0 +1,31 @@
+Index: nxcl-0.9/lib/nxclientlib.cpp
+===================================================================
+--- nxcl-0.9.orig/lib/nxclientlib.cpp  2008-11-05 18:26:26.000000000 +0100
++++ nxcl-0.9/lib/nxclientlib.cpp       2008-11-05 18:27:18.000000000 +0100
+@@ -512,7 +512,13 @@
+                 (NXCL_HOST_KEY_VERIFAILED,
+                  _("SSH host key verification failed"));
+             this->isFinished = true;
+-        }
++        } else if ((*msgiter).find
++              ("Temporary failure in name resolution") != string::npos ) {
++          this->externalCallbacks->write
++              (NXCL_DNS_ERROR,
++               _("DNS namelookup failed"));
++          this->isFinished = true;
++      }
+     }
+ }
+Index: nxcl-0.9/lib/nxdata.h
+===================================================================
+--- nxcl-0.9.orig/lib/nxdata.h 2008-11-05 18:26:26.000000000 +0100
++++ nxcl-0.9/lib/nxdata.h      2008-11-05 18:26:26.000000000 +0100
+@@ -38,6 +38,7 @@
+ #define NXCL_FINISHED               1000009
+ #define NXCL_ALIVE                  1000010
+ #define NXCL_PROCESS_ERROR          1000011
++#define NXCL_DNS_ERROR              1000012
+ using namespace std;
index ea62579..a10c4d5 100644 (file)
@@ -2,12 +2,18 @@ DESCRIPTION = "Backend library for the free nx-clients"
 HOMEPAGE = "http://freenx.berlios.de/"
 SECTION = "libs"
 LICENSE = "GPL"
-PR = "r0"
+PR = "r1"
 
 RDEPENDS = "nxproxy ssh"
 
 SRC_URI = "http://download.berlios.de/freenx/freenx-client-${PV}.tar.bz2 \
           file://gcc4.3-ftbfs.patch;patch=1 \
+          file://dodnx.patch;patch=1 \
+          file://gcc-warnings.patch;patch=1 \
+          file://restorekeyboard.patch;patch=1 \
+          file://publicKey.patch;patch=1 \
+          file://deletelogfiles.patch;patch=1 \
+          file://ssh_dnserror.patch;patch=1 \
          "
 
 S = "${WORKDIR}/freenx-client-${PV}/nxcl"