[X2Go-Commits] [x2goserver] 01/01: x2golistdesktops: Also detect sharable desktop sessions behind abstract kernel namespace sockets.

git-admin at x2go.org git-admin at x2go.org
Sat Jun 21 02:03:27 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 22a4bd1f152ff9f11a7e1da3a6a6ceefb47f0a2f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Jun 21 01:57:04 2014 +0200

    x2golistdesktops: Also detect sharable desktop sessions behind abstract kernel namespace sockets.
    
    Conflicts (resolved by Mike Gabriel):
    	x2goserver/bin/x2golistdesktops
---
 debian/changelog                |    2 ++
 x2goserver/bin/x2golistdesktops |   29 +++++++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2a306f2..663a0d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -155,6 +155,8 @@ x2goserver (4.0.1.16-0x2go1) UNRELEASED; urgency=low
       script.
     - More reliably sync the NX session state with the status information in
       the X2Go session DB.
+    - x2golistdesktops: Also detect sharable desktop sessions behind abstract
+      kernel namespace sockets.
   * debian/control, x2goserver.spec:
     + Update versioned D: x2goagent (>= 3.5.0.25). This assures that X2Go
       works with poly-instantiated /tmp directories.
diff --git a/x2goserver/bin/x2golistdesktops b/x2goserver/bin/x2golistdesktops
index 01ba266..073541f 100755
--- a/x2goserver/bin/x2golistdesktops
+++ b/x2goserver/bin/x2golistdesktops
@@ -61,27 +61,32 @@ my $rdisp=join("I", at rdisplays);
 $rdisp="I${rdisp}I";
 
 my $uname=$ENV{'USER'};
-my $outp=system_capture_stdout_output("ls",  "-1",  "/tmp/.X11-unix/");
-my @outp=split("\n","$outp");
+my system_capture_stdout_output("ss", "-lxu");
+my @lines=split("\n", "$lines");
+
+my @outp = grep ( /(@| )\/tmp\/.X11-unix\/X.*/, @lines);
+my @displays;
 for(my $i=0;$i<@outp;$i++)
 {
 	my $display=@outp[$i];
-	$display=~s/X/:/;
+	$display=~s|.*/tmp/.X11-unix/X([0-9]*).*|:$1|;
 	my $checkdisp=$display;
 	$checkdisp=~s/:/I/;
 	$checkdisp="${checkdisp}I";
 	if (!( $rdisp =~ m/$checkdisp/ ))
 	{
-		my $inf=system_capture_stdout_output("xwininfo", "-root", "-display", "$display");
-		if ( $inf=~ m/geometry/)
-		{
-			print "$uname\@$display\n";
+		if ( grep { $_ eq "$uname\@$display" } @displays ) {
+		} else {
+			my $inf=system_capture_stdout_output("xwininfo", "-root", "-display", "$display");
+			if ( $inf=~ m/geometry/)
+			{
+				push (@displays, "$uname\@$display");
+			}
 		}
 	}
 }
 
-# FIXME: finally get rid of this non-critical backtick expression
-$outp=`ls -1 /tmp/ | grep x2godesktopsharing_`;
+my $outp=`ls -1 /tmp/ | grep x2godesktopsharing_`;
 @outp=split("\n","$outp");
 
 for(my $i=0;$i<@outp;$i++)
@@ -89,9 +94,13 @@ for(my $i=0;$i<@outp;$i++)
 	my @ln=split("\@", at outp[$i]);
 	if ( @ln[1] ne $uname )
 	{
-		print "@ln[1]\@@ln[2]\n";
+		push (@displays, "@ln[1]\@@ln[2]\n");
 	}
 }
 
+if (@displays) {
+	print "@displays\n";
+}
 # closing syslog 
 closelog;
+

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list