[X2Go-Commits] [x2goclient] 01/01: Provide more meaningful messages on SSH errors (host pub key not found, export pub key not found, authorized_keys file not found). For SSHd startup failures provide different messages on Windows and non-Windows machines. (Fixes: #235). FIXME: add detection code to report SSH daemon startup failures.

git-admin at x2go.org git-admin at x2go.org
Sat Jun 28 22:40:09 CEST 2014


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

x2go pushed a commit to branch master
in repository x2goclient.

commit d386996ca3b8b5b085a16d0208670ffb7fde7b3d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Jun 28 22:38:48 2014 +0200

    Provide more meaningful messages on SSH errors (host pub key not found, export pub key not found, authorized_keys file not found). For SSHd startup failures provide different messages on Windows and non-Windows machines. (Fixes: #235). FIXME: add detection code to report SSH daemon startup failures.
---
 debian/changelog |    5 ++++
 onmainwindow.cpp |   75 ++++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 69 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 75ed144..ff288f4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,11 @@ x2goclient (4.0.2.1-0x2go1) UNRELEASED; urgency=low
       tray icon). (Fixes: #365).
     - Disallow server-side users to override X2Go Server commands via
       ~/bin (or similar). (Fixes: #336).
+    - Provide more meaningful messages on SSH errors (host pub key not
+      found, export pub key not found, authorized_keys file not found).
+      For SSHd startup failures provide different messages on Windows
+      and non-Windows machines. (Fixes: #235).
+      FIXME: add detection code to report SSH daemon startup failures.
   * debian/control:
     + Add dbg:package x2goplugin-dbg.
 
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 99742e2..534e744 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -7812,10 +7812,11 @@ QString ONMainWindow::createRSAKey()
         generateHostDsaKey();
         generateEtcFiles();
         startSshd();
+        /* FIXME: test successful SSH daemon startup */
         rsa.setFileName ( homeDir+"/.x2go/etc/ssh_host_dsa_key.pub" );
         rsa.open ( QIODevice::ReadOnly | QIODevice::Text );
 #else
-        printSshDError();
+        printSshDError_noHostPubKey();
         return QString::null;
 #endif
     }
@@ -7934,7 +7935,7 @@ void ONMainWindow::slotRetExportDir ( bool result,QString output,
     QFile file ( key+".pub" );
     if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
     {
-        printSshDError();
+        printSshDError_noExportPubKey();
         QFile::remove
         ( key+".pub" );
         return;
@@ -7955,7 +7956,7 @@ void ONMainWindow::slotRetExportDir ( bool result,QString output,
     file.setFileName ( authofname );
     if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
     {
-        printSshDError();
+        printSshDError_noAuthorizedKeysFile();
         QFile::remove
         ( key+".pub" );
         return;
@@ -9994,6 +9995,7 @@ void ONMainWindow::startSshd()
                      clientdir.c_str(), // Starting directory
                      &si,            // Pointer to STARTUPINFO structure
                      &sshd );// Pointer to PROCESS_INFORMATION structure
+    /* FIXME: test successful SSH daemon startup */
     delete []desktop;
     winSshdStarted=true;
 #else
@@ -10003,6 +10005,7 @@ void ONMainWindow::startSshd()
     arguments<<"-f"<<etcDir +"/sshd_config"<< "-h" <<
              etcDir+"/ssh_host_dsa_key"<<"-D"<<"-p"<<clientSshPort;
     sshd->start ( appDir+"/sshd",arguments );
+    /* FIXME: test successful SSH daemon startup */
     x2goDebug<<"Usermode sshd started.";
 
 #endif
@@ -11359,17 +11362,67 @@ void ONMainWindow::initSelectSessDlg()
 
 
 
-void ONMainWindow::printSshDError()
+void ONMainWindow::printSshDError_startupFailure()
+{
+#ifdef Q_OS_WIN
+    if ( closeEventSent )
+        return;
+    QMessageBox::critical ( 0l,tr ( "SSH Error" ),
+                            tr ( "SSH daemon could not be started.\n\n"
+
+                                 "You'll need SSH daemon for printing and file sharing.\n\n"
+
+                                 "Normally, this should not happen as X2Go Client for \n"
+                                 "Windows ships its internal sshd.exe.\n\n"
+
+                                 "If you see this message, please report a bug against\n"
+                                 "the X2Go bugtracker."
+                            ),
+                            QMessageBox::Ok,QMessageBox::NoButton );
+#else
+    if ( closeEventSent )
+        return;
+    QMessageBox::critical ( 0l,tr ( "SSH Error" ),
+                            tr ( "SSH daemon is not running.\n\n"
+
+                                 "You'll need SSH daemon for printing and file sharing\n\n"
+
+                                 "Please ask your system administrator to provide the SSH\n"
+                                 "service on your computer."
+                            ),
+                            QMessageBox::Ok,QMessageBox::NoButton );
+#endif
+}
+
+void ONMainWindow::printSshDError_noHostPubKey()
+{
+    if ( closeEventSent )
+        return;
+    QMessageBox::critical ( 0l,tr ( "SSH Error" ),
+                            tr ( "SSH daemon failed to open the application's public host key."
+                            ),
+                            QMessageBox::Ok,QMessageBox::NoButton );
+}
+
+void ONMainWindow::printSshDError_noExportPubKey()
+{
+    if ( closeEventSent )
+        return;
+    QMessageBox::critical ( 0l,tr ( "SSH Error" ),
+                            tr ( "SSH daemon failed to open the application's public key\n"
+                                 "used for exporting folders and printers."
+                            ),
+                            QMessageBox::Ok,QMessageBox::NoButton );
+}
+
+void ONMainWindow::printSshDError_noAuthorizedKeysFile()
 {
     if ( closeEventSent )
         return;
-    QMessageBox::critical ( 0l,tr ( "Error" ),
-                            tr ( "sshd not started, "
-                                 "you'll need sshd for printing "
-                                 "and file sharing\n"
-                                 "you can install sshd with\n"
-                                 "<b>sudo apt-get install "
-                                 "openssh-server</b>" ),
+    QMessageBox::critical ( 0l,tr ( "SSH Error" ),
+                            tr ( "SSH daemon failed to open the application's\n"
+                                 "authoized_keys file."
+                            ),
                             QMessageBox::Ok,QMessageBox::NoButton );
 }
 

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list