zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Danek Duvall <duvall@emufarm.org>
Cc: zsh-workers@sunsite.dk
Subject: Re: compaudit slow with many groups
Date: Tue, 30 Mar 2004 16:28:13 +0200	[thread overview]
Message-ID: <6823.1080656893@trentino.logica.co.uk> (raw)
In-Reply-To: <20040319215724.GB23658@lorien.emufarm.org>

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


      parent reply	other threads:[~2004-03-30 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19 21:57 Danek Duvall
2004-03-21 18:46 ` Danek Duvall
2004-03-22 20:12   ` Peter Stephenson
2004-03-30 14:28 ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6823.1080656893@trentino.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=duvall@emufarm.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).