Add double quotes to prevent globbing/word splitting, general code consistency improvements

This commit is contained in:
Jose
2020-02-20 18:06:31 -04:00
parent 9481b6a1e6
commit 01eaccc1da
22 changed files with 312 additions and 318 deletions

View File

@@ -58,11 +58,11 @@ if [ "${TARGET}" != 'ALL' ]; then
fi
validate_user() {
if jexec -l ${_jail} id "${USER}" >/dev/null 2>&1; then
USER_SHELL="$(jexec -l ${_jail} getent passwd "${USER}" | cut -d: -f7)"
if jexec -l "${_jail}" id "${USER}" >/dev/null 2>&1; then
USER_SHELL="$(jexec -l "${_jail}" getent passwd "${USER}" | cut -d: -f7)"
if [ -n "${USER_SHELL}" ]; then
if jexec -l ${_jail} grep -qwF "${USER_SHELL}" /etc/shells; then
jexec -l ${_jail} /usr/bin/login -f "${USER}"
if jexec -l "${_jail}" grep -qwF "${USER_SHELL}" /etc/shells; then
jexec -l "${_jail}" /usr/bin/login -f "${USER}"
else
echo "Invalid shell for user ${USER}"
fi
@@ -76,10 +76,10 @@ validate_user() {
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
if [ ! -z "${USER}" ]; then
if [ -n "${USER}" ]; then
validate_user
else
jexec -l ${_jail} /usr/bin/login -f root
jexec -l "${_jail}" /usr/bin/login -f root
fi
echo
done