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 Mon, Feb 9, 2009 at 8:48 PM, Jigish Gohil <[email protected]> wrote: > > Can we get this merged if there is no objection? I really would not > like to maintain the patch as ltsp upstream is changing at such rapid > pace. > Attached is an updated patch, run-x-session script was renamed so the earlier patch did not apply. This patch also fixes bad white spaces. > As explained, the password is not exported nor visible anywhere, and > the code applies only if LDM_NOMAD is set in lts.conf so it does not > affect any other parts of ltsp. Cheers -J ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _____________________________________________________________________ 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
(text/x-patch, 3.3 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-02-10 12:01:16.000000000 +0530
+++ b/rc.d/X95-run-x-session 2009-02-10 13:39:30.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-02-10 12:01:16.000000000 +0530
+++ b/src/ldm.c 2009-02-10 12:02:05.000000000 +0530
@@ -271,6 +271,7 @@
void
x_session(void)
{
+ gchar *command;
get_Xsession();
setenv("LDM_SESSION", ldm.session, 1);
@@ -279,6 +280,12 @@
setenv("LDM_LANGUAGE", ldm.lang, 1);
rc_files("xsession");
+ if (ldm.nomad) {
+ command = g_strjoin(" ", "rdesktop", "-z", "-f", "-u", ldm.username, "-p", ldm.nomadpassword, " ", ldm.server, NULL);
+ ldm.nomadpid = ldm_spawn(command, NULL, NULL, NULL);
+ g_free(command);
+ g_free(ldm.nomadpassword);
+ }
}
/*
@@ -417,6 +424,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"));
@@ -510,6 +518,9 @@
putenv(server_env);
putenv(user_env);
+ /* store password for rdesktop */
+ ldm.nomadpassword = g_strdup(ldm.password);
+
ssh_session(); /* Log in via ssh */
if (ldm.greeterpid) {
diff -ur a/src/ldm.h b/src/ldm.h
--- a/src/ldm.h 2009-02-10 12:01:16.000000000 +0530
+++ b/src/ldm.h 2009-02-10 11:57:11.000000000 +0530
@@ -9,6 +9,7 @@
gchar *authfile;
gchar *username;
gchar *password;
+ gchar *nomadpassword;
gchar *lang;
gchar *session;
gchar *xsession;
@@ -22,12 +23,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-02-10 12:01:16.000000000 +0530
+++ b/src/sshutils.c 2009-02-10 11:57:11.000000000 +0530
@@ -247,6 +247,11 @@
command = g_strjoin(" ", "ssh", "-S", ldm.control_socket, "-O", "exit", ldm.server, NULL);
+ if (ldm.nomad) {
+ ldm_wait(ldm.nomadpid); /* wait for rdesktop to close before closing socket */
+ ldm.nomadpid = 0;
+ }
+
loginfo(_("Shutting down ssh session: %s"), command);
pid = ldm_spawn(command, NULL, NULL, NULL);
ldm_wait(pid);