Fix reading empty lines
I'm pretty sure shadow(5) guarantees this won't happen but best to be safe
This commit is contained in:
parent
254f8bd3d9
commit
b7e10dccb9
@ -43,6 +43,9 @@ for file in /etc/shadow /etc/gshadow; do
|
|||||||
echo "Parsing $file for junk"
|
echo "Parsing $file for junk"
|
||||||
# Read each line in the file to iterate over it
|
# Read each line in the file to iterate over it
|
||||||
while read line; do
|
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
|
# 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
|
# first colon are the user's/group's name. To that end, we'll do a bash
|
||||||
# string substitution to extract that first column.
|
# string substitution to extract that first column.
|
||||||
|
Loading…
Reference in New Issue
Block a user