[X2Go-Commits] [x2goclient] 01/01: on Windows check the location of cgwin binaries in <APPDIR> and in <APPDIR>/bin.

git-admin at x2go.org git-admin at x2go.org
Tue Jan 17 11:11:46 CET 2023


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goclient.

commit 1ca43813937df9cd136ae6d282204604ab659fab
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Jan 17 11:02:13 2023 +0100

    on Windows check the location of cgwin binaries in <APPDIR> and in <APPDIR>/bin.
---
 debian/changelog     |  2 ++
 src/onmainwindow.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 76419fc..63301ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -54,6 +54,8 @@ x2goclient (4.1.2.3-0x2go1) UNRELEASED; urgency=medium
     - add "noresize" setting, which makes the proxy window not resizable
       for user.
     - on Windows SSHD will only listen 127.0.0.1 to avoid FW warnings.
+    - on Windows check the location of cgwin binaries in <APPDIR> and
+      in <APPDIR>/bin.
 
   [ Ryan Schmidt ]
   * New upstream version (4.1.2.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 46f6379..62150a5 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -6314,7 +6314,14 @@ void ONMainWindow::slotTunnelOk(int)
     QString proxyCmd="nxproxy -S nx/nx,options="+dirpath+"/options:"+
                      resumingSession.display;
 #ifdef Q_OS_WIN
-    proxyCmd="bin\\"+proxyCmd;
+    if(! QFile::exists(appDir+"/nxproxy.exe"))
+    {
+        if(QFile::exists(appDir+"/bin/nxproxy.exe"))
+        {
+            proxyCmd="bin\\"+proxyCmd;
+        }
+    }
+    x2goDebug<<"NX proxy: "<<proxyCmd;
 #endif
 #ifdef Q_OS_DARWIN
     //run nxproxy from bundle
@@ -11103,9 +11110,38 @@ void ONMainWindow::generateEtcFiles()
          "PidFile \"" + varDir + "/sshd.pid\"\n" <<
          "AuthorizedKeysFile \"" << authKeyPath << "\"\n";
 #ifdef Q_OS_WIN
-    out << "Subsystem shell "<< wapiShortFileName ( appDir) +"/bin/bash"+"\n"<<
+    QString shell="/bash";
+    if(QFile::exists(appDir+"/bash.exe"))
+    {
+        shell="/bash";
+    }
+    else if(QFile::exists(appDir+"/sh.exe"))
+    {
+        shell="/sh";
+    }
+    else if(QFile::exists(appDir+"/bin/bash.exe"))
+    {
+        shell="/bin/bash";
+    }
+    else if(QFile::exists(appDir+"/bin/sh.exe"))
+    {
+        shell="/bin/sh";
+    }
+    x2goDebug<<"Subsystem shell: "<<shell;
+
+    QString sftp="/sftp-server";
+    if(QFile::exists(appDir+"/sftp-server.exe"))
+    {
+        sftp="/sftp-server";
+    }
+    else if(QFile::exists(appDir+"/bin/sftp-server.exe"))
+    {
+        shell="/bin/sftp-server";
+    }
+    x2goDebug<<"Subsystem sftp: "<<sftp;
+    out << "Subsystem shell "<< wapiShortFileName ( appDir) +shell+"\n"<<
            "ListenAddress 127.0.0.1\n" <<
-           "Subsystem sftp "<< wapiShortFileName ( appDir) +"/bin/sftp-server"+"\n";
+           "Subsystem sftp "<< wapiShortFileName ( appDir) +sftp+"\n";
 #else
     /*
      * We need to find the sftp-server binary.
@@ -11354,7 +11390,17 @@ QString ONMainWindow::generateKey (ONMainWindow::key_types key_type, bool host_k
          << private_key_file;
 
 #ifdef Q_OS_WIN
-    const int keygen_ret = QProcess::execute ("bin\\ssh-keygen", args);
+    QString keygen="ssh-keygen";
+    if(QFile::exists(appDir+"/ssh-keygen.exe"))
+    {
+        keygen="ssh-keygen";
+    }
+    else if(QFile::exists(appDir+"/bin/ssh-keygen.exe"))
+    {
+        keygen="bin\\ssh-keygen";
+    }
+    x2goDebug<<"ssh-keygen: "<<keygen;
+    const int keygen_ret = QProcess::execute (keygen, args);
 #else
     const int keygen_ret = QProcess::execute ("ssh-keygen", args);
 #endif
@@ -11517,6 +11563,16 @@ bool ONMainWindow::startSshd(ONMainWindow::key_types key_type)
         ++port;
     clientSshPort=QString::number ( port );
 #ifdef Q_OS_WIN
+    std::string sshdExec="\\sshd.exe";
+    if(QFile::exists(appDir+"/sshd.exe"))
+    {
+        sshdExec="\\sshd.exe";
+    }
+    else if(QFile::exists(appDir+"/bin/sshd.exe"))
+    {
+        sshdExec="\\bin\\sshd.exe";
+    }
+    x2goDebug<<"SSHD executable: "<<sshdExec.c_str();
     std::string clientdir=wapiShortFileName ( appDir ).toStdString();
     std::stringstream strm;
     std::string config="\""+cygwinPath(etcDir+"/sshd_config").toStdString()+"\"";
@@ -11539,7 +11595,7 @@ bool ONMainWindow::startSshd(ONMainWindow::key_types key_type)
         x2goDebug<<"Logging cygwin sshd to: "<<sshLog;
     }
 
-    strm<<clientdir<<"\\bin\\sshd.exe -D -p "<<clientSshPort.toInt()<<" -f "<< config <<" -h "<<key;
+    strm<<clientdir<<sshdExec<<" -D -p "<<clientSshPort.toInt()<<" -f "<< config <<" -h "<<key;
     if (debugging){
         strm<<" -E "<<"\""<<sshLog.toStdString()<<"\"";
     }

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