From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13723 invoked from network); 30 Mar 2004 14:29:46 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 30 Mar 2004 14:29:46 -0000 Received: (qmail 10581 invoked by alias); 30 Mar 2004 14:29:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19708 Received: (qmail 10570 invoked from network); 30 Mar 2004 14:29:35 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 30 Mar 2004 14:29:35 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 30 Mar 2004 14:29:33 -0000 Received: (qmail 1746 invoked from network); 30 Mar 2004 14:29:33 -0000 Received: from mail36.messagelabs.com (193.109.254.211) by a.mx.sunsite.dk with SMTP; 30 Mar 2004 14:29:28 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-23.tower-36.messagelabs.com!1080656938!5063719 X-StarScan-Version: 5.2.10; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 12244 invoked from network); 30 Mar 2004 14:28:58 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-23.tower-36.messagelabs.com with SMTP; 30 Mar 2004 14:28:58 -0000 Received: from trentino.logica.co.uk ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id i2UESwCk021729; Tue, 30 Mar 2004 15:28:58 +0100 Received: from trentino.logica.co.uk (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id EFEB97969E9B; Tue, 30 Mar 2004 16:28:13 +0200 (CEST) Cc: zsh-workers@sunsite.dk X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: <20040319215724.GB23658@lorien.emufarm.org> From: Oliver Kiddle References: <20040319215724.GB23658@lorien.emufarm.org> To: Danek Duvall Subject: Re: compaudit slow with many groups Date: Tue, 30 Mar 2004 16:28:13 +0200 Message-ID: <6823.1080656893@trentino.logica.co.uk> X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On 19 Mar, Danek Duvall wrote: > work? I'm not positive this is the right set of tests, but if not, > there ought to be some similar way of reducing the overhead of the > function. Is there any system where getent can't take two arguments? At the top of compaudit, it is doing: [[ -x /usr/bin/getent ]] || getent() { cat /etc/$1 } so that function replacement won't handle two argumemts. The patch below allows it to. I'm fairly sure using the two arguments is otherwise portable. Clearly this function could still be better (NIS etc is not handled). I've never been entirely happy with the compaudit stuff. It takes time to run, most people who know about it add -u to compinit and it isn't as if the shell refuses to run world writable programs found in the path. If a security check is necessary, would it not be better done from C code when the, function/whatever is actually loaded. It is equally applicable to stuff picked up from $path and $module_path as $fpath. Also, would it not be better if compinit also listed the insecure files or directed users to run compaudit directly. Otherwise it isn't exactly obvious which files are insecure. Oliver Index: Completion/compaudit =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/compaudit,v retrieving revision 1.7 diff -u -r1.7 compaudit --- Completion/compaudit 22 Mar 2004 19:59:26 -0000 1.7 +++ Completion/compaudit 30 Mar 2004 14:12:18 -0000 @@ -15,7 +15,13 @@ emulate -L zsh setopt extendedglob -[[ -x /usr/bin/getent ]] || getent() { cat /etc/$1 } +[[ -x /usr/bin/getent ]] || getent() { + if [[ $2 = <-> ]]; then + grep ":$2:[^:]*$" /etc/$1 + else + grep "^$2:" /etc/$1 + fi +} # The positional parameters are the directories to check, else fpath. if (( $# )); then