fix: check node name, regular expression

This commit is contained in:
DDDHuang 2022-05-19 09:52:00 +08:00
parent 3524fb6994
commit 809c0bede7
1 changed files with 5 additions and 0 deletions

View File

@ -690,6 +690,11 @@ esac
SHORT_NAME="$(echo "$NAME" | awk -F'@' '{print $1}')"
export ESCRIPT_NAME="$SHORT_NAME"
if ! (echo "$SHORT_NAME" | grep -q '^[0-9A-Za-z_\-]\+$'); then
echo "Invalid node name, should be of format '^[0-9A-Za-z_-]+$'."
exit 1
fi
PIPE_DIR="${PIPE_DIR:-/$DATA_DIR/${WHOAMI}_erl_pipes/$NAME/}"
## make EMQX_NODE_COOKIE right