diff --git a/cdist/conf/type/__user/explorer/shadow b/cdist/conf/type/__user/explorer/shadow index 63d38f0d..32496ee7 100755 --- a/cdist/conf/type/__user/explorer/shadow +++ b/cdist/conf/type/__user/explorer/shadow @@ -23,18 +23,25 @@ name=$__object_id -case $("$__explorer/os") in - 'freebsd'|'netbsd'|'openbsd'|'alpine') +case $("${__explorer}/os") in + freebsd|netbsd) database='passwd' ;; - # Default to using shadow passwords + openbsd) + database='master.passwd' + ;; *) + # Default to using shadow passwords database='shadow' ;; esac -if command -v getent >/dev/null; then - getent "$database" "$name" || true -elif [ -f /etc/shadow ]; then - grep "^${name}:" /etc/shadow || true +if command -v getent >/dev/null 2>&1 +then + # shellcheck disable=SC2015 + getent "${database}" "${name}" 2>/dev/null && exit || true # fallback to file +fi +if test -n "${database}" -a -f "/etc/${database}" +then + grep -e "^${name}:" "/etc/${database}" || true # ignore failure fi