Skip to content

Commit

Permalink
quote aws s3 bucket name and object; quote smbclient url
Browse files Browse the repository at this point in the history
  • Loading branch information
deitch committed May 23, 2017
1 parent 29fa354 commit dfd09d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ if [[ -n "$DB_RESTORE_TARGET" ]]; then
if [[ "${uri[schema]}" == "file" ]]; then
cp $DB_RESTORE_TARGET $TMPRESTORE 2>/dev/null
elif [[ "${uri[schema]}" == "s3" ]]; then
aws s3 cp $DB_RESTORE_TARGET $TMPRESTORE
aws s3 cp "$DB_RESTORE_TARGET" $TMPRESTORE
elif [[ "${uri[schema]}" == "smb" ]]; then
if [[ -n "${uri[user]}" ]]; then
UPASSARG="-U"
Expand All @@ -103,7 +103,7 @@ if [[ -n "$DB_RESTORE_TARGET" ]]; then
else
UDOM=
fi
smbclient -N //${uri[host]}/${uri[share]} ${UPASSARG} "${UPASS}" ${UDOM} -c "get ${uri[sharepath]} ${TMPRESTORE}"
smbclient -N "//${uri[host]}/${uri[share]}" ${UPASSARG} "${UPASS}" ${UDOM} -c "get ${uri[sharepath]} ${TMPRESTORE}"
fi
# did we get a file?
if [[ -f "$TMPRESTORE" ]]; then
Expand Down Expand Up @@ -166,7 +166,7 @@ else
"s3")
# allow for endpoint url override
[[ -n "$AWS_ENDPOINT_URL" ]] && AWS_ENDPOINT_OPT="--endpoint-url $AWS_ENDPOINT_URL"
aws ${AWS_ENDPOINT_OPT} s3 cp ${TMPDIR}/${TARGET} ${DB_DUMP_TARGET}/${TARGET}
aws ${AWS_ENDPOINT_OPT} s3 cp ${TMPDIR}/${TARGET} "${DB_DUMP_TARGET}/${TARGET}"
/bin/rm ${TMPDIR}/${TARGET}
;;
"smb")
Expand All @@ -183,7 +183,7 @@ else
UDOM=
fi

smbclient -N //${uri[host]}/${uri[share]} ${UPASSARG} "${UPASS}" ${UDOM} -c "cd ${uri[sharepath]}; put ${TMPDIR}/${TARGET} ${TARGET}"
smbclient -N "//${uri[host]}/${uri[share]}" ${UPASSARG} "${UPASS}" ${UDOM} -c "cd ${uri[sharepath]}; put ${TMPDIR}/${TARGET} ${TARGET}"
/bin/rm ${TMPDIR}/${TARGET}
;;
esac
Expand Down

0 comments on commit dfd09d0

Please sign in to comment.