Server IP : 103.119.228.120 / Your IP : 3.12.73.149 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/zsh/5.0.2/functions/ |
Upload File : |
# So that this file can also be read with `.' or `source' ... compaudit() { # Define and then call # Audit the fpath to assure that it contains all the directories needed by # the completion system, and that those directories are at least unlikely # to contain dangerous files. This is far from perfect, as the modes or # ownership of files or directories might change between the time of the # audit and the time the function is executed. # This function is designed to be called from compinit, which assumes that # it is in the same directory, i.e., it can be autoloaded from the initial # fpath as compinit was. Most local parameter names in this function must # therefore be the same as those used in compinit. emulate -L zsh setopt extendedglob [[ -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 local _compdir='' elif (( $#fpath == 0 )); then print 'compaudit: No directories in $fpath, cannot continue' 1>&2 return 1 else set -- $fpath fi # _i_check is defined by compinit; used here as a test for whether this # function is running standalone or was called by compinit. If called # by compinit, we use parameters that are defined in compinit's scope, # otherwise we make them local here. (( $+_i_check )) || { local _i_q _i_line _i_file _i_fail=verbose local -a _i_files _i_addfiles _i_wdirs _i_wfiles local -a -U +h fpath } fpath=( $* ) # _compdir may be defined by the user; see the compinit documentation. # If it isn't defined, we want it to point somewhere sensible, but the # user is allowed to set it to empty to bypass the check below. (( $+_compdir )) || { local _compdir=${fpath[(r)*/$ZSH_VERSION/*]} [[ -z $_compdir ]] && _compdir=$fpath[1] ### [[ -d $_compdir/../Base ]] && _compdir=${_compdir:h} } _i_wdirs=() _i_wfiles=() _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) if [[ -n $_compdir ]]; then if [[ $#_i_files -lt 20 || $_compdir = */Base || -d $_compdir/Base ]]; then # Too few files: we need some more directories, or we need to check # that all directories (not just Base) are present. _i_addfiles=() if [[ -d $_compdir/Base/Core ]]; then # Add all the Completion subdirectories (CVS-layout) _i_addfiles=(${_compdir}/*/*(/^M)) elif [[ -d $_compdir/Base ]]; then # Likewise (installation-layout) _i_addfiles=(${_compdir}/*(/^M)) fi for _i_line in {1..$#_i_addfiles}; do _i_file=${_i_addfiles[$_i_line]} [[ -d $_i_file && -z ${fpath[(r)$_i_file]} ]] || _i_addfiles[$_i_line]= done fpath=($fpath $_i_addfiles) _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) fi fi [[ $_i_fail == use ]] && return 0 # We search for: # - world/group-writable directories in fpath not owned by root and the user # - parent-directories of directories in fpath that are world/group-writable # and not owned by root and the user (that would allow someone to put a # digest file for one of the directories into the parent directory) # - digest files for one of the directories in fpath not owned by root and # the user # - and for files in directories from fpath not owned by root and the user # (including zwc files) _i_wdirs=( ${^fpath}(N-f:g+w:,-f:o+w:,-^u0u${EUID}) ${^fpath:h}(N-f:g+w:,-f:o+w:,-^u0u${EUID}) ) # RedHat Linux "per-user groups" check. This is tricky, because it's very # difficult to tell whether the sysadmin has put someone else into your # "private" group (e.g., via the default group field in /etc/passwd, or # by NFS group sharing with an untrustworthy machine). So we must assume # that this has not happened, and pick the best group. if (( $#_i_wdirs )); then local GROUP GROUPMEM _i_pw _i_gid if ((UID == EUID )); then getent group $LOGNAME | IFS=: read GROUP _i_pw _i_gid GROUPMEM else getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM fi if [[ $GROUP == $LOGNAME && ( -z $GROUPMEM || $GROUPMEM == $LOGNAME ) ]] then _i_wdirs=( ${^_i_wdirs}(N-f:g+w:^g:${GROUP}:,-f:o+w:,-^u0u${EUID}) ) fi fi if [[ -f /etc/debian_version ]] then local _i_ulwdirs _i_ulwdirs=( ${(M)_i_wdirs:#/usr/local/*} ) _i_wdirs=( ${_i_wdirs:#/usr/local/*} ${^_i_ulwdirs}(Nf:g+ws:^g:staff:,f:o+w:,^u0) ) fi _i_wdirs=( $_i_wdirs ${^fpath}.zwc^([^_]*|*~)(N-^u0u${EUID}) ) _i_wfiles=( ${^fpath}/^([^_]*|*~)(N-^u0u${EUID}) ) case "${#_i_wdirs}:${#_i_wfiles}" in (0:0) _i_q= ;; (0:*) _i_q=files ;; (*:0) _i_q=directories ;; (*:*) _i_q='directories and files' ;; esac if [[ -n "$_i_q" ]]; then [[ $_i_fail == verbose ]] && { print There are insecure ${_i_q}: 1>&2 print -l - $_i_wdirs $_i_wfiles } return 1 fi return 0 } # Define and then call compaudit "$@"