[X2Go-Commits] [x2goclient] 01/03: src/onmainwindow.{cpp, h}: remove Cygwin permissions workaround via chgrp.
git-admin at x2go.org
git-admin at x2go.org
Fri Jun 15 12:04:51 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit b9e17cd0c9044197ab496dc0c60c196546d35fe0
Author: Mihai Moldovan <ionic at ionic.de>
Date: Fri Jun 15 11:55:07 2018 +0200
src/onmainwindow.{cpp,h}: remove Cygwin permissions workaround via chgrp.
---
debian/changelog | 2 +
src/onmainwindow.cpp | 123 ---------------------------------------------------
src/onmainwindow.h | 1 -
3 files changed, 2 insertions(+), 124 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index de521ab..9c3bcf9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -93,6 +93,8 @@ x2goclient (4.1.2.0-0x2go1) UNRELEASED; urgency=medium
- src/onmainwindow.cpp: actually pass the correct group ID to the chgrp
call and make sure that the warning dialog box also appears whenever the
exit code indicates a failure.
+ - src/onmainwindow.{cpp,h}: remove Cygwin permissions workaround via
+ chgrp.
* x2goclient.spec:
- Remove plugin references.
* debian/rules:
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 20f46e2..6c2fcb6 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10397,125 +10397,6 @@ void ONMainWindow::slotSetWinServersReady()
restoreCygnusSettings();
}
-void ONMainWindow::workaround_cygwin_permissions_issue () {
- /*
- * Traditionally, user home directories were owned by a group called "None"
- * (or usually also translated into the system locale, because it's
- * Windows...).
- *
- * Newer versions, at least Windows 10 and higher, set the group to the
- * user's group, quite like on Linux.
- *
- * This has interesting consequences for older Cygwin versions (up to
- * 1.7.34 probably - we currently use 1.7.33).
- * Windows has a general concept of users and groups, but keeps a database
- * of both in a combined way, with actually unique IDs. Hence, if a
- * directory is owned by an ID that corresponds to the user both in the
- * owner and group ACLs, then Cygwin gets confused with owner and group
- * permissions.
- * Even though the effective group permissions might be "---", it somehow
- * manages to map the effective owner permissions, that typically are
- * "rwx", to the UNIX group permissions as well.
- * Consequently, OpenSSH will error out complaining about the permissions
- * of the host keys being too open, even though they really are not.
- *
- * To work around this problem, we will reset the group ID of
- * ~/.x2go/etc to the None group ID, which conveniently has a reserved and
- * fixed value of 513 (RID) or 197121 (Cygwin) across all systems.
- *
- * Note that we don't have to do that for ~/x2go/ssh/gen, since we disable
- * file permission checks for user keys.
- */
- QString etc_dir = cygwinPath (wapiShortFileName (homeDir + "/.x2go/etc"));
-
- QStringList args;
- args << "-R" << "-v" << "197121" << etc_dir;
-
- QProcess chgrp;
- chgrp.setStandardInputFile (
-#if QT_VERSION >= 0x050200
- QProcess::nullDevice ()
-#else
- "\\\\.\\NUL"
-#endif
- );
- chgrp.start ("chgrp", args);
-
- bool fail = false;
- while (!(chgrp.waitForStarted (10))) {
- /*
- * If the process state is still "Starting", it means that the timer in
- * waitForStarted () ran out. Continue normal execution, otherwise
- * handle the startup error.
- */
- if (QProcess::Starting != chgrp.state ()) {
- fail = true;
-
- break;
- }
-
- QCoreApplication::processEvents (QEventLoop::AllEvents, 10);
- }
-
- if (fail) {
- show_RichText_WarningMsgBox (tr ("Unable to start chgrp helper."),
- tr ("Changing the group permissions of the X2Go Client-specific "
- "OpenSSH server configuration will not take place.")
- + "\n"
- + tr ("The OpenSSH server might fail to start on newer Windows "
- "versions (10 and higher)."),
- false);
-
- x2goDebug << "Failed to start chgrp: " << chgrp.error ()
- << " with exit status " << chgrp.exitStatus ()
- << " and exit code " << chgrp.exitCode ()
- << " (invalid unless exit status was QProcess::NormalExit)"
- << "; continuing without directory regrouping. sshd might "
- << "fail to start up.";
-
- return;
- }
-
- fail = false;
- while (!(chgrp.waitForFinished (10))) {
- /*
- * Pretty much the same logic as above, only slightly adaptated:
- * a timeout only makes sense if the process is still "Running".
- * Otherwise it must have died.
- */
- if (QProcess::Running != chgrp.state ()) {
- fail = true;
-
- break;
- }
-
- QCoreApplication::processEvents (QEventLoop::AllEvents, 10);
- }
-
- fail = ((fail) || (QProcess::NormalExit != chgrp.exitStatus ())
- || ((QProcess::NormalExit == chgrp.exitStatus ()) && (chgrp.exitCode ())));
-
- if (fail) {
- show_RichText_WarningMsgBox (tr ("Execution failure of chgrp helper."),
- tr ("Changing the group permissions of the X2Go Client-specific "
- "OpenSSH server configuration will not take place.")
- + "\n"
- + tr ("The OpenSSH server might fail to start on newer Windows "
- "versions (10 and higher)."),
- false);
-
- x2goDebug << "chgrp failed during execution: " << chgrp.error ()
- << " with exit status " << chgrp.exitStatus ()
- << " and exit code " << chgrp.exitCode ()
- << " (invalid unless exit status was QProcess::NormalExit)"
- << "; continuing without directory regrouping. sshd might "
- << "fail to start up.";
- }
-
- x2goDebug << "chgrp stdout: " << chgrp.readAllStandardOutput ()
- << endl << "chgrp stderr: " << chgrp.readAllStandardError ();
-}
-
#include <windows.h>
#include<sstream>
#endif
@@ -10941,10 +10822,6 @@ bool ONMainWindow::startSshd(ONMainWindow::key_types key_type)
*/
generateEtcFiles ();
-#ifdef Q_OS_WIN
- workaround_cygwin_permissions_issue ();
-#endif
-
clientSshPort = "7022";
QString etcDir=homeDir+"/.x2go/etc";
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index 2b78261..47eaa5e 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -1187,7 +1187,6 @@ private:
#ifdef Q_OS_WIN
void saveCygnusSettings();
void restoreCygnusSettings();
- void workaround_cygwin_permissions_issue ();
#endif
#if defined (Q_OS_WIN) || defined (Q_OS_DARWIN)
QString getXDisplay();
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list