From b07224beab58a1dc94dfa410bde5eafafed53a52 Mon Sep 17 00:00:00 2001 From: Jaromil Date: Thu, 23 Jul 2015 15:18:13 +0200 Subject: [PATCH] fix to username parsing in passwd now using getent, light edit of hellekin's fix in #198 --- tomb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tomb b/tomb index a84f938..47283a3 100755 --- a/tomb +++ b/tomb @@ -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 }