Skip to content

Commit d2764a6

Browse files
authored
Missing function: is_format_valid_shell
1 parent df7ccca commit d2764a6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

func/main.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,16 @@ is_password_format_valid() {
805805
check_result $E_INVALID "invalid password format :: $1"
806806
fi
807807
}
808-
808+
# Missing function -
809+
# Before: validate_format_shell
810+
# After: is_format_valid_shell
811+
is_format_valid_shell() {
812+
if [ -z "$(grep -w $1 /etc/shells)" ]; then
813+
echo "Error: shell $1 is not valid"
814+
log_event "$E_INVALID" "$EVENT"
815+
exit $E_INVALID
816+
fi
817+
}
809818
# Format validation controller
810819
is_format_valid() {
811820
for arg_name in $*; do
@@ -872,7 +881,9 @@ is_format_valid() {
872881
restart) is_boolean_format_valid "$arg" 'restart' ;;
873882
rtype) is_dns_type_format_valid "$arg" ;;
874883
rule) is_int_format_valid "$arg" "rule id" ;;
875-
soa) is_domain_format_valid "$arg" 'SOA' ;;
884+
soa) is_domain_format_valid "$arg" 'SOA' ;;
885+
#missing command: is_format_valid_shell
886+
shell) is_format_valid_shell "$arg" ;;
876887
stats_pass) is_password_format_valid "$arg" ;;
877888
stats_user) is_user_format_valid "$arg" "$arg_name" ;;
878889
template) is_object_format_valid "$arg" "$arg_name" ;;

0 commit comments

Comments
 (0)