[X2Go-Commits] [x2goserver] 01/01: x2goserver/bin/x2gosessionlimit: don't iterate over the whole groups file.

git-admin at x2go.org git-admin at x2go.org
Sat Jun 6 03:46:50 CEST 2015


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

x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.

commit 6e946eeb765d528852669effc4dbfd3812e6be5d
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Jun 6 03:44:18 2015 +0200

    x2goserver/bin/x2gosessionlimit: don't iterate over the whole groups file.
    
    Only check the primary and secondary groups as returned by
    getgid()/getgroups().
    
    Fixes long delays in session startup for UW, who are connected to an AD
    server with a gazillion of groups.
---
 debian/changelog                |    4 ++++
 x2goserver/bin/x2gosessionlimit |   21 +++++++--------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7d9341c..84be058 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ x2goserver (4.0.1.20-0x2go1) UNRELEASED; urgency=low
     - x2goserver/bin/x2gogetapps: do not print spurious newlines.
     - Change string "X2go" to "X2Go" where appropriate.
     - Add runcommand.d hooks to x2goserver-extensions Makefile.
+    - x2goserver/bin/x2gosessionlimit: don't iterate over the whole groups
+      file. Only check the primary and secondary groups as returned by
+      getgid()/getgroups(). Fixes long delays in session startup for UW, who
+      are connected to an AD server with a gazillion of groups.
   * x2goserver.spec:
     - Add sudo and logcheck as BuildRequires and Requires. Don't own
       directories that are owned by sudo and logcheck. Logcheck is not
diff --git a/x2goserver/bin/x2gosessionlimit b/x2goserver/bin/x2gosessionlimit
index f8f1b96..99e3649 100755
--- a/x2goserver/bin/x2gosessionlimit
+++ b/x2goserver/bin/x2gosessionlimit
@@ -27,6 +27,8 @@ use Sys::Syslog qw( :standard :macros );
 use lib `x2gopath lib`;
 use x2gologlevel;
 
+use English;
+
 openlog($0,'cons,pid','user');
 setlogmask( LOG_UPTO(x2gologlevel()) );
 
@@ -83,25 +85,16 @@ if($strlimit ne "")
 }
 
 
-my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($uname);
+my @assigned_groups = split (" ", $REAL_GROUP_ID);
 
-while (my ($name, $passwd, $gid, $members)  = getgrent()) 
-{
-	if ( $pgid eq $gid)
-	{
+foreach my $current_group (@assigned_groups) {
+	my $name = getgrgid ($current_group);
+
+	if (defined ($name)) {
 		getGroupLimit $name;
 	}
-	my @memebers=split(" ",$members);
-	foreach my $member (@memebers) 
-	{
-		if ($uname eq $member  )
-		{
-			getGroupLimit $name;
-		}
-	}
 }
 
-
 if ($scount < $maxlimit)
 {
 	print "$maxlimit\n";

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


More information about the x2go-commits mailing list