[X2Go-Commits] [x2goclient] 223/281: src/onmainwindow.cpp: add more error handling to generateKey () and fix up a broken error-handling section.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 19 13:06:01 CET 2017


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

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 0ada6b7a185fe6c331b426d286452bbdc7d035fe
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Sep 23 03:12:43 2016 +0200

    src/onmainwindow.cpp: add more error handling to generateKey () and fix up a broken error-handling section.
---
 debian/changelog     |    2 ++
 src/onmainwindow.cpp |   30 +++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index d02abed..1c16930 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -419,6 +419,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       value.) Change all locations referencing generateKey () to use the
       return value (if necessary) and remove dead code that was used to
       generate a user key manually previously.
+    - src/onmainwindow.cpp: add more error handling to generateKey () and fix
+      up a broken error-handling section.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 378a7f2..8c542b1 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10382,6 +10382,7 @@ QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_ke
                                    tr ("Unable to create SSH key base directory '%1'.").arg (base_dir)
                                    + "\n"
                                    + tr ("Terminating application."));
+            close ();
         }
     }
 
@@ -10445,7 +10446,34 @@ QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_ke
              << comment
              << "-f"
              << private_key_file;
-        QProcess::execute ("ssh-keygen", args);
+
+        const int keygen_ret = QProcess::execute ("ssh-keygen", args);
+
+        if (-2 == keygen_ret) {
+            QMessageBox::critical (this, tr ("ssh-keygen launching error"),
+                                   tr ("Unable to start the ssh-keygen binary.")
+                                   + "\n"
+                                   + tr ("Terminating application."));
+            close ();
+        }
+
+        if (-1 == keygen_ret) {
+            QMessageBox::critical (this, tr ("ssh-keygen crashed"),
+                                   tr ("The ssh-keygen binary crashed.")
+                                   + "\n"
+                                   + tr ("Terminating application."));
+            close ();
+        }
+
+        if (0 != keygen_ret) {
+            QMessageBox::critical (this, tr ("ssh-keygen program error"),
+                                   tr ("The ssh-keygen binary did not exit cleanly.")
+                                   + " "
+                                   + tr ("It was probably called with unknown arguments.")
+                                   + "\n"
+                                   + tr ("Terminating application."));
+            close ();
+        }
     }
 
     return (ret);

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


More information about the x2go-commits mailing list