Skip to content

Commit

Permalink
Ban single quote character from password. Warn about illegal characte…
Browse files Browse the repository at this point in the history
…rs in password
  • Loading branch information
Alexei Chekulaev committed May 26, 2017
1 parent ba216b9 commit be3d84d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 10 additions & 1 deletion 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'
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions docs/troubleshooting-smb.md
Expand Up @@ -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:
Expand Down

0 comments on commit be3d84d

Please sign in to comment.