fix getent parsing when fields are emtpy

fix #365
This commit is contained in:
Jaromil 2019-09-14 12:06:13 +02:00
parent ca708b4d46
commit 15d279605b

4
tomb
View File

@ -1005,8 +1005,8 @@ _gpg_uid() {
awk 'BEGIN { FS=":" } /^uid/ { print $10; exit}' }
# helpers to retrieve data from passwd using getent
_get_username() { print ${"$(getent passwd ${1})"[(ws@:@)1]} }
_get_home() { print ${"$(getent passwd ${1})"[(ws@:@)6]} }
_get_username() { getent passwd ${1} | awk -F: '{print $1}' }
_get_home() { getent passwd ${1} | awk -F: '{print $6}' }
# $1 is the encrypted key contents we are checking
is_valid_key() {