Re: [patch] LDM Nomad support with local CD/DVD/USB and sound

Jigish Gohil <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
On Wed, Feb 18, 2009 at 1:40 PM, Jigish Gohil <[email protected]> wrote:
> On Sat, Feb 14, 2009 at 12:54 AM, Vagrant Cascadian
> <[email protected]> wrote:
>>
>> overall this patch looks good. i tested it with plain rdesktop/xrdp, and it
>> seems to basically work, although no support for sound or localapps.  it also
>> doesn't seem to respect changing the selected session or language.
>>
>
> Localapps cannot work as rdesktop session does not share the same X
> root window through which we handle xprop communication.
>
> We didn't see anything in rdesktop command to handle session and language.
>

Attached is updated patch that handles session. However xrdp version I
tested it on is broken, "-s shell" has no effect, have filed bug
report so hopefully it should get fixed soon.

Ciao

-J

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
LDM-Nomad-support.diff (unknown/unknown, 3.8 KB)
diff -ur a/rc.d/X95-run-x-session b/rc.d/X95-run-x-session
--- a/rc.d/X95-run-x-session	2009-03-02 20:56:04.000000000 +0530
+++ b/rc.d/X95-run-x-session	2009-03-02 20:56:31.000000000 +0530
@@ -49,7 +49,12 @@
     MY_LOCALDEV="; /usr/sbin/ltspfsmounter all cleanup"
 fi
 
-ssh -Y -t -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SOUND $LDM_XSESSION $LDM_SESSION < /dev/null > /dev/null $MY_LOCALDEV"
+# If nomad is used, just export variables to file else run full Xsession
+if boolean_is_true "$LDM_NOMAD"; then
+        ssh -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "echo $MY_SOUND > ~/.ltspvars"
+else
+        ssh -Y -t -S $LDM_SOCKET -l $LDM_USERNAME $LDM_SERVER "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SOUND $LDM_XSESSION $LDM_SESSION < /dev/null > /dev/null $MY_LOCALDEV"
+fi
 
 if [ "$SOUND_DAEMON" = "esd" ]; then
     kill $ESD_PID
diff -ur a/src/ldm.c b/src/ldm.c
--- a/src/ldm.c	2009-03-02 20:56:04.000000000 +0530
+++ b/src/ldm.c	2009-03-02 21:02:20.000000000 +0530
@@ -285,6 +285,7 @@
 void
 x_session(void)
 {
+    gchar *command;
     get_Xsession();
 
     setenv("LDM_SESSION", ldm.session, 1);
@@ -293,6 +294,12 @@
         setenv("LDM_LANGUAGE", ldm.lang, 1);
 
     rc_files("xsession");
+    if (ldm.nomad) {
+        command = g_strjoin(" ", "rdesktop", "-z", "-f", "-u", ldm.username, "-p", ldm.password, "-s", ldm.session, " ", ldm.server, NULL);
+        ldm.nomadpid = ldm_spawn(command, NULL, NULL, NULL);
+        g_free(command);
+        g_free(ldm.password);
+    }
 }
 
 /*
@@ -431,6 +438,7 @@
     ldm.localdev = ldm_getenv_bool("LOCALDEV");
     ldm.override_port = g_strdup(getenv("SSH_OVERRIDE_PORT"));
     ldm.directx = ldm_getenv_bool("LDM_DIRECTX");
+    ldm.nomad = ldm_getenv_bool("LDM_NOMAD");
     ldm.autologin = ldm_getenv_bool("LDM_AUTOLOGIN");
     ldm.lang = g_strdup(getenv("LDM_LANGUAGE"));
     ldm.session = g_strdup(getenv("LDM_SESSION"));
Only in b/src: ldm.c.orig
diff -ur a/src/ldm.h b/src/ldm.h
--- a/src/ldm.h	2009-03-02 20:56:04.000000000 +0530
+++ b/src/ldm.h	2009-03-02 20:56:31.000000000 +0530
@@ -22,12 +22,14 @@
     gboolean sound;
     gboolean localdev;
     gboolean directx;
+    gboolean nomad;
     gint     sshfd;
     gint     sshslavefd;
     GIOChannel *greeterr;
     GIOChannel *greeterw;
     GPid     pid;
     GPid     sshpid;
+    GPid     nomadpid;
     GPid     xsessionpid;
     GPid     greeterpid;
 };
diff -ur a/src/sshutils.c b/src/sshutils.c
--- a/src/sshutils.c	2009-03-02 20:56:04.000000000 +0530
+++ b/src/sshutils.c	2009-03-02 20:56:31.000000000 +0530
@@ -181,8 +181,10 @@
            end of the line */
         if (seen == 0) {
             loginfo(_("Logged in successfully.\n"));
-            g_free(ldm.password);
-            ldm.password = NULL;
+            if(!ldm.nomad) {
+                g_free(ldm.password);
+                ldm.password = NULL;
+            }
             return;
         } else if (seen == 1) {
             int i;
@@ -202,8 +204,10 @@
                 }
                 write(fd, ldm.password, strlen(ldm.password));
                 write(fd, "\n", 1);
-                g_free(ldm.password);
-                ldm.password = NULL;
+                if (!ldm.nomad) {
+                    g_free(ldm.password);
+                    ldm.password = NULL;
+                }
             }
             first_time = 0;
         } else if (seen < 0) {
@@ -272,7 +276,10 @@
         /* socket still exists, so we need to shut down the ssh link */
 
         command = g_strjoin(" ", "ssh", "-S", ldm.control_socket, "-O", "exit", ldm.server, NULL);
-
+        if (ldm.nomad) {
+            ldm_wait(ldm.nomadpid);
+            ldm.nomadpid = 0;
+        }
         loginfo(_("Shutting down ssh session: %s"), command);
         pid = ldm_spawn(command, NULL, NULL, NULL);
         ldm_wait(pid);
Only in b/src: sshutils.c.orig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.