This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient.
commit 31f2deb0b040f21c2b856af05679122557bfd79e Author: Mihai Moldovan <io...@ionic.de> Date: Sat Sep 24 23:12:15 2016 +0200 src/onmainwindow.{cpp,h}: rename createRSAKey () to the more-appropriate name createKeyBundle (). Also add a key-type parameter and use it to select the required key type (and maybe generate it if necessary.) Also use the new functions to get a stringified version of the key type etc. --- debian/changelog | 4 ++++ src/onmainwindow.cpp | 29 ++++++++++++++++++----------- src/onmainwindow.h | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8127ac5..03ef722 100644 --- a/debian/changelog +++ b/debian/changelog @@ -423,6 +423,10 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium multiple times. Check if the OpenSSH Server is already running and return true, otherwise try to start it. - src/onmainwindow.cpp: add some comments only to createRSAKey (). + - src/onmainwindow.{cpp,h}: rename createRSAKey () to the more-appropriate + name createKeyBundle (). Also add a key-type parameter and use it to + select the required key type (and maybe generate it if necessary.) Also + use the new functions to get a stringified version of the key type etc. [ Bernard Cafarelli ] * New upstream version (4.0.5.3): diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 90cdc64..11ca1fa 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -7928,7 +7928,7 @@ void ONMainWindow::exportDirs ( QString exports,bool removable ) dr.dirList=exports; - dr.key=createRSAKey(); + dr.key=createKeyBundle(); // Key creation failure or the like. if (dr.key.isEmpty ()) { @@ -10360,7 +10360,7 @@ QString ONMainWindow::generateKey (ONMainWindow::key_types key_type, bool host_k return (ret); } -QString ONMainWindow::createRSAKey () { +QString ONMainWindow::createKeyBundle (key_types key_type) { /* * I spent multiple hours on trying to understand this function * and directory exporting in general, so I'd better document @@ -10388,41 +10388,48 @@ QString ONMainWindow::createRSAKey () { * private SSH key. */ - QString user_key = generateKey (RSA_KEY_TYPE); + QString stringified_key_type (key_type_to_string (key_type)); + + QString user_key = generateKey (key_type); /* * Now taking the *host* pub key here... */ - QFile rsa (homeDir + "/.x2go/etc/ssh_host_rsa_key.pub"); + const QString host_pub_key_file_name ("ssh_host_" + stringified_key_type + "_key.pub"); + QFile rsa (homeDir + "/.x2go/etc/" + host_pub_key_file_name); #ifdef Q_OS_WIN - rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\ssh_host_rsa_key.pub")); + rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\" + host_pub_key_file_name)); #endif if (!(rsa.open (QIODevice::ReadOnly | QIODevice::Text))) { x2goDebug << "Unable to open public host key file."; #ifdef Q_OS_UNIX x2goDebug << "Creating a new one."; - QString tmp_file_name (generateKey (RSA_KEY_TYPE, true)); + QString tmp_file_name (generateKey (key_type, true)); generateEtcFiles (); - if (!(startSshd ())) { + rsa.setFileName (tmp_file_name + ".pub"); + if (!(rsa.open (QIODevice::ReadOnly | QIODevice::Text))) { + x2goErrorf (9) << tr ("Unable to open newly generated %1 public host key file.").arg (stringified_key_type.toUpper ()); return (QString::null); } - - rsa.setFileName (tmp_file_name + ".pub"); - rsa.open (QIODevice::ReadOnly | QIODevice::Text); #else printSshDError_noHostPubKey (); return (QString::null); #endif } + if (!(startSshd ())) { + x2goDebug << "Failed to start OpenSSH Server pro-actively."; + return (QString::null); + } + QByteArray rsa_pub; if (!(rsa.atEnd ())) { rsa_pub = rsa.readLine (); else { - x2goErrorf (9) << tr ("RSA file empty."); + x2goErrorf (9) << tr ("%1 public host key file empty.").arg (stringified_key_type.toUpper ()); return (QString::null); } diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 43b6adc..21e6201 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1219,7 +1219,7 @@ private: QString key_type_to_string (key_types key_type); std::size_t default_size_for_key_type (key_types key_type); QString generateKey (key_types key_type, bool host_key = false); - QString createRSAKey (); + QString createKeyBundle (key_types key_type = RSA_KEY_TYPE); ////////////////plugin stuff//////////////////// #ifdef CFGPLUGIN -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org http://lists.x2go.org/listinfo/x2go-commits