diff --git a/bin/fin b/bin/fin index 779d39d60..3895cbfe1 100755 --- a/bin/fin +++ b/bin/fin @@ -1,6 +1,6 @@ #!/usr/bin/env bash -FIN_VERSION=1.9.3 +FIN_VERSION=1.9.4 # Console colors red='\033[0;91m' @@ -1768,6 +1768,8 @@ smb_share_mount() local share_name=$1 local mount_point=$2 local password=$3 + # single quotes are banned from being used in password + password=${password//\'/} network_id=$("$vboxmanage" showvminfo ${DOCKER_MACHINE_NAME} --machinereadable | grep hostonlyadapter | cut -d'"' -f2) DOCKER_HOST_IP=$("$vboxmanage" list hostonlyifs | grep "${network_id}$" -A 3 | grep IPAddress |cut -d ':' -f2 | xargs) @@ -1811,6 +1813,13 @@ docker_machine_mount_smb () read -s -p "Enter your Windows account password: " password echo # Add a new line after user input. + if ([[ "$password" =~ \' ]] || [[ "$password" =~ , ]] || [[ "$password" =~ \\ ]]); then + echo-error "Password contains illegal characters" \ + "Your password contains a single quote ('), a comma (,) or a back slash (\\)" \ + "Please change you password and run ${yellow}fin vm restart${NC}" + return 1 + fi + for drive in ${drives}; do local mount_point=$(cygpath -u "$drive" | sed 's/^\/cygdrive\///') # Avoid conflicts with existing drive shares buy using a unique share name diff --git a/docs/troubleshooting-smb.md b/docs/troubleshooting-smb.md index 5d7e1414a..2697d4a17 100644 --- a/docs/troubleshooting-smb.md +++ b/docs/troubleshooting-smb.md @@ -145,9 +145,10 @@ it not password or policies, then see step 6. Check that you use the correct password. For Microsoft Account use Microsoft Account password not the one you use to unlock your PC. -Also note, that the password is being passed over to the console mount command. In some rare -cases some crazy password with special symbols can break it. While we try to eliminate edge cases -they still might happen. +Also note, that the password is being passed over to the console mount command. So there are +some limitations that apply. + +**Your password can NOT contain:** `,` (comma), `\` (back slash) or `'` (single quote) symbol. In case mount command got broken because of we failed to scape some symbol the console output will look like this: