Improved file manager API functions

This commit is contained in:
Serghey Rodin 2015-08-20 18:01:27 +03:00
commit 15d1f4f4c9
13 changed files with 292 additions and 82 deletions

View file

@ -15,20 +15,23 @@ fi
# Checking vesta user
if [ ! -e "$VESTA/data/users/$user" ]; then
exit 1
echo "Error: vesta user $user doesn't exist"
exit 3
fi
# Checking user homedir
homedir=$(grep "^$user:" /etc/passwd | cut -f 6 -d :)
if [ -z $homedir ]; then
exit 1
echo "Error: user home directory doesn't exist"
exit 12
fi
# Checking path
if [ ! -z "$path" ]; then
rpath=$(readlink -f "$path")
if [ -z "$(echo $rpath |grep $homedir)" ]; then
exit 1
echo "Error: invalid path $dst_dir"
exit 2
fi
else
path=$homedir