commit b07224beab58a1dc94dfa410bde5eafafed53a52
parent b752980939a34d25dc2bb10b6f974c99145051c0
Author: Jaromil <jaromil@dyne.org>
Date: Thu, 23 Jul 2015 15:18:13 +0200
fix to username parsing in passwd
now using getent, light edit of hellekin's fix in #198
Diffstat:
M | tomb | | | 15 | +++++++-------- |
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git 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 }