This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/osx in repository x2goclient. from b84ca8c src/onmainwindow.cpp: terminate sshd more correctly. new b8736c1 src/onmainwindow.{cpp,h}: add new function check_key_type (). new 324fbf8 src/onmainwindow.{cpp,h}: add new function key_type_to_string (). new a0e7309 src/onmainwindow.{cpp,h}: add new function default_size_for_key_type (). new 9bb0bad src/onmainwindow.cpp: use the new functions in generateKey (). new 74fe4fa src/onmainwindow.h: move generateKey () declaration around. new 2967b20 src/onmainwindow.{cpp,h}: reformat generateKey () only. new 37593ef src/onmainwindow.{cpp,h}: move createRSAKey () around. new f3184b0 src/onmainwindow.{cpp,h}: reformat createRSAKey () only. new 7b1e999 src/onmainwindow.cpp: let startSshd () act as a wrapper and be called multiple times. new c4004a2 src/onmainwindow.cpp: add some comments only to createRSAKey (). The 10 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 17 ++ src/onmainwindow.cpp | 479 ++++++++++++++++++++++++++++---------------------- src/onmainwindow.h | 8 +- 3 files changed, 290 insertions(+), 214 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit b8736c17e5db270ba6ba000c00be94265c406ddc Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:07:38 2016 +0200 src/onmainwindow.{cpp,h}: add new function check_key_type (). Takes a key type and checks for validity/if it's known. --- debian/changelog | 2 ++ src/onmainwindow.cpp | 27 +++++++++++++++++++++++++++ src/onmainwindow.h | 2 ++ 3 files changed, 31 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2962e12..7daa786 100644 --- a/debian/changelog +++ b/debian/changelog @@ -406,6 +406,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium string in generateKey (). - src/onmainwindow.cpp: terminate sshd more correctly. First via terminate (), then wait up to 5 seconds, then via kill (). + - src/onmainwindow.{cpp,h}: add new function check_key_type (). Takes a + key type and checks for validity/if it's known. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index d4c70a8..b6c580c 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10223,6 +10223,33 @@ void ONMainWindow::generateEtcFiles() x2goDebug<<etcDir +"/sshd_config created."; } +ONMainWindow::key_types ONMainWindow::check_key_type (ONMainWindow::key_types key_type) { + ONMainWindow::key_types ret = key_type; + + switch (key_type) { + case RSA_KEY_TYPE: + break; + case DSA_KEY_TYPE: + break; + case ECDSA_KEY_TYPE: + break; + case ED25519_KEY_TYPE: + break; + default: + ret = UNKNOWN_KEY_TYPE; + } + + if (UNKNOWN_KEY_TYPE == ret) { + QMessageBox::critical (this, tr ("SSH key type selection error"), + tr ("Unknown SSH key selected.") + + "\n" + + tr ("Terminating application.")); + close (); + } + + return (ret); +} + QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) { ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE; diff --git a/src/onmainwindow.h b/src/onmainwindow.h index d5f1659..9919fde 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1217,6 +1217,8 @@ private: QString getXDisplay(); #endif + key_types check_key_type (key_types key_type); + ////////////////plugin stuff//////////////////// #ifdef CFGPLUGIN public slots: -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit a0e7309007d3f1d77011fadb0ac59edc7f7a175b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:17:05 2016 +0200 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. --- debian/changelog | 3 +++ src/onmainwindow.cpp | 25 +++++++++++++++++++++++++ src/onmainwindow.h | 1 + 3 files changed, 29 insertions(+) diff --git a/debian/changelog b/debian/changelog index d0956fe..f9eec5f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -411,6 +411,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.{cpp,h}: add new function key_type_to_string (). Returns a stringified version of the selected key type, after checking for validity. + - 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. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index e1be3aa..6d0a348 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10274,6 +10274,31 @@ QString ONMainWindow::key_type_to_string (ONMainWindow::key_types key_type) { return (ret); } +std::size_t ONMainWindow::default_size_for_key_type (ONMainWindow::key_types key_type) { + ONMainWindow::key_types sanitized_key_type = check_key_type (key_type); + std::size_t ret = 0; + + switch (sanitized_key_type) { + case RSA_KEY_TYPE: + ret = 4096; + break; + case DSA_KEY_TYPE: + ret = 1024; + break; + case ECDSA_KEY_TYPE: + ret = 384; + break; + case ED25519_KEY_TYPE: + /* Fixed key length, flag will be unused. */ + ret = 0; + break; + default: + ret = 0; + } + + return (ret); +} + QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) { ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE; diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 3d25091..01981d0 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1219,6 +1219,7 @@ private: key_types check_key_type (key_types key_type); QString key_type_to_string (key_types key_type); + std::size_t default_size_for_key_type (key_types 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 324fbf84c4af9dbdc0968bb4bbd48f5ca80d7d19 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:13:08 2016 +0200 src/onmainwindow.{cpp,h}: add new function key_type_to_string (). Returns a stringified version of the selected key type, after checking for validity. --- debian/changelog | 3 +++ src/onmainwindow.cpp | 24 ++++++++++++++++++++++++ src/onmainwindow.h | 1 + 3 files changed, 28 insertions(+) diff --git a/debian/changelog b/debian/changelog index 7daa786..d0956fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -408,6 +408,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium (), then wait up to 5 seconds, then via kill (). - src/onmainwindow.{cpp,h}: add new function check_key_type (). Takes a key type and checks for validity/if it's known. + - src/onmainwindow.{cpp,h}: add new function key_type_to_string (). + Returns a stringified version of the selected key type, after checking + for validity. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index b6c580c..e1be3aa 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10250,6 +10250,30 @@ ONMainWindow::key_types ONMainWindow::check_key_type (ONMainWindow::key_types ke return (ret); } +QString ONMainWindow::key_type_to_string (ONMainWindow::key_types key_type) { + ONMainWindow::key_types sanitized_key_type = check_key_type (key_type); + QString ret (""); + + switch (sanitized_key_type) { + case RSA_KEY_TYPE: + ret = "rsa"; + break; + case DSA_KEY_TYPE: + ret = "dsa"; + break; + case ECDSA_KEY_TYPE: + ret = "ecdsa"; + break; + case ED25519_KEY_TYPE: + ret = "ed25519"; + break; + default: + ret = "unknown"; + } + + return (ret); +} + QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) { ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE; diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 9919fde..3d25091 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1218,6 +1218,7 @@ private: #endif key_types check_key_type (key_types key_type); + QString key_type_to_string (key_types 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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 9bb0badf96f817a4c41b617bf87ae9ad200c9f55 Author: Mihai Moldovan <ionic@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 f9eec5f..d1f4ce9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -414,6 +414,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 (). -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 6d0a348..643591c 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10301,45 +10301,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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 74fe4fa606ac14cd381a8712f6824a3d380379a1 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:25:39 2016 +0200 src/onmainwindow.h: move generateKey () declaration around. --- debian/changelog | 1 + src/onmainwindow.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d1f4ce9..b767990 100644 --- a/debian/changelog +++ b/debian/changelog @@ -415,6 +415,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium 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 (). + - src/onmainwindow.h: move generateKey () declaration around. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 01981d0..0369dbe 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1204,7 +1204,6 @@ private: #endif void filterDesktops ( const QString& filter, bool strict=false ); - QString generateKey(key_types key_type, bool host_key = false); void generateEtcFiles(); QString u3DataPath(); void cleanPortable(); @@ -1220,6 +1219,7 @@ private: key_types check_key_type (key_types key_type); 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); ////////////////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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 2967b208a6de5e36ab821364dffd25cb71f09de7 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:26:47 2016 +0200 src/onmainwindow.{cpp,h}: reformat generateKey () only. --- debian/changelog | 1 + src/onmainwindow.cpp | 184 +++++++++++++++++++++++++------------------------- src/onmainwindow.h | 2 +- 3 files changed, 93 insertions(+), 94 deletions(-) diff --git a/debian/changelog b/debian/changelog index b767990..6d703c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -416,6 +416,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium checking for validity. - src/onmainwindow.cpp: use the new functions in generateKey (). - src/onmainwindow.h: move generateKey () declaration around. + - src/onmainwindow.{cpp,h}: reformat generateKey () only. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 643591c..fed6c93 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10299,126 +10299,124 @@ std::size_t ONMainWindow::default_size_for_key_type (ONMainWindow::key_types key return (ret); } -QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) -{ - QString stringified_key_type (key_type_to_string (key_type)); - std::size_t key_bits = default_size_for_key_type (key_type); +QString ONMainWindow::generateKey (ONMainWindow::key_types key_type, bool host_key) { + QString stringified_key_type (key_type_to_string (key_type)); + std::size_t key_bits = default_size_for_key_type (key_type); - QString ret (""); + QString ret (""); - QString base_dir (homeDir); - QString private_key_file (""); + QString base_dir (homeDir); + QString private_key_file (""); - if (host_key) { - base_dir += "/.x2go/etc/"; - } - else { - base_dir += "/.x2go/ssh/gen/"; - } + if (host_key) { + base_dir += "/.x2go/etc/"; + } + else { + base_dir += "/.x2go/ssh/gen/"; + } - { - QDir dir (homeDir); - if (!(dir.mkpath (base_dir))) { - QMessageBox::critical (this, tr ("SSH key base directory creation error"), - tr ("Unable to create SSH key base directory '%1'.").arg (base_dir) - + "\n" - + tr ("Terminating application.")); - close (); - } + { + QDir dir (homeDir); + if (!(dir.mkpath (base_dir))) { + QMessageBox::critical (this, tr ("SSH key base directory creation error"), + tr ("Unable to create SSH key base directory '%1'.").arg (base_dir) + + "\n" + + tr ("Terminating application.")); + close (); } + } #ifdef Q_OS_WIN - private_key_file = cygwinPath (wapiShortFileName (base_dir)); + private_key_file = cygwinPath (wapiShortFileName (base_dir)); #else - private_key_file = base_dir; + private_key_file = base_dir; #endif - ret = base_dir; + ret = base_dir; - { - QString tmp_to_add (""); + { + QString tmp_to_add (""); - if (host_key) { - tmp_to_add = "/ssh_host_" + stringified_key_type + "_key"; - } - else { - QTemporaryFile temp_file (base_dir + "/key"); - temp_file.open (); + if (host_key) { + tmp_to_add = "/ssh_host_" + stringified_key_type + "_key"; + } + else { + QTemporaryFile temp_file (base_dir + "/key"); + temp_file.open (); - /* Extract base name. */ - QFileInfo tmp_file_info (temp_file.fileName ()); - tmp_to_add = tmp_file_info.fileName (); + /* Extract base name. */ + QFileInfo tmp_file_info (temp_file.fileName ()); + tmp_to_add = tmp_file_info.fileName (); - /* Clean up again. We don't need the temporary file anymore. */ - temp_file.setAutoRemove (false); - temp_file.close (); - temp_file.remove (); - } - - private_key_file += tmp_to_add; - ret += tmp_to_add; + /* Clean up again. We don't need the temporary file anymore. */ + temp_file.setAutoRemove (false); + temp_file.close (); + temp_file.remove (); } - QString public_key_file (private_key_file + ".pub"); + private_key_file += tmp_to_add; + ret += tmp_to_add; + } - if ((!(QFile::exists (private_key_file))) || (!(QFile::exists (public_key_file)))) - { - x2goDebug << "Generating SSH key. Type: " << stringified_key_type.toUpper () - << "; Location: " << private_key_file; + QString public_key_file (private_key_file + ".pub"); - QStringList args; + if ((!(QFile::exists (private_key_file))) || (!(QFile::exists (public_key_file)))) { + x2goDebug << "Generating SSH key. Type: " << stringified_key_type.toUpper () + << "; Location: " << private_key_file; - QString comment = "X2Go Client " + stringified_key_type.toUpper () + " "; + QStringList args; - if (host_key) { - comment += "host"; - } - else { - comment += "user"; - } + QString comment = "X2Go Client " + stringified_key_type.toUpper () + " "; - comment += " key"; + if (host_key) { + comment += "host"; + } + else { + comment += "user"; + } - args << "-t" - << stringified_key_type - << "-b" - << QString::number (key_bits) - << "-N" - << "" - << "-C" - << comment - << "-f" - << private_key_file; + comment += " key"; - const int keygen_ret = QProcess::execute ("ssh-keygen", args); + args << "-t" + << stringified_key_type + << "-b" + << QString::number (key_bits) + << "-N" + << "" + << "-C" + << comment + << "-f" + << private_key_file; - 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 (); - } + const int keygen_ret = QProcess::execute ("ssh-keygen", args); - if (-1 == keygen_ret) { - QMessageBox::critical (this, tr ("ssh-keygen crashed"), - tr ("The ssh-keygen binary crashed.") - + "\n" - + tr ("Terminating application.")); - close (); - } + 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 (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 (); - } + if (-1 == keygen_ret) { + QMessageBox::critical (this, tr ("ssh-keygen crashed"), + tr ("The ssh-keygen binary crashed.") + + "\n" + + tr ("Terminating application.")); + close (); } - return (ret); + 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); } bool ONMainWindow::startSshd() diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 0369dbe..ed9fb71 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1219,7 +1219,7 @@ private: key_types check_key_type (key_types key_type); 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 generateKey (key_types key_type, bool host_key = false); ////////////////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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 37593ef8b6a9a4d488ead68793d876e94b665086 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:33:15 2016 +0200 src/onmainwindow.{cpp,h}: move createRSAKey () around. --- debian/changelog | 1 + src/onmainwindow.cpp | 164 +++++++++++++++++++++++++------------------------- src/onmainwindow.h | 2 +- 3 files changed, 84 insertions(+), 83 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6d703c5..dc9dd7c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -417,6 +417,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.cpp: use the new functions in generateKey (). - src/onmainwindow.h: move generateKey () declaration around. - src/onmainwindow.{cpp,h}: reformat generateKey () only. + - src/onmainwindow.{cpp,h}: move createRSAKey () around. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index fed6c93..b14b28a 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -8070,88 +8070,6 @@ void ONMainWindow::exportDefaultDirs() exportDirs ( dirs.join ( ":" ) ); } -QString ONMainWindow::createRSAKey() -{ - /* - * I spent multiple hours on trying to understand this function - * and directory exporting in general, so I'd better document - * this. - * - * This function first generates a new RSA private-public key - * pair as ~/.x2go/ssh/gen/key.XXXXX{,.pub}. - * - * Then, the SSH daemon's public host key is read and appended - * to the *private* SSH key file after a marker looking like - * this: "----BEGIN RSA IDENTITY----" - * - * Later on, this *private* SSH key file is transferred to the - * remote server, which parses it in the "x2gomountdirs" perl - * script and extracts the public key (used for logging in - * to the client machine) and the public *host* key, used to - * circumvent the "untrusted host" message by SSH by - * explicitly giving the aforementioned public *host* key as - * the only element in a fake "authorized_keys" file. Again, - * this is all happening server-side. - * - * The *public* key part generated here is then taken and - * later added to the "authorized_keys" file on the client - * side, to allow auto-logins via the generated and transferred - * private SSH key. - */ - - QString user_key = generateKey (RSA_KEY_TYPE); - - /* - * Now taking the *host* pub key here... - */ - QFile rsa (homeDir + "/.x2go/etc/ssh_host_rsa_key.pub"); -#ifdef Q_OS_WIN - rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\ssh_host_rsa_key.pub")); -#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)); - generateEtcFiles (); - - if (!(startSshd ())) { - return (QString::null); - } - - rsa.setFileName (tmp_file_name + ".pub"); - rsa.open (QIODevice::ReadOnly | QIODevice::Text); -#else - printSshDError_noHostPubKey (); - return QString::null; -#endif - } - - QByteArray rsa_pub; - - if ( !rsa.atEnd() ) - rsa_pub = rsa.readLine(); - else - { - x2goErrorf(9)<<tr("RSA file empty."); - return QString::null; - } - - QFile file ( user_key ); - if ( !file.open ( - QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ) - ) - { - x2goErrorf(10) << tr ("Cannot open key: ") << user_key; - return user_key; - } - QTextStream out ( &file ); - out<<"----BEGIN RSA IDENTITY----"<<rsa_pub; - file.close(); - return user_key; -} - void ONMainWindow::slotCopyKey ( bool result, QString output, int pid) { fsExportKey=sshConnection->getSourceFile(pid); @@ -10419,6 +10337,88 @@ QString ONMainWindow::generateKey (ONMainWindow::key_types key_type, bool host_k return (ret); } +QString ONMainWindow::createRSAKey() +{ + /* + * I spent multiple hours on trying to understand this function + * and directory exporting in general, so I'd better document + * this. + * + * This function first generates a new RSA private-public key + * pair as ~/.x2go/ssh/gen/key.XXXXX{,.pub}. + * + * Then, the SSH daemon's public host key is read and appended + * to the *private* SSH key file after a marker looking like + * this: "----BEGIN RSA IDENTITY----" + * + * Later on, this *private* SSH key file is transferred to the + * remote server, which parses it in the "x2gomountdirs" perl + * script and extracts the public key (used for logging in + * to the client machine) and the public *host* key, used to + * circumvent the "untrusted host" message by SSH by + * explicitly giving the aforementioned public *host* key as + * the only element in a fake "authorized_keys" file. Again, + * this is all happening server-side. + * + * The *public* key part generated here is then taken and + * later added to the "authorized_keys" file on the client + * side, to allow auto-logins via the generated and transferred + * private SSH key. + */ + + QString user_key = generateKey (RSA_KEY_TYPE); + + /* + * Now taking the *host* pub key here... + */ + QFile rsa (homeDir + "/.x2go/etc/ssh_host_rsa_key.pub"); +#ifdef Q_OS_WIN + rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\ssh_host_rsa_key.pub")); +#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)); + generateEtcFiles (); + + if (!(startSshd ())) { + return (QString::null); + } + + rsa.setFileName (tmp_file_name + ".pub"); + rsa.open (QIODevice::ReadOnly | QIODevice::Text); +#else + printSshDError_noHostPubKey (); + return QString::null; +#endif + } + + QByteArray rsa_pub; + + if ( !rsa.atEnd() ) + rsa_pub = rsa.readLine(); + else + { + x2goErrorf(9)<<tr("RSA file empty."); + return QString::null; + } + + QFile file ( user_key ); + if ( !file.open ( + QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ) + ) + { + x2goErrorf(10) << tr ("Cannot open key: ") << user_key; + return user_key; + } + QTextStream out ( &file ); + out<<"----BEGIN RSA IDENTITY----"<<rsa_pub; + file.close(); + return user_key; +} + bool ONMainWindow::startSshd() { if ( embedMode && config.confFS && !config.useFs ) diff --git a/src/onmainwindow.h b/src/onmainwindow.h index ed9fb71..41a2d6f 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -955,7 +955,6 @@ private: bool soundParameter ( QString val ); void printError ( QString param ); void exportDefaultDirs(); - QString createRSAKey(); directory* getExpDir ( QString key ); bool findInList ( const QString& uid ); void setUsersEnabled ( bool enable ); @@ -1220,6 +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 createRSAKeyBundle(); ////////////////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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit f3184b00f38a45f3038a8b06267c57f87229ed0b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:38:51 2016 +0200 src/onmainwindow.{cpp,h}: reformat createRSAKey () only. --- debian/changelog | 1 + src/onmainwindow.cpp | 133 ++++++++++++++++++++++++-------------------------- src/onmainwindow.h | 2 +- 3 files changed, 66 insertions(+), 70 deletions(-) diff --git a/debian/changelog b/debian/changelog index dc9dd7c..81c5357 100644 --- a/debian/changelog +++ b/debian/changelog @@ -418,6 +418,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.h: move generateKey () declaration around. - src/onmainwindow.{cpp,h}: reformat generateKey () only. - src/onmainwindow.{cpp,h}: move createRSAKey () around. + - src/onmainwindow.{cpp,h}: reformat createRSAKey () only. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index b14b28a..34ca077 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10337,86 +10337,81 @@ QString ONMainWindow::generateKey (ONMainWindow::key_types key_type, bool host_k return (ret); } -QString ONMainWindow::createRSAKey() -{ - /* - * I spent multiple hours on trying to understand this function - * and directory exporting in general, so I'd better document - * this. - * - * This function first generates a new RSA private-public key - * pair as ~/.x2go/ssh/gen/key.XXXXX{,.pub}. - * - * Then, the SSH daemon's public host key is read and appended - * to the *private* SSH key file after a marker looking like - * this: "----BEGIN RSA IDENTITY----" - * - * Later on, this *private* SSH key file is transferred to the - * remote server, which parses it in the "x2gomountdirs" perl - * script and extracts the public key (used for logging in - * to the client machine) and the public *host* key, used to - * circumvent the "untrusted host" message by SSH by - * explicitly giving the aforementioned public *host* key as - * the only element in a fake "authorized_keys" file. Again, - * this is all happening server-side. - * - * The *public* key part generated here is then taken and - * later added to the "authorized_keys" file on the client - * side, to allow auto-logins via the generated and transferred - * private SSH key. - */ - - QString user_key = generateKey (RSA_KEY_TYPE); - - /* - * Now taking the *host* pub key here... - */ - QFile rsa (homeDir + "/.x2go/etc/ssh_host_rsa_key.pub"); +QString ONMainWindow::createRSAKey () { + /* + * I spent multiple hours on trying to understand this function + * and directory exporting in general, so I'd better document + * this. + * + * This function first generates a new RSA private-public key + * pair as ~/.x2go/ssh/gen/key.XXXXX{,.pub}. + * + * Then, the SSH daemon's public host key is read and appended + * to the *private* SSH key file after a marker looking like + * this: "----BEGIN RSA IDENTITY----" + * + * Later on, this *private* SSH key file is transferred to the + * remote server, which parses it in the "x2gomountdirs" perl + * script and extracts the public key (used for logging in + * to the client machine) and the public *host* key, used to + * circumvent the "untrusted host" message by SSH by + * explicitly giving the aforementioned public *host* key as + * the only element in a fake "authorized_keys" file. Again, + * this is all happening server-side. + * + * The *public* key part generated here is then taken and + * later added to the "authorized_keys" file on the client + * side, to allow auto-logins via the generated and transferred + * private SSH key. + */ + + QString user_key = generateKey (RSA_KEY_TYPE); + + /* + * Now taking the *host* pub key here... + */ + QFile rsa (homeDir + "/.x2go/etc/ssh_host_rsa_key.pub"); #ifdef Q_OS_WIN - rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\ssh_host_rsa_key.pub")); + rsa.setFileName (wapiShortFileName (homeDir + "\\.x2go\\etc\\ssh_host_rsa_key.pub")); #endif - if (!(rsa.open (QIODevice::ReadOnly | QIODevice::Text))) { - x2goDebug << "Unable to open public host key file."; + 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)); - generateEtcFiles (); + x2goDebug << "Creating a new one."; + QString tmp_file_name (generateKey (RSA_KEY_TYPE, true)); + generateEtcFiles (); - if (!(startSshd ())) { - return (QString::null); - } + if (!(startSshd ())) { + return (QString::null); + } - rsa.setFileName (tmp_file_name + ".pub"); - rsa.open (QIODevice::ReadOnly | QIODevice::Text); + rsa.setFileName (tmp_file_name + ".pub"); + rsa.open (QIODevice::ReadOnly | QIODevice::Text); #else - printSshDError_noHostPubKey (); - return QString::null; + printSshDError_noHostPubKey (); + return (QString::null); #endif - } + } - QByteArray rsa_pub; + QByteArray rsa_pub; - if ( !rsa.atEnd() ) - rsa_pub = rsa.readLine(); - else - { - x2goErrorf(9)<<tr("RSA file empty."); - return QString::null; - } + if (!(rsa.atEnd ())) { + rsa_pub = rsa.readLine (); + else { + x2goErrorf (9) << tr ("RSA file empty."); + return (QString::null); + } - QFile file ( user_key ); - if ( !file.open ( - QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ) - ) - { - x2goErrorf(10) << tr ("Cannot open key: ") << user_key; - return user_key; - } - QTextStream out ( &file ); - out<<"----BEGIN RSA IDENTITY----"<<rsa_pub; - file.close(); - return user_key; + QFile file (user_key); + if (!(file.open (QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))) { + x2goErrorf (10) << tr ("Cannot open key: ") << user_key; + return (user_key); + } + QTextStream out (&file); + out << "----BEGIN RSA IDENTITY----" << rsa_pub; + file.close (); + return (user_key); } bool ONMainWindow::startSshd() diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 41a2d6f..3d39760 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 createRSAKeyBundle(); + QString createRSAKey (); ////////////////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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 7b1e9999bd9542e2a2e13dbe4cb4acb799561e7b Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 23:04:46 2016 +0200 src/onmainwindow.cpp: let startSshd () act as a wrapper and be called multiple times. Check if the OpenSSH Server is already running and return true, otherwise try to start it. --- debian/changelog | 3 +++ src/onmainwindow.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/debian/changelog b/debian/changelog index 81c5357..3bd55a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -419,6 +419,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.{cpp,h}: reformat generateKey () only. - src/onmainwindow.{cpp,h}: move createRSAKey () around. - src/onmainwindow.{cpp,h}: reformat createRSAKey () only. + - src/onmainwindow.cpp: let startSshd () act as a wrapper and be called + multiple times. Check if the OpenSSH Server is already running and + return true, otherwise try to start it. -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 34ca077..1720855 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10420,6 +10420,19 @@ bool ONMainWindow::startSshd() { return false; } + + /* Don't start sshd, if it's already running. */ +#ifdef Q_OS_WIN + if (winSshdStarted) +#else /* defined (Q_OS_WIN) */ + if (sshd) +#endif /* defined (Q_OS_WIN) */ + { + if (isServerRunning (clientSshPort.toInt ())) { + return (true); + } + } + clientSshPort = "7022"; QString etcDir=homeDir+"/.x2go/etc"; int port=clientSshPort.toInt(); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit c4004a2350764ffc2fe195c60a3bb32e81f2e393 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 23:09:18 2016 +0200 src/onmainwindow.cpp: add some comments only to createRSAKey (). --- debian/changelog | 1 + src/onmainwindow.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3bd55a3..f0a3fd5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -422,6 +422,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.cpp: let startSshd () act as a wrapper and be called 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 (). -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 1720855..7bec56e 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10408,7 +10408,15 @@ QString ONMainWindow::createRSAKey () { x2goErrorf (10) << tr ("Cannot open key: ") << user_key; return (user_key); } + + /* Append public host key into private user key file. */ QTextStream out (&file); + + /* + * The string here should be changed, but this requires + * changes to X2Go Server as well. + * As such, I'll be not changing it here for now. + */ out << "----BEGIN RSA IDENTITY----" << rsa_pub; file.close (); return (user_key); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git