File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ is_object_valid 'user' 'USER' "$user"
4242is_object_valid ' mail' ' DOMAIN' " $domain "
4343is_object_valid " mail/$domain " ' ACCOUNT' " $account "
4444aliases=$( get_object_value " mail/$domain " ' ACCOUNT' " $account " ' $ALIAS' )
45- if [ -z " $( echo $aliases | grep -w $malias ) " ]; then
45+ if [ -z " $( echo $aliases | grep -w -e $malias ) " ]; then
4646 echo " Error: alias $malias doesn't exist"
4747 log_event " $E_NOTEXIST $ARGUMENTS "
4848 exit " $E_NOTEXIST "
Original file line number Diff line number Diff line change @@ -707,17 +707,19 @@ sync_cron_jobs() {
707707# Validates Local part email and mail alias
708708is_localpart_format_valid () {
709709 if [ ${# 1} -eq 1 ]; then
710- if ! [[ " $1 " =~ ^^ [[:alnum:]]$ ]]; then
710+ if ! [[ " $1 " =~ ^[[:alnum:]]$ ]]; then
711711 check_result " $E_INVALID " " invalid $2 format :: $1 "
712712 fi
713713 else
714714 if [ -n " $3 " ]; then
715715 maxlenght=$(( $3 - 2 ))
716- if ! [[ " $1 " =~ ^[[:alnum:]][-| \. | _[:alnum:]]{0,$maxlenght }[[:alnum:]]$ ]]; then
716+ # Allow leading and trailing special characters by adjusting the regex
717+ if ! [[ " $1 " =~ ^[[:alnum:]_.-][[:alnum:]_.-]{0,$maxlenght }[[:alnum:]_.-]$ ]]; then
717718 check_result " $E_INVALID " " invalid $2 format :: $1 "
718719 fi
719720 else
720- if ! [[ " $1 " =~ ^[[:alnum:]][-| \. | _[:alnum:]]{0,28}[[:alnum:]]$ ]]; then
721+ # Allow leading and trailing special characters by adjusting the regex
722+ if ! [[ " $1 " =~ ^[[:alnum:]_.-][[:alnum:]_.-]{0,28}[[:alnum:]_.-]$ ]]; then
721723 check_result " $E_INVALID " " invalid $2 format :: $1 "
722724 fi
723725 fi
You can’t perform that action at this time.
0 commit comments