[FreeNX-kNX] Problem connecting with nxclient to nxserver [SOLVED]

chris at ccburton.com chris at ccburton.com
Mon Jul 5 20:34:21 UTC 2010


Freek de Kruijf <f.de.kruijf at gmail.com> wrote on 05/07/2010 16:21:51:

> Op maandag 5 juli 2010 16:27:46 schreef Florian Schmidt:
> > Hi,
> > 
> > I think the MD5SUM entry is depending on which Linux distribution you 
are
> > using. On RedHat Enterprise 4/5 you find in /usr/bin/nxloadconfig the
> > default of:
> > 
> > COMMAND_MD5SUM="openssl md5"
> > 
> > It would like to know what the default in nxloadconfig on your 
distribution
> > is. I gues it will be: /usr/NX/bin/nxloadconfig in OpenSuSE but best 
is
> > that you check with >> which nxagent
> > the nxloadconfig should be in the same dir or somewhere nearby.
> 
> Both nxagent and nxloadconfig are in /usr/bin/ and indeed nxloadconfig 
> contains 'COMMAND_MD5SUM="openssl md5"'
> The error message I got and why the connection did not work was a 
> bit strange; 
> it was about a non-existing file or directory 
> /var/lib/nxserver/db/running/sessionId{(STDIN)=} Note the = near the end
> where /var/lib/nxserver/db/running/sessionId{(STDIN)} did exist without 
the =.

This is a good one !!


The
         /var/lib/nxserver/db/running

directory holds a file entry for each running NX session, containing among 
other
things information about who is running it, for reconnection purposes.


Its name is in the format

        sessionId{unique 32 digit hex session number}

where the "unique 32 digit hex session number" is conveniently generated 
by using 

 uniqueid=$(echo $[$RANDOM*$RANDOM] | $COMMAND_MD5SUM | cut -d" " -f1 | tr 
"[a-z]" "[A-Z]")


which, if your

                | openssl md5

produces output of the format

        (STDIN)= 01234567890ABCDEF0123456789ABCDE

means that the cut -f1 will give (STDIN)= every time, for the session ID 
and therefore
means that all sessions would use the same file (if it was correctly
created).


The   mv  command you see failing is when the attempt is made to move
the file from
        /running
 to
        /var/lib/nxserver/db/closed  (or failed)
when the session terminates (or fails).


The cut -f1 probably comes about because

        md5sum

if it is used, appends a "  -"  for stdin . . . ie.

        01234567890ABCDEF0123456789ABCDE  -




So

a patch for all three senarios ( for anyone still interested ) is 

echo $[$RANDOM*$RANDOM] | $COMMAND_MD5SUM | tr " " "\n" | egrep "^.{32}$" 
| tr "[a-z]" "[A-Z]"

or

as a diff -u ( watch the line wrapping)


--- nxserver    2009-12-08 20:06:13.000000000 +0000
+++ nxserver.mod        2009-12-09 20:06:13.000000000 +0000
@@ -352,7 +352,7 @@
                export DESKTOP_SHARING_IDS=""
                for i in $(LC_ALL=C netstat -ln --protocol=unix | egrep 
'X11-unix/X[0-9]$' | sed 's/.*X\(.*\)/\1/g')
                do
-                       uniqueid=$(echo $[$RANDOM*$RANDOM] | 
$COMMAND_MD5SUM | cut -d" " -f1 | tr "[a-z]" "[A-Z]")
+                       uniqueid=$(echo $[$RANDOM*$RANDOM] | 
$COMMAND_MD5SUM | tr " " "\n" | egrep "^.{32}$" | tr "[a-z]" "[A-Z]")
                        DESKTOP_SHARING_IDS="$DESKTOP_SHARING_IDS 
$uniqueid=$i"
                        printf "%-7s %-16s %32s %8s %5s %-14s %-11s %s\n" 
"$i" "vnc-local" "$uniqueid" "--------" "$udepth" "$(echo $3 | cut -d'x' 
-f1,2)" "Running" "X$i (Local)" >> $TMPFILE
                done
@@ -1489,7 +1489,7 @@
                        return
                fi

-               uniqueid=$(echo $[$RANDOM*$RANDOM] | $COMMAND_MD5SUM | cut 
-d" " -f1 | tr "[a-z]" "[A-Z]")
+               uniqueid=$(echo $[$RANDOM*$RANDOM] | $COMMAND_MD5SUM | tr 
" " "\n" | egrep "^.{32}$" | tr "[a-z]" "[A-Z]")

 
FULL_PARAMS="$PARAMS&user=$USER&userip=$USERIP&uniqueid=$uniqueid&display=$SESS_DISPLAY&host=$SERVER_HOST"
                log_secure "6" "$FULL_PARAMS"


ie.

1/ openssl md5  "normal"

echo "1234567890abcdef1234567890abcdef"|tr " " "\n"|egrep "^.{32}$"|tr 
"[a-z]" "[A-Z]"


2/ openssl md5  with (STDIN)

echo "(stdin)= 1234567890abcdef1234567890abcdef"|tr " " "\n"|egrep 
"^.{32}$"|tr "[a-z]" "[A-Z]"


3/ md5sum

echo "1234567890abcdef1234567890abcdef  -"|tr " " "\n"|egrep "^.{32}$"|tr 
"[a-z]" "[A-Z]"

and yes, I know it's only a-f in hex


I couldn't tell you whose openssl-s tell you they are md5-ing STDIN in 
that manner or whether it's now a new feature
and
I agree that the easyest and quickest work around is swapping from openssl
to md5sum


> 
> -- 
> fr.gr.
> 
> Freek de Kruijf
> ________________________________________________________________
>      Were you helped on this list with your FreeNX problem?
>     Then please write up the solution in the FreeNX Wiki/FAQ:
> 
> 
http://openfacts2.berlios.de/wikien/index.php/BerliosProject:FreeNX_-_FAQ
> 
>          Don't forget to check the NX Knowledge Base:
>                  http://www.nomachine.com/kb/ 
> 
> ________________________________________________________________
>        FreeNX-kNX mailing list --- FreeNX-kNX at kde.org
>       https://mail.kde.org/mailman/listinfo/freenx-knx
> ________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/freenx-knx/attachments/20100705/1d866b91/attachment.html>


More information about the FreeNX-kNX mailing list