change shell - improved verification

This commit is contained in:
Serghey Rodin 2012-01-16 13:34:23 +02:00
commit 6628a9b3af
2 changed files with 7 additions and 6 deletions

View file

@ -40,9 +40,6 @@ is_user_suspended
# Action #
#----------------------------------------------------------#
# Changing user shell
update_user_value "$user" '$SHELL' "$shell"
# Get shell full path
shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
@ -50,10 +47,14 @@ shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Changing user shell
update_user_value "$user" '$SHELL' "$shell"
# Logging
log_event 'system' "$V_EVENT"

View file

@ -61,10 +61,10 @@ format_validation() {
# Checking shell
check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" )
if [ -z "$check_shell" ]; then
if [ -z "$1"] || [ -z "$check_shell" ]; then
echo "Error: shell not found"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
log_event 'debug' "$E_NOTEXIST $V_EVENT"
exit $E_NOTEXIST
fi
}