[X2Go-Commits] [x2goclient] 223/280: 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
Wed Jan 18 12:26:03 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 0eaec37ac0faaad3537d8905195021b6c2b3b641
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 1f3e47c..4a939fd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -418,6 +418,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 69d6573..183231a 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10383,6 +10383,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 ();
         }
     }
 
@@ -10446,7 +10447,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