[FreeNX-kNX] Patch to (re)-allow FreeNX shadowing of :0 (Local) sessions - ubuntu FreeNX and its derivatives

chris at ccburton.com chris at ccburton.com
Wed Jul 4 13:04:26 UTC 2012


I doubt anyone is intersted anymore, but just in case
here's a re-patch to allow shadowing of console sessions.

Note this applies to ubuntu FreeNX and its derivatives.

Fedora, Centos & Suse haven't included the patch mentioned.




A previous patch, which stopped "nxclient" using lots of server
resource by repeatedly calling

        session_list_user_suspended()

in nxserver every few second , (to update the client's list of user 
sessions in case they'd changed ),
renamed the procedure and wrapped it as :-

SESSION_LIST_CACHE_DATA=$(_session_list_user_suspended "$@")

(line 276)

Calling the wrapped procedure by spawning, stopped the variable

        DESKTOP_SHARING_IDS

in
the calling instance of nxsever
from
including the NEW uniqueid(s) created for the "(Local)" ( :0) session(s),

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

which
not being FreeNX sessions, don't appear in

         /var/lib/nxserver/db/running/*

This meant that the code for launching nxagent in shadow mode
couldn't find the "shadowdisplay"

shadowdisplay=$(echo $DESKTOP_SHARING_IDS | tr ' ' '\n' | egrep 
"^$uniqueid=" | cut -d'=' -f2)
(line 1335)

hence

        NX> 596 Could not find shadowed session . . . . . Session failed.

in the log.








--- nxserver-ubuntu     2012-01-01 00:00:00.000000000 +0100
+++ nxserver    2012-07-04 12:33:38.000000000 +0100
@@ -266,20 +266,18 @@

 # List all sessions of a user

+
+session_list_user_suspended()
+{
 # Cache the session list output for up to 30 seconds because nxclient
 # repeatedly queries it very fast, which creates performance problems.
-session_list_user_suspended() {
-       args="$1 $2 $3 $4"
-       if [[ "$args" != "$SESSION_LIST_CACHE_ARGS" || $(($(date +%s) - 
${SESSION_LIST_CACHE_TIME:-0})) -gt 30 ]] ; then
-         SESSION_LIST_CACHE_ARGS="$args"
-         SESSION_LIST_CACHE_TIME=$(date +%s)
-         SESSION_LIST_CACHE_DATA=$(_session_list_user_suspended "$@")
-       fi
-       echo "$SESSION_LIST_CACHE_DATA"
-}

-_session_list_user_suspended()
-{
+if [[ "$@" == "$SESSION_LIST_CACHE_ARGS" && $(($(date +%s) - 
${SESSION_LIST_CACHE_TIME:-0})) -lt 30 ]] ; then
+       echo "$SESSION_LIST_CACHE_DATA" # Just repeat what was sent last 
time . . .
+else
+        SESSION_LIST_CACHE_ARGS="$@"
+        SESSION_LIST_CACHE_TIME=$(date +%s)
+
        SESSION_COUNT=0
        SESSION_COUNT_USER=0

@@ -379,8 +377,10 @@
                echo "NX> 148 Server capacity: not reached for user: $1" 
>> $TMPFILE
        fi

+        SESSION_LIST_CACHE_DATA="$(cat $TMPFILE)"
        cat $TMPFILE | log_tee
        rm -f $TMPFILE
+fi
 }

 session_list_user()









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/freenx-knx/attachments/20120704/e0748a98/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nxserver-patch-re-shadowing-console-sessions.diff
Type: application/octet-stream
Size: 1323 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/freenx-knx/attachments/20120704/e0748a98/attachment.obj>


More information about the FreeNX-kNX mailing list