Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to nxproxy for reading from stdin #98

Closed
sunweaver opened this issue Mar 2, 2016 · 0 comments
Closed

Add support to nxproxy for reading from stdin #98

sunweaver opened this issue Mar 2, 2016 · 0 comments

Comments

@sunweaver
Copy link
Member

Add patch for nxproxy to read from stdin, allows nxcl to use standard ssh instead of nxssh
(Portage version: 2.2_rc8/cvs/Linux 2.6.26-gentoo x86_64).

From:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/nx/files/nx-3.2.0-nxproxy_read_from_stdin.patch?diff_format=s&view=markup

--- Main.c.old  2007-07-18 17:39:13.000000000 +0200
+++ Main.c  2008-03-12 04:40:30.000000000 +0100
@@ -36,28 +36,48 @@
   int result = -1;

   char *options = NULL;
-
+  
+  char *nx_commfd_str = NULL;
+  
   options = getenv("NX_DISPLAY");
-
-  if (NXTransParseCommandLine(argc, argv) < 0)
+  
+  if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL)
   {
-    NXTransCleanup();
-  }
+   int nx_commfd = atoi(nx_commfd_str);

-  if (NXTransParseEnvironment(options, 0) < 0)
-  {
-    NXTransCleanup();
+   if (result)
+       result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options);
+ 
+   // go into endless loop
+
+   if (result)
+   {
+       while (NXTransRunning(NX_FD_ANY))
+           result = NXTransContinue(NULL);
+   }
   }
+  else
+  {
+    if (NXTransParseCommandLine(argc, argv) < 0)
+    {
+      NXTransCleanup();
+    }
+
+    if (NXTransParseEnvironment(options, 0) < 0)
+    {
+      NXTransCleanup();
+    }
+
+   /*
+    * This should not return...
+    */
+
+    #ifdef TEST
+    fprintf(stderr, "Main: Yielding control to NX entry point.\n");
+    #endif

-  /*
-   * This should not return...
-   */
-
-  #ifdef TEST
-  fprintf(stderr, "Main: Yielding control to NX entry point.\n");
-  #endif
-
-  result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY);
+    result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY);
+  }

   /*
    * ...So these should not be called.
@sunweaver sunweaver added this to the 3.6.0.x milestone Jun 1, 2016
@sunweaver sunweaver self-assigned this Jun 1, 2016
@sunweaver sunweaver assigned vatral and unassigned sunweaver Jun 20, 2016
sunweaver pushed a commit to sunweaver/nx-libs that referenced this issue Feb 5, 2017
@sunweaver sunweaver assigned sunweaver and unassigned vatral Feb 5, 2017
sunweaver pushed a commit to sunweaver/nx-libs that referenced this issue Feb 5, 2017
@vatral vatral closed this as completed in 4c2fe0d Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants