fix to username parsing in passwd

now using getent, light edit of hellekin's fix in #198
This commit is contained in:
Jaromil 2015-07-23 15:18:13 +02:00
parent b752980939
commit b07224beab

15
tomb
View File

@ -1828,10 +1828,10 @@ mount_tomb() {
tombhost=$(_cat ${tombmount}/.host)
tomblast=$(_cat ${tombmount}/.last)
tombuid=$(_cat ${tombmount}/.uid | tr -d ' ')
for e in ${(f@)mapfile[/etc/passwd]}; do
[[ "$e" =~ ":$tombuid:" ]] && {
tombuser="${e[(ws@:@)1]}" }
done
tombuser=$(getent passwd $tombuid)
tombuser=${tombuser[(ws@:@)1]}
_message "Last visit by ::1 user::(::2 tomb build::) from ::3 tty:: on ::4 host::" $tombuser $tombuid $tombtty $tombhost
_message "on date ::1 date::" "`date --date=@${tomblast} +%c`"
}
@ -1993,10 +1993,9 @@ awk "/mapper/"' { print $2 ";" $3 ";" $4 ";" $5 }'`
tombtty=$(_cat ${tombmount}/.tty)
tombhost=$(_cat ${tombmount}/.host)
tombuid=$(_cat ${tombmount}/.uid | tr -d ' ')
for ee in ${(f@)mapfile[/etc/passwd]}; do
[[ "$ee" =~ ":${tombuid}:" ]] && {
tombuser="${ee[(ws@:@)1]}" }
done
tombuser=$(getent passwd $tombuid)
tombuser=${tombuser[(ws@:@)1]}
}
{ option_is_set --get-mountpoint } && { print $tombmount; continue }