xdmcp script don't work with a remote server

Bug #1175618 reported by Andrey de Oliveira
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LTSP5
Fix Committed
Low
Unassigned
Ubuntu
New
Undecided
Unassigned

Bug Description

Hi,

PROBLEM:

I tried use xdmcp (startx) script in LTSP to connect in a remote X server and it not work. Although using the package for Ubuntu, I checked that the same occurs in the packet with the ltsp 5.4.5 source code, independent of the distribution.

lts.conf

[00:11:22:AA:BB:CC]
SCREEN_07=xdmcp
XDM_SERVER=x.x.x.x

When thinclient boot, the XDM_SERVER value is ignored.

I found a bug in screen_session script, line 78 (or was it in bash?). It calls a script with $args variable as argument between double quotes:

78: "$script_path" "$args"

In xdmcp script lines 19-23, exists a condition, based in number of arguments:

19: if [ $# -lt 1 ]; then
20: X_ARGS="$X_ARGS -query ${XDM_SERVER}"
21: else
22: X_ARGS="$X_ARGS $*"
23: fi

Even without arguments, in this case, $args empty, bash/sh return 1 as total arguments in $# variable, because of the double quotes used in screen_session script.

So the condition will always be FALSE, ignoring XDM_SERVER value.

SOLUTION:

change session script line 78 to:
78: "$script_path" $args
or
78: eval "$script_path" "$args"

Regards,

Andrey de Oliveira
LPIC-1

Tags: startx xdmcp
description: updated
description: updated
Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

The same problem appears whith ssh session script (bug #1020113). It is (as you correctly found out), caused by wrong quoting of arguments in line 78 of /opt/ltsp/i386/usr/share/ltsp/screen_session.
Bug report #1020113 contains a patch that seems to fix the problem (I confirm it works for the ssh session script), but it has not (yet) made it into the release.
Marking as duplicate.

Revision history for this message
Vagrant Cascadian (vagrantc) wrote : Re: [Bug 1175618] [NEW] xdmcp script don't work with a remote server

On 2013-05-02 09:05:16 -0500, Andrey de Oliveira wrote:
> When thinclient boot, the XDM_SERVER value is ignored.
...
> In xdmcp script lines 19-23, exists a condition, based in number of
> arguments:
>
> 19: if [ $# -lt 1 ]; then
> 20: X_ARGS="$X_ARGS -query ${XDM_SERVER}"
> 21: else
> 22: X_ARGS="$X_ARGS $*"
> 23: fi
>
> Even without arguments, in this case, $args empty, bash/sh return 1 as
> total arguments in $# variable, because of the double quotes used in
> screen_session script.

Wouldn't a viable option be:

diff --git a/client/share/ltsp/screen.d/xdmcp b/client/share/ltsp/screen.d/xdmcp
index 26924c0..d9e31a0 100755
--- a/client/share/ltsp/screen.d/xdmcp
+++ b/client/share/ltsp/screen.d/xdmcp
@@ -16,7 +16,7 @@

 XDM_SERVER=${XDM_SERVER:-${SERVER}}

-if [ $# -lt 1 ]; then
+if [ -z "$1" ]; then
     X_ARGS="$X_ARGS -query ${XDM_SERVER}"
 else
     X_ARGS="$X_ARGS $*"

That seems more meaningful than checking the number of arguments
anyways. I guess you could get passed an empty argument...

live well,
  vagrant

Changed in ltsp:
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Vagrant Cascadian (vagrantc) wrote :
Changed in ltsp:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.