Skip to content

Commit 6628a9b

Browse files
committed
change shell - improved verification
1 parent bc18642 commit 6628a9b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

bin/v_change_user_shell

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,21 @@ is_user_suspended
4040
# Action #
4141
#----------------------------------------------------------#
4242

43-
# Changing user shell
44-
update_user_value "$user" '$SHELL' "$shell"
45-
4643
# Get shell full path
4744
shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
4845

4946
# Changing passwd file
5047
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
5148

5249

50+
5351
#----------------------------------------------------------#
5452
# Vesta #
5553
#----------------------------------------------------------#
5654

55+
# Changing user shell
56+
update_user_value "$user" '$SHELL' "$shell"
57+
5758
# Logging
5859
log_event 'system' "$V_EVENT"
5960

func/shared.func

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ format_validation() {
6161

6262
# Checking shell
6363
check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" )
64-
if [ -z "$check_shell" ]; then
64+
if [ -z "$1"] || [ -z "$check_shell" ]; then
6565
echo "Error: shell not found"
66-
log_event 'debug' "$E_INVALID $V_EVENT"
67-
exit $E_INVALID
66+
log_event 'debug' "$E_NOTEXIST $V_EVENT"
67+
exit $E_NOTEXIST
6868
fi
6969
}
7070

0 commit comments

Comments
 (0)