Skip to content

Commit f8bf9b6

Browse files
authored
fix: prevent empty user variable from affecting multiple scripts (Fixes hestiacp#4926) (hestiacp#4928)
1 parent cd31ea8 commit f8bf9b6

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

bin/v-list-access-keys

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
#!/bin/bash
22
# info: list all API access keys
3-
# options: [FORMAT]
3+
# options: [USER] [FORMAT]
44
#
55
# example: v-list-access-keys json
66

77
#----------------------------------------------------------#
88
# Variables & Functions #
99
#----------------------------------------------------------#
1010

11-
# Argument definition
12-
user="$1"
13-
format="${2:-shell}"
14-
1511
# Includes
1612
# shellcheck source=/etc/hestiacp/hestia.conf
1713
source /etc/hestiacp/hestia.conf
@@ -20,6 +16,10 @@ source $HESTIA/func/main.sh
2016
# load config file
2117
source_conf "$HESTIA/conf/hestia.conf"
2218

19+
# Argument definition
20+
user="$1"
21+
format="${2:-shell}"
22+
2323
# JSON list function
2424
json_list() {
2525
echo -n '{'

bin/v-update-user-counters

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: update user usage counters
3-
# options: USER
3+
# options: [USER]
44
#
55
# example: v-update-user-counters admin
66
#
@@ -10,9 +10,6 @@
1010
# Variables & Functions #
1111
#----------------------------------------------------------#
1212

13-
# Argument definition
14-
user=$1
15-
1613
# Includes
1714
# shellcheck source=/etc/hestiacp/hestia.conf
1815
source /etc/hestiacp/hestia.conf
@@ -21,11 +18,14 @@ source $HESTIA/func/main.sh
2118
# load config file
2219
source_conf "$HESTIA/conf/hestia.conf"
2320

21+
# Argument definition
22+
user=$1
23+
2424
#----------------------------------------------------------#
2525
# Verifications #
2626
#----------------------------------------------------------#
2727

28-
check_args '0' "$#" 'USER'
28+
check_args '0' "$#" '[USER]'
2929
if [ -n "$user" ]; then
3030
is_format_valid 'user'
3131
is_object_valid 'user' 'USER' "$user"

bin/v-update-user-stats

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# info: update user statistics
3-
# options: USER
3+
# options: [USER]
44
#
55
# example: v-update-user-stats admin
66
#
@@ -10,9 +10,6 @@
1010
# Variables & Functions #
1111
#----------------------------------------------------------#
1212

13-
# Argument definition
14-
user=$1
15-
1613
# Importing system environment as we run this script
1714
# mostly by cron wich not read it by itself
1815
source /etc/profile.d/hestia.sh
@@ -27,11 +24,14 @@ source $HESTIA/func/domain.sh
2724
# load config file
2825
source_conf "$HESTIA/conf/hestia.conf"
2926

27+
# Argument definition
28+
user=$1
29+
3030
#----------------------------------------------------------#
3131
# Verifications #
3232
#----------------------------------------------------------#
3333

34-
check_args '0' "$#" 'USER'
34+
check_args '0' "$#" '[USER]'
3535
if [ ! -z "$user" ]; then
3636
is_format_valid 'user'
3737
is_object_valid 'user' 'USER' "$user"

0 commit comments

Comments
 (0)