Skip to content

Commit 146519a

Browse files
committed
Fix hestiacp#1767 Limit Web aliases
1 parent c06af6f commit 146519a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

bin/v-add-web-domain

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ check_args '2' "$#" 'USER DOMAIN [IP] [RESTART] [ALIASES] [PROXY_EXTENSIONS]'
5252
is_format_valid 'user' 'domain' 'aliases' 'ip' 'proxy_ext'
5353
is_object_valid 'user' 'USER' "$user"
5454
is_object_unsuspended 'user' 'USER' "$user"
55-
is_package_full 'WEB_DOMAINS' 'WEB_ALIASES'
55+
# Make the new aliases are also counted for when creating a new domain.
56+
ALIAS=$aliases
57+
is_package_full 'WEB_DOMAINS'
58+
is_package_full 'WEB_ALIASES'
5659

5760
if [ "$($BIN/v-list-web-domain $user $domain_utf plain |cut -f 1) " != "$domain" ]; then
5861
is_domain_new 'web' "$domain_utf,$aliases"

bin/v-add-web-domain-alias

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ format_aliases
4141
# Verifications #
4242
#----------------------------------------------------------#
4343

44+
# Parsing domain values as they are used to get the current alias usage
45+
get_domain_values 'web'
46+
4447
if [ -z "$aliases" ]; then
4548
check_result $E_INVALID "invalid alias format: empty"
4649
fi
@@ -65,9 +68,6 @@ check_hestia_demo_mode
6568
# Action #
6669
#----------------------------------------------------------#
6770

68-
# Parsing domain values
69-
get_domain_values 'web'
70-
7171
# Preparing domain values for the template substitution
7272
local_ip=$(get_real_ip $IP)
7373
if [ -z "$ALIAS" ]; then

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ is_system_enabled() {
169169
is_package_full() {
170170
case "$1" in
171171
WEB_DOMAINS) used=$(wc -l $USER_DATA/web.conf);;
172-
WEB_ALIASES) used=$(echo $aliases |tr ',' '\n' |wc -l);;
172+
WEB_ALIASES) used=$(echo $ALIAS |tr ',' '\n' | wc -l );;
173173
DNS_DOMAINS) used=$(wc -l $USER_DATA/dns.conf);;
174174
DNS_RECORDS) used=$(wc -l $USER_DATA/dns/$domain.conf);;
175175
MAIL_DOMAINS) used=$(wc -l $USER_DATA/mail.conf);;

0 commit comments

Comments
 (0)