[X2Go-Commits] [x2goclient] 232/281: src/onmainwindow.cpp: use the new functions in generateKey ().

git-admin at x2go.org git-admin at x2go.org
Thu Jan 19 13:06:05 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 86fee87a4fb433244e479177d47b3e76c48dd247
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Sep 24 04:19:42 2016 +0200

    src/onmainwindow.cpp: use the new functions in generateKey ().
---
 debian/changelog     |    1 +
 src/onmainwindow.cpp |   41 +++--------------------------------------
 2 files changed, 4 insertions(+), 38 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index cd6e81a..c28a8db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -441,6 +441,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - src/onmainwindow.{cpp,h}: add new function default_size_for_key_type ().
       Returns the default key size in bits for the selected key type, after
       checking for validity.
+    - src/onmainwindow.cpp: use the new functions in generateKey ().
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 419de3f..0e9077b 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10359,45 +10359,10 @@ std::size_t ONMainWindow::default_size_for_key_type (ONMainWindow::key_types key
 
 QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key)
 {
-    ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE;
-    QString stringified_key_type ("");
-    std::size_t key_bits = 0;
+    QString stringified_key_type (key_type_to_string (key_type));
+    std::size_t key_bits = default_size_for_key_type (key_type);
+
     QString ret ("");
-    switch (key_type) {
-        case RSA_KEY_TYPE:
-                               sanitized_key_type = key_type;
-                               stringified_key_type = "rsa";
-                               key_bits = 4096;
-                               break;
-        case DSA_KEY_TYPE:
-                               sanitized_key_type = key_type;
-                               stringified_key_type = "dsa";
-                               key_bits = 1024;
-                               break;
-        case ECDSA_KEY_TYPE:
-                               sanitized_key_type = key_type;
-                               stringified_key_type = "ecdsa";
-                               key_bits = 384;
-                               break;
-        case ED25519_KEY_TYPE:
-                               sanitized_key_type = key_type;
-                               stringified_key_type = "ed25519";
-                               /* Fixed key length, flag will be unused. */
-                               key_bits = 0;
-                               break;
-        default:
-                               sanitized_key_type = UNKNOWN_KEY_TYPE;
-                               stringified_key_type = "unknown";
-                               key_bits = 0;
-    }
-
-    if (sanitized_key_type == UNKNOWN_KEY_TYPE) {
-        QMessageBox::critical (this, tr ("SSH key type selection error"),
-                               tr ("Unknown SSH key selected.")
-                               + "\n"
-                               + tr ("Terminating application."));
-        close ();
-    }
 
     QString base_dir (homeDir);
     QString private_key_file ("");

--
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