mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
improved integer validator
This commit is contained in:
parent
01b51dd21d
commit
862012be3f
2 changed files with 18 additions and 18 deletions
|
@ -29,16 +29,16 @@ is_package_new() {
|
||||||
|
|
||||||
is_package_consistent() {
|
is_package_consistent() {
|
||||||
source $pkg_dir/$package.pkg
|
source $pkg_dir/$package.pkg
|
||||||
validate_format_int $WEB_DOMAINS
|
validate_format_int $WEB_DOMAINS 'WEB_DOMAINS'
|
||||||
validate_format_int $WEB_ALIASES
|
validate_format_int $WEB_ALIASES 'WEB_ALIASES'
|
||||||
validate_format_int $DNS_DOMAINS
|
validate_format_int $DNS_DOMAINS 'DNS_DOMAINS'
|
||||||
validate_format_int $DNS_RECORDS
|
validate_format_int $DNS_RECORDS 'DNS_RECORDS'
|
||||||
validate_format_int $MAIL_DOMAINS
|
validate_format_int $MAIL_DOMAINS 'MAIL_DOMAINS'
|
||||||
validate_format_int $MAIL_ACCOUNTS
|
validate_format_int $MAIL_ACCOUNTS 'MAIL_ACCOUNTS'
|
||||||
validate_format_int $DATABASES
|
validate_format_int $DATABASES 'DATABASES'
|
||||||
validate_format_int $CRON_JOBS
|
validate_format_int $CRON_JOBS 'CRON_JOBS'
|
||||||
validate_format_int $DISK_QUOTA
|
validate_format_int $DISK_QUOTA 'DISK_QUOTA'
|
||||||
validate_format_int $BACKUPS
|
validate_format_int $BACKUPS 'BACKUPS'
|
||||||
validate_format_shell $SHELL
|
validate_format_shell $SHELL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
func/main.sh
16
func/main.sh
|
@ -510,7 +510,7 @@ validate_format_password() {
|
||||||
# Integer
|
# Integer
|
||||||
validate_format_int() {
|
validate_format_int() {
|
||||||
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
|
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
|
||||||
echo "Error: int $1 is not valid"
|
echo "Error: $2 $1 is not valid"
|
||||||
log_event "$E_INVALID" "$EVENT"
|
log_event "$E_INVALID" "$EVENT"
|
||||||
exit $E_INVALID
|
exit $E_INVALID
|
||||||
fi
|
fi
|
||||||
|
@ -700,7 +700,7 @@ validate_format_dvalue() {
|
||||||
fi
|
fi
|
||||||
if [ "$rtype" = 'MX' ]; then
|
if [ "$rtype" = 'MX' ]; then
|
||||||
validate_format_domain "$1" 'mx_record'
|
validate_format_domain "$1" 'mx_record'
|
||||||
validate_format_int "$priority"
|
validate_format_int "$priority" 'priority_record'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -760,17 +760,17 @@ validate_format(){
|
||||||
ftp_user) validate_format_username "$arg" "$arg_name" ;;
|
ftp_user) validate_format_username "$arg" "$arg_name" ;;
|
||||||
host) validate_format_domain "$arg" "$arg_name" 'host';;
|
host) validate_format_domain "$arg" "$arg_name" 'host';;
|
||||||
hour) validate_format_mhdmw "$arg" $arg_name ;;
|
hour) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
id) validate_format_int "$arg" ;;
|
id) validate_format_int "$arg" 'id' ;;
|
||||||
interface) validate_format_interface "$arg" ;;
|
interface) validate_format_interface "$arg" ;;
|
||||||
ip) validate_format_ip "$arg" ;;
|
ip) validate_format_ip "$arg" ;;
|
||||||
ip_name) validate_format_domain "$arg" 'domain';;
|
ip_name) validate_format_domain "$arg" 'domain';;
|
||||||
ip_status) validate_format_ip_status "$arg" ;;
|
ip_status) validate_format_ip_status "$arg" ;;
|
||||||
job) validate_format_int "$arg" ;;
|
job) validate_format_int "$arg" 'job' ;;
|
||||||
key) validate_format_username "$arg" "$arg_name" ;;
|
key) validate_format_username "$arg" "$arg_name" ;;
|
||||||
lname) validate_format_name "$arg" "$arg_name" ;;
|
lname) validate_format_name "$arg" "$arg_name" ;;
|
||||||
malias) validate_format_username "$arg" "$arg_name" ;;
|
malias) validate_format_username "$arg" "$arg_name" ;;
|
||||||
mask) validate_format_ip "$arg" ;;
|
mask) validate_format_ip "$arg" ;;
|
||||||
max_db) validate_format_int "$arg" ;;
|
max_db) validate_format_int "$arg" 'max db';;
|
||||||
min) validate_format_mhdmw "$arg" $arg_name ;;
|
min) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
month) validate_format_mhdmw "$arg" $arg_name ;;
|
month) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
nat_ip) validate_format_ip "$arg" ;;
|
nat_ip) validate_format_ip "$arg" ;;
|
||||||
|
@ -780,8 +780,8 @@ validate_format(){
|
||||||
ns4) validate_format_domain "$arg" 'name_server';;
|
ns4) validate_format_domain "$arg" 'name_server';;
|
||||||
package) validate_format_name "$arg" "$arg_name" ;;
|
package) validate_format_name "$arg" "$arg_name" ;;
|
||||||
password) validate_format_password "$arg" ;;
|
password) validate_format_password "$arg" ;;
|
||||||
port) validate_format_int "$arg" ;;
|
port) validate_format_int "$arg" 'port' ;;
|
||||||
quota) validate_format_int "$arg" ;;
|
quota) validate_format_int "$arg" 'quota' ;;
|
||||||
restart) validate_format_boolean "$arg" 'restart' ;;
|
restart) validate_format_boolean "$arg" 'restart' ;;
|
||||||
record) validate_format_common "$arg" 'record';;
|
record) validate_format_common "$arg" 'record';;
|
||||||
rtype) validate_format_dns_type "$arg" ;;
|
rtype) validate_format_dns_type "$arg" ;;
|
||||||
|
@ -790,7 +790,7 @@ validate_format(){
|
||||||
stats_pass) validate_format_password "$arg" ;;
|
stats_pass) validate_format_password "$arg" ;;
|
||||||
stats_user) validate_format_username "$arg" "$arg_name" ;;
|
stats_user) validate_format_username "$arg" "$arg_name" ;;
|
||||||
template) validate_format_name "$arg" "$arg_name" ;;
|
template) validate_format_name "$arg" "$arg_name" ;;
|
||||||
ttl) validate_format_int "$arg" ;;
|
ttl) validate_format_int "$arg" 'ttl';;
|
||||||
user) validate_format_username "$arg" "$arg_name" ;;
|
user) validate_format_username "$arg" "$arg_name" ;;
|
||||||
wday) validate_format_mhdmw "$arg" $arg_name ;;
|
wday) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue