Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ksh
- if ! [[ -d $1 ]]; then
- echo No such directory "'$1'"
- exit 1
- fi
- . ./lib.sh
- dir_perms $1 && dir_owners $1 || {
- echo Cannot get metainfo of "'$1'" >2
- exit 1
- }
- if [[ wperm_g -eq 0 ]]; then
- set -A allowed $(getent group "$dir_gid" | cut -d: -f4 | tr ',' ' ')
- fi
- usr_by_id $dir_uid || {
- echo Cannot resolve user by uid $dir_uid >2
- exit 1
- }
- if [[ wperm_u -eq 0 ]]; then
- if [[ -z $(echo ${allowed[@]} | sed -n "/$my_usr/p") ]]; then
- set -A allowed $my_usr ${allowed[@]}
- fi
- else
- set -A allowed $(echo ${allowed[@]} | sed "s/\(.*\)$my_usr\(.*\)/\1\2/")
- fi
- if [[ wperm_o -eq 0 ]]; then
- set -A others $(getent passwd | cut -d: -f1)
- echo ${#others[@]} ${#allowed[@]}
- for human in ${allowed[@]}; do
- set -A others $(echo ${others[@]} | sed "s/\(.*\)$human\(.*\)/\1\2/")
- done
- set -A allowed ${others[@]} ${allowed[@]}
- fi
- echo ${allowed[@]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement