Compare commits

...

2 Commits

Author SHA1 Message Date
1dee476771 Provide exit code on explicit exit 2024-12-01 23:19:19 -06:00
b7e10dccb9 Fix reading empty lines
I'm pretty sure shadow(5) guarantees this won't happen but best to be safe
2024-12-01 23:18:55 -06:00

View File

@@ -43,6 +43,9 @@ for file in /etc/shadow /etc/gshadow; do
echo "Parsing $file for junk"
# Read each line in the file to iterate over it
while read line; do
# This should never happen, but if for some reason we get an empty line,
# continue
[ -z "$line" ] && continue
# Per shadow(5), we are guaranteed that all characters leading up to the
# first colon are the user's/group's name. To that end, we'll do a bash
# string substitution to extract that first column.
@@ -59,7 +62,7 @@ for file in /etc/shadow /etc/gshadow; do
;;
*)
echo "Unknown file to parse for junk: $file"
exit
exit 101
;;
esac
# Now, we use getent to find a match for the shadow entry. It's at this point