added validate_domain checks
This commit is contained in:
parent
5280467700
commit
5ca71ae195
|
@ -9,7 +9,12 @@ source $(dirname $0)/vhost.sh
|
||||||
|
|
||||||
# check for and set virtualhost
|
# check for and set virtualhost
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
virtualhost=$1
|
if vhost::validate_domain $1; then
|
||||||
|
virtualhost=$1
|
||||||
|
else
|
||||||
|
echo "ERROR: $1 is not a valid domain name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "virtualhost not set"
|
echo "virtualhost not set"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -41,7 +41,13 @@ done
|
||||||
if [ ! -n "$virtualhost" ]; then
|
if [ ! -n "$virtualhost" ]; then
|
||||||
echo "virtualhost not set"
|
echo "virtualhost not set"
|
||||||
exit 1
|
exit 1
|
||||||
elif [ -d /srv/www/$virtualhost ] || [ -f /etc/apache2/sites-available/$virtualhost.conf ]; then
|
|
||||||
|
if ! vhost::validate_domain $virtualhost; then
|
||||||
|
echo "ERROR: $virtualhost is not a valid domain name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /srv/www/$virtualhost ] || [ -f /etc/apache2/sites-available/$virtualhost.conf ]; then
|
||||||
echo "virtualhost for $virtualhost already installed"
|
echo "virtualhost for $virtualhost already installed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user