This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch bugfix/osx in repository x2goclient. from 11921f2 src/onmainwindow.{cpp,h}: rename generateHostKey () to generateKey () and add a boolean parameter with a default of false to request a public key. new d2946a8 src/onmainwindow.cpp: refactor generateKey () a little bit to compact it. new 84a1b9b src/onmainwindow.{cpp,h}: rewrite generateKey () function to actually also generate user keys. new c65e647 src/onmainwindow.cpp: add more error handling to generateKey () and fix up a broken error-handling section. new b3b2618 src/onmainwindow.cpp: fix up a few debug strings. The 4 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 | 11 ++++ src/onmainwindow.cpp | 165 ++++++++++++++++++++++++++++++++++---------------- src/onmainwindow.h | 2 +- 3 files changed, 124 insertions(+), 54 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 d2946a86ef7cc35c659d5b881536a3ace58ac01b Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Sep 22 05:32:59 2016 +0200 src/onmainwindow.cpp: refactor generateKey () a little bit to compact it. --- debian/changelog | 2 ++ src/onmainwindow.cpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index cab7d87..24b40ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -384,6 +384,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.{cpp,h}: rename generateHostKey () to generateKey () and add a boolean parameter with a default of false to request a public key. Change old invocations of generateHostKey () accordingly. + - src/onmainwindow.cpp: refactor generateKey () a little bit to compact + 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 2914bb7..72620e1 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10332,21 +10332,22 @@ void ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) close (); } - QString etcDir = homeDir + "/.x2go/etc/"; - QDir dr (homeDir); - dr.mkpath (etcDir); - QString private_key_file = etcDir + "/ssh_host_" + stringified_key_type + "_key"; + QString etc_dir = homeDir + "/.x2go/etc/"; + QDir dir (homeDir); + dir.mkpath (etc_dir); + QString private_key_file = ""; +#ifdef Q_OS_WIN + private_key_file = cygwinPath (wapiShortFileName (etc_dir)); +#else + private_key_file = etc_dir; +#endif + private_key_file += "/ssh_host_" + stringified_key_type + "_key"; QString public_key_file = private_key_file + ".pub"; if ((!(QFile::exists (private_key_file))) || (!(QFile::exists (public_key_file)))) { x2goDebug << "Generating host key. Type: " << stringified_key_type; -#ifdef Q_OS_WIN - private_key_file = cygwinPath (wapiShortFileName (etcDir)) - + "/ssh_host_" + stringified_key_type + "_key"; -#endif - QStringList args; args << "-t" << stringified_key_type -- 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 c65e647c05ee529de923481a6304669ff22f4763 Author: Mihai Moldovan <ionic@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 c129a00..08d3d80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -392,6 +392,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. -- 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 23485f0..15274ba 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10324,6 +10324,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 (); } } @@ -10387,7 +10388,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
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 84a1b9b23b1d3ef7da0af8d4c6e4a065ab4acad3 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Sep 23 02:49:03 2016 +0200 src/onmainwindow.{cpp,h}: rewrite generateKey () function to actually also generate user keys. Now returns the private key file path (public key file path is trivially determined by appending ".pub" to that return 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. --- debian/changelog | 6 +++ src/onmainwindow.cpp | 130 +++++++++++++++++++++++++++++++------------------- src/onmainwindow.h | 2 +- 3 files changed, 87 insertions(+), 51 deletions(-) diff --git a/debian/changelog b/debian/changelog index 24b40ef..c129a00 100644 --- a/debian/changelog +++ b/debian/changelog @@ -386,6 +386,12 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium key. Change old invocations of generateHostKey () accordingly. - src/onmainwindow.cpp: refactor generateKey () a little bit to compact it. + - src/onmainwindow.{cpp,h}: rewrite generateKey () function to actually + also generate user keys. Now returns the private key file path (public + key file path is trivially determined by appending ".pub" to that return + 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. -- 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 72620e1..23485f0 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -8083,35 +8083,7 @@ QString ONMainWindow::createRSAKey() * private SSH key. */ - QDir dr; - QString keyPath=homeDir +"/.x2go/ssh/gen"; - dr.mkpath ( keyPath ); -#ifdef Q_OS_WIN - keyPath=wapiShortFileName ( keyPath ); -#endif - QTemporaryFile fl ( keyPath+"/key" ); - fl.open(); - QString keyName=fl.fileName(); - fl.setAutoRemove ( false ); - fl.close(); - fl.remove(); - - QStringList args; - - /* - * Generating new key material here. - */ - args<<"-t"<<"rsa"<<"-b"<<"1024"<<"-N"<<""<<"-f"<<keyName<<"-q"; - - x2goDebug<<"ssh-keygen " + args.join(" "); - - if ( QProcess::execute ( "ssh-keygen",args ) !=0 ) - { - x2goDebug<<"ssh-keygen failed." <<endl; - return QString::null; - } - x2goDebug<<"ssh-keygen succeeded."; - + QString user_key = generateKey (RSA_KEY_TYPE); /* * Now taking the *host* pub key here... @@ -8151,14 +8123,14 @@ QString ONMainWindow::createRSAKey() if ( !rsa.open ( QIODevice::ReadOnly | QIODevice::Text ) ) { #if defined (Q_OS_LINUX) || defined (Q_OS_DARWIN) - generateKey (RSA_KEY_TYPE, true); + QString tmp_file_name (generateKey (RSA_KEY_TYPE, true)); generateEtcFiles (); if (!startSshd ()) { return (QString::null); } - rsa.setFileName ( homeDir+"/.x2go/etc/ssh_host_rsa_key.pub" ); + rsa.setFileName (tmp_file_name + ".pub"); rsa.open ( QIODevice::ReadOnly | QIODevice::Text ); #else printSshDError_noHostPubKey(); @@ -8176,18 +8148,18 @@ QString ONMainWindow::createRSAKey() return QString::null; } - QFile file ( keyName ); + QFile file ( user_key ); if ( !file.open ( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ) ) { - x2goErrorf(10)<<tr("Cannot open key: ")<<keyName; - return keyName; + x2goErrorf(10) << tr ("Cannot open key: ") << user_key; + return user_key; } QTextStream out ( &file ); out<<"----BEGIN RSA IDENTITY----"<<rsa_pub; file.close(); - return keyName; + return user_key; } void ONMainWindow::slotCopyKey ( bool result, QString output, int pid) @@ -10116,7 +10088,7 @@ void ONMainWindow::startWinServers() { dr.mkpath ( etcDir ); - generateKey(RSA_KEY_TYPE, true); + UNUSED (generateKey (RSA_KEY_TYPE, true)); generateEtcFiles(); sshStarter->start(); } @@ -10293,11 +10265,12 @@ void ONMainWindow::generateEtcFiles() x2goDebug<<etcDir +"/sshd_config created."; } -void ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_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 = ""; + QString stringified_key_type (""); std::size_t key_bits = 0; + QString ret (""); switch (key_type) { case RSA_KEY_TYPE: sanitized_key_type = key_type; @@ -10327,28 +10300,83 @@ void ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) } if (sanitized_key_type == UNKNOWN_KEY_TYPE) { - QMessageBox::critical (this, tr ("Host key type selection error"), - tr ("Unknown host key selected.\nTerminating application.")); + QMessageBox::critical (this, tr ("SSH key type selection error"), + tr ("Unknown SSH key selected.") + + "\n" + + tr ("Terminating application.")); close (); } - QString etc_dir = homeDir + "/.x2go/etc/"; - QDir dir (homeDir); - dir.mkpath (etc_dir); - 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/"; + } + + { + 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.")); + } + } + #ifdef Q_OS_WIN - private_key_file = cygwinPath (wapiShortFileName (etc_dir)); + private_key_file = cygwinPath (wapiShortFileName (base_dir)); #else - private_key_file = etc_dir; + private_key_file = base_dir; #endif - private_key_file += "/ssh_host_" + stringified_key_type + "_key"; - QString public_key_file = private_key_file + ".pub"; + ret = base_dir; + + { + QString tmp_to_add (""); + + if (host_key) { + QString 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 (); + + /* 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; + } + + QString public_key_file (private_key_file + ".pub"); if ((!(QFile::exists (private_key_file))) || (!(QFile::exists (public_key_file)))) { - x2goDebug << "Generating host key. Type: " << stringified_key_type; + x2goDebug << "Generating SSH key. Type: " << stringified_key_type; QStringList args; + + QString comment = "X2Go Client " + stringified_key_type + " "; + + if (host_key) { + comment += "host"; + } + else { + comment += "user"; + } + + comment += " key"; + args << "-t" << stringified_key_type << "-b" @@ -10356,11 +10384,13 @@ void ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) << "-N" << "" << "-C" - << QString ("X2Go Client " + stringified_key_type + "host key") + << comment << "-f" << private_key_file; QProcess::execute ("ssh-keygen", args); } + + return (ret); } bool ONMainWindow::startSshd() diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 4c7f15d..c86bceb 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1205,7 +1205,7 @@ private: #endif void filterDesktops ( const QString& filter, bool strict=false ); - void generateKey(key_types key_type, bool host_key = false); + QString generateKey(key_types key_type, bool host_key = false); void generateEtcFiles(); QString u3DataPath(); void cleanPortable(); -- 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 b3b2618ad529d6261e62557e1c96252e34aa9cc9 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Sep 23 03:22:29 2016 +0200 src/onmainwindow.cpp: fix up a few debug strings. --- debian/changelog | 1 + src/onmainwindow.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 08d3d80..294ab97 100644 --- a/debian/changelog +++ b/debian/changelog @@ -394,6 +394,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium generate a user key manually previously. - src/onmainwindow.cpp: add more error handling to generateKey () and fix up a broken error-handling section. + - src/onmainwindow.cpp: fix up a few debug strings. -- 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 15274ba..7d70eb1 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -8250,7 +8250,7 @@ void ONMainWindow::slotRetExportDir ( bool result,QString output, QMessageBox::NoButton ); } QFile file ( key+".pub" ); - x2goDebug<<"Deactivating public key from "<<key<<".pub again."<<endl; + x2goDebug << "Deactivating public key from " << QString (key + ".pub") << " again."; if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) ) { printSshDError_noExportPubKey(); @@ -9635,7 +9635,7 @@ void ONMainWindow::startX2goMount() out << line; authorized_keys_file.close (); - x2goDebug << "Temporarily activated public key from file " << fsExportKey << ".pub."; + x2goDebug << "Temporarily activated public key from file " << QString (fsExportKey + ".pub") << "."; QString passwd=getCurrentPass(); QString user=getCurrentUname(); -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git