@@ -32,7 +32,7 @@ Where: refresh_token - Is a refresh token used to obtain an access token needed
3232 aws_region - is the AWS region where the FSx file systems are located
3333 filesystem_id - is the AWS file system ID of the FSx file system where the volume resides
3434 volume_ID - is the AWS volume ID of the volume where you want to create the cifs share.
35- cifs_share_name - is the name of the share to create
35+ cifs_share_name - is the name of the share to create. Only alphanumeric characters, underscores and dashes are allowed.
3636
3737Instead of passing parameters on the command line, you can set the
3838following environment variables:
8484#
8585# Declare an array of required options and the error message to display if they are not set.
8686declare -A required_options
87- required_options[" REFRESH_TOKEN" ]=' Error: A BlueXP refresh tokon is required to run this script. It can be obtain from this web page:
87+ required_options[" REFRESH_TOKEN" ]=' Error: A BlueXP refresh token is required to run this script. It can be obtain from this web page:
8888 https://services.cloud.netapp.com/refresh-token\n\n'
8989required_options[" BLUEXP_ACCOUNT_ID" ]=' Error: A BlueXP account ID is required to run this script.
9090You can get the list of accounts you have access to by running the "list_bluexp_accts" script
9191found in this GitHub repository: https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/Management-Utilities/Workload-Factory-API-Samples\n\n'
92- required_options[" CREDENTIALS_ID" ]=' Error: The ID of the credentials to delete is required .
92+ required_options[" CREDENTIALS_ID" ]=' Error: A Worload Factory Credential ID is required to run this script .
9393You can get a list of credentials by running the "list_credentials" script
9494found in this GitHub repository: https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/Management-Utilities/Workload-Factory-API-Samples\n\n'
9595required_options[" AWS_REGION" ]=' Error: The AWS region where the file system is located is required.\n\n'
@@ -120,6 +120,11 @@ run_curl GET "$token" "https://api.workloads.netapp.com/accounts/${BLUEXP_ACCOUN
120120cifsShares=$( jq -r ' .cifsShares' $tmpout )
121121#
122122# Create a new share definition.
123+ # Check that the CIFS_SHARE_NAME only contains allowed characters (alphanumeric, underscores and dashes).
124+ if [[ ! " $CIFS_SHARE_NAME " =~ ^[a-zA-Z0-9_-]+$ ]]; then
125+ echo " Error: The CIFS share name can only contain alphanumeric characters, underscores and dashes." >&2
126+ exit 1
127+ fi
123128newShare=' {"name":"' $CIFS_SHARE_NAME ' ","path":"' /$CIFS_SHARE_NAME ' ","acls":[{"userOrGroup":"Everyone","permission":"full_control","type":"windows"}]}'
124129#
125130# Add the new share to the existing ones.
0 commit comments