[debian-edu-commits] debian-edu/ 153/183: [ Petter Reinholdtsen ] * Rewrite listingmodule to not call groups with a username as argument when looking up the current user, to avoid expencive NSS lookup with LDAP (Closes: #478950).

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:42 UTC 2014


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

ccscanf-guest pushed a commit to branch master
in repository desktop-profiles.

commit c2ba054d8df5c101a12c87422ebc6c8322494b2b
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Thu May 1 21:51:10 2008 +0000

      [ Petter Reinholdtsen ]
      * Rewrite listingmodule to not call groups with a username as argument
        when looking up the current user, to avoid expencive NSS lookup with
        LDAP (Closes: #478950).
---
 debian/changelog |  5 +++++
 listingmodule    | 16 +++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e2250b3..a0c27ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,11 @@ desktop-profiles (1.4.15) unstable; urgency=low
     on http://wiki.debian.org/Proposals/CopyrightFormat)
   * Added Russian translation by Yuri Kozlov (Closes: #454495)
 
+  [ Petter Reinholdtsen ]
+  * Rewrite listingmodule to not call groups with a username as argument
+    when looking up the current user, to avoid expencive NSS lookup with
+    LDAP (Closes: #478950).
+
  -- Bart Cornelis (cobaco) <cobaco at linux.be>  Thu, 06 Dec 2007 09:05:30 +0100
 
 desktop-profiles (1.4.14) unstable; urgency=low
diff --git a/listingmodule b/listingmodule
index d26a9e9..14f1361 100644
--- a/listingmodule
+++ b/listingmodule
@@ -50,11 +50,17 @@ test_requirement(){
   if (test "$1"x = x); then
     exit;
   fi;
-  
-  # initialize needed variables
-  OUR_USER=${2:-$USER}
-  OUR_GROUPS=`groups $OUR_USER | sed "s/^\$OUR_USER : //"`
-  
+
+  # initialize needed variables.  Do not give argument to groups when looking up the current
+  # user, to avoid expensive lookup with LDAP NSS.
+  if [ -z "$2" ] || [ "$USER" = "$2" ]; then
+    OUR_USER="$USER"
+    OUR_GROUPS="`id -Gn`"
+  else
+    OUR_USER="$2"
+    OUR_GROUPS="`id -Gn -- $OUR_USER`"
+  fi
+
   # !... requirement
   if (echo "$1" | grep '^!' > /dev/null) ; then
     GROUP=`echo "$1" | sed 's/^!//'`;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/desktop-profiles.git



More information about the debian-edu-commits mailing list