From fb7bc3a9c7458b1492e7d7a766202d0cb0386185 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 20 Jun 2000 07:15:38 +0000 Subject: a bit of security for compinit (avoid using things writable by others); avoid handling files with the same name twice; remove compconf (11998) --- Completion/Core/compdump | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Completion/Core/compdump') diff --git a/Completion/Core/compdump b/Completion/Core/compdump index 3f013c938..de998bbd2 100644 --- a/Completion/Core/compdump +++ b/Completion/Core/compdump @@ -16,13 +16,20 @@ emulate -L zsh setopt extendedglob -typeset _d_file _d_f _d_bks _d_line _d_als +typeset _d_file _d_f _d_bks _d_line _d_als _d_files _d_file=${_comp_dumpfile-${0:h}/compinit.dump}.$HOST.$$ [[ $_d_file = //* ]] && _d_file=${_d_file[2,-1]} -typeset -U _d_files -_d_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N:t) ) +_d_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) + +if [[ -n "$_comp_secure" ]]; then + _d_wdirs=( ${^fpath}(Nf:g+w:,f:o+w:,^u0u${EUID}) ) + _d_wfiles=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N^u0u${EUID}) ) + + (( $#_d_wfiles )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wfiles})}" ) + (( $#_d_wdirs )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wdirs})/*}" ) +fi print "#files: $#_d_files" > $_d_file -- cgit 1.4.1