samba: use readlink -f before forcing the /mnt/ prefix

When checknig that path starts with /mnt/, path should not include
	softlinks, "." or "..". This prevents the obvoius case of sharing the
	"/mnt/../" path, which will jump out of the restricted /mnt/.
This commit is contained in:
Alex Oprea 2016-08-04 16:02:59 +02:00
parent 203e252bae
commit 4e8f08aa8b

View file

@ -128,6 +128,7 @@ smb_add_share() {
[ -z "$name" -o -z "$path" ] && return
path="$path/$dirpath"
path=$(readlink -f $path)
# restrict the shared paths to always be under /mnt/ tree
[ "${path:0:4}" == "/mnt" ] || path="/mnt/"$path