- Timestamp:
- Jan 30, 2015, 3:08:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/locker/sbin/check-users
r981 r2664 1 1 #!/bin/bash 2 set -e 2 set -eu 3 3 4 4 err() { 5 ok= 5 6 echo "$@" 6 7 } 7 8 8 if [ -z "$1"]; then9 if [ $# -eq 0 ]; then 9 10 filter="objectClass=posixAccount" 10 11 else … … 18 19 unset "${!l_@}" 19 20 while read attr value; do 21 ok=t 20 22 if [ -n "$attr" ]; then 21 23 declare "l_${attr%:}=$value" … … 23 25 fi 24 26 25 read f_type f_data < <(hesinfo "$l_uid" filsys) || :27 read f_type f_data < <(hesinfo -- "$l_uid" filsys | sort -nk5,5) || : 26 28 if [ -z "$f_type" ]; then 27 29 err "$l_uid" "no_hesiod" … … 31 33 read f_path f_perm f_link z \ 32 34 < <(echo "$f_data") 33 [ "$ l_homeDirectory" = "$f_path" ] || \34 err "$l_uid" "hesiod_path $f_path "35 [ "${l_homeDirectory#/disabled}" = "$f_path" ] || \ 36 err "$l_uid" "hesiod_path $f_path (LDAP $l_homeDirectory)" 35 37 else 36 38 err "$l_uid" "wrong_hesiod $f_type" 37 39 fi 38 40 39 IFS=/ read p_empty p_top p_cell p \ 40 < <(echo "$l_homeDirectory") 41 [ -z "${p_empty}" ] || \ 42 err "$l_uid" "relative_home $l_homeDirectory" 43 [ "${p_top}" = "afs" ] || \ 44 err "$l_uid" "not_afs $l_homeDirectory" 41 p_cell= 42 case "$l_homeDirectory" in 43 /afs/*) 44 p_cell="${l_homeDirectory#/afs/}" 45 p_cell="${p_cell%%/*}" 46 ;; 47 /disabled/afs/*) 48 err "$l_uid" "disabled $l_homeDirectory" 49 l_homeDirectory="${l_homeDirectory#/disabled}" 50 p_cell="${l_homeDirectory#/afs/}" 51 p_cell="${p_cell%%/*}" 52 ;; 53 /*) 54 err "$l_uid" "not_afs $l_homeDirectory" 55 ;; 56 *) 57 err "$l_uid" "relative_home $l_homeDirectory" 58 ;; 59 esac 45 60 46 61 read v_vname v_vol v \ 47 < <(vos exa -noauth "$l_uidNumber" -cell "$p_cell" 2>/dev/null) || :62 < <(vos examine -noauth -id "$l_uidNumber" -cell "${p_cell#.}" 2>/dev/null) || : 48 63 [ "$v_vol" = "$l_uidNumber" ] || 49 err "$l_uid" "no_vol $ l_uidNumber"64 err "$l_uid" "no_vol ${p_cell#.} $l_uidNumber" 50 65 51 66 if ! [ -d "$l_homeDirectory" ]; then 52 67 if ! [ -e "$l_homeDirectory" ]; then 53 err "$l_uid" " deleted$l_homeDirectory"68 err "$l_uid" "no_home $l_homeDirectory" 54 69 else 55 70 err "$l_uid" "not_dir $l_homeDirectory" … … 57 72 else 58 73 read c c_path c c c c_cell \ 59 < <(fs whichcell "$l_homeDirectory" 2>/dev/null) || :74 < <(fs whichcell -path "$l_homeDirectory" 2>/dev/null) || : 60 75 [ "$c_path" = "$l_homeDirectory" ] || \ 61 76 err "$l_uid" "no_cell $l_homeDirectory" 62 [ "$c_cell" = "'$ p_cell'" ] || \63 err "$l_uid" "wrong_cell $ l_homeDirectory"77 [ "$c_cell" = "'${p_cell#.}'" ] || \ 78 err "$l_uid" "wrong_cell $p_cell $l_homeDirectory $c_cell" 64 79 65 80 read m_path m m m m m m m_vname \ 66 < <(fs lsmount "$l_homeDirectory" 2>/dev/null) || :81 < <(fs lsmount -dir "$l_homeDirectory" 2>/dev/null) || : 67 82 [ "$m_path" = "'$l_homeDirectory'" ] || \ 68 83 err "$l_uid" "no_mount $l_homeDirectory" 69 [ "$m_vname" = "'#$v_vname'" ] || [ "$m_vname" = "'%$v_vname'" ] || \ 70 err "$l_uid" "wrong_mount $m_vname ($l_uidNumber = $v_vname)" 84 85 case "$m_vname" in 86 "'#$v_vname'" | "'%$v_vname'" | "'#${p_cell#.}:$v_vname'" | "'%{p_cell#.}:$v_vname'") 87 ;; 88 *) 89 m_vname2="${m_vname#\'[#%]}" 90 m_vname2="${m_vname2%\'}" 91 m_cell="${m_vname2%%:*}" 92 [ "$m_cell" != "$m_vname2" ] || m_cell="${p_cell#.}" 93 m_vname2="${m_vname2#*:}" 94 read m_vname2 m_vol m \ 95 < <(vos examine -noauth -id "$m_vname2" -cell "$m_cell" 2>/dev/null) || : 96 err "$l_uid" "wrong_mount ${m_cell} $m_vname = $m_vol (${p_cell#.} $l_uidNumber = $v_vname)" 97 ;; 98 esac 99 fi 100 101 if [ "$ok" = t ]; then 102 err "$l_uid" "ok" 71 103 fi 72 104
Note: See TracChangeset
for help on using the changeset viewer.