Fix race condition on /etc/passwd, /etc/shadow and /etc/group

This commit is contained in:
Thibault Ayanides
2020-11-16 14:09:12 +01:00
parent 501ce8c651
commit fbd26ceefa
14 changed files with 21 additions and 17 deletions

View File

@ -126,6 +126,11 @@ _does_pattern_exist_in_file() {
fi
}
get_db() {
local DB="$1"
$SUDO_CMD getent --service files "$DB"
}
# Look for pattern in file that can spread over multiple lines
# The func will remove commented lines (that begin with '#')
# and consider the file as one long line.