OGLE-TR-123 Pre-Release

This commit is contained in:
naumov-socolov 2012-01-17 01:01:38 +03:00
commit fd52d9819c
6 changed files with 78 additions and 12 deletions

View file

@ -23,7 +23,7 @@ db_password=$4
type=$5
host=$6
encoding=${7-UTF8}
encoding=$(echo "$encoding" |tr '[:lower:]' '[:upper:]')
# Importing variables
source $VESTA/conf/vars.conf
source $V_CONF/vesta.conf
@ -89,11 +89,12 @@ increase_user_value "$user" '$U_DATABASES'
# Adding db to db conf
v_str="DB='$database' USER='$db_user' HOST='$host' TYPE='$type'"
v_str="$v_str U_DISK='0' SUSPEND='no' DATE='$V_DATE'"
v_str="$v_str CHARSET='$encoding' U_DISK='0' SUSPEND='no' DATE='$V_DATE'"
echo "$v_str">>$V_USERS/$user/db.conf
# Hiding password
V_EVENT="$V_DATE $V_SCRIPT $user $database $db_user ***** $type $host"
V_EVENT="$V_EVENT $encoding"
# Logging
log_history "$V_EVENT" "v_delete_db_base $user $database"

View file

@ -19,7 +19,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
ip=$3
template=${4-default}
next_year=$(date +F -d "+ 1 year")
next_year=$(date +%F -d "+ 1 year")
exp=${5-$next_year}
soa=$6
ttl=${7-14400}

View file

@ -40,9 +40,6 @@ is_user_suspended
# Action #
#----------------------------------------------------------#
# Changing user shell
update_user_value "$user" '$SHELL' "$shell"
# Get shell full path
shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
@ -50,10 +47,14 @@ shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Changing user shell
update_user_value "$user" '$SHELL' "$shell"
# Logging
log_event 'system' "$V_EVENT"

View file

@ -107,7 +107,7 @@ is_db_valid
conf=$V_USERS/$user/db.conf
# Defining fileds to select
fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPEND $DATE'
# Listing database
case $format in

View file

@ -40,13 +40,14 @@ is_user_valid
conf=$V_USERS/$user/db.conf
# Defining fileds to select
fields='$DB $USER $HOST $TYPE $U_DISK $SUSPEND $DATE'
fields='$DB $USER $HOST $TYPE $CHARSET $U_DISK $SUSPEND $DATE'
# Listing databases
case $format in
json) json_list ;;
plain) nohead=1; shell_list ;;
shell) shell_list | column -t ;;
shell) fields='$DB $USER $HOST $TYPE $U_DISK $DATE';
shell_list | column -t ;;
*) check_args '1' '0' 'user [format]'
esac

View file

@ -61,10 +61,10 @@ format_validation() {
# Checking shell
check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" )
if [ -z "$check_shell" ]; then
if [ -z "$1"] || [ -z "$check_shell" ]; then
echo "Error: shell not found"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
log_event 'debug' "$E_NOTEXIST $V_EVENT"
exit $E_NOTEXIST
fi
}
@ -263,6 +263,64 @@ format_validation() {
fi
}
# Define minute/hour/day/month validator
format_mhd() {
val="$1"
digit=$val
limit=60
if [ "$var" = 'day' ]; then
limit=31
fi
if [ "$var" = 'month' ]; then
limit=12
fi
if [ "$var" = 'wday' ]; then
limit=7
fi
letters=$(echo "$val"|grep -c "[a-Z]")
lslash=$(echo "$val"| grep "^/")
if [ -z "$val" ] || [ 0 -ne "$letters" ] || [ -n "$lslash" ]; then
echo "Error: $var is out of range"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
fi
special_chars=$(echo "$val" | \
grep -c "[!|@|#|$|^|&|(|)|+|=|{|}|:|,|.|<|>|?|\|\"|'|;|%| ]" )
if [[ 0 -ne "$special_chars" ]] || [ 5 -le ${#val} ]; then
echo "Error: $var is out of range"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
fi
star=$(echo "$val" |grep '*')
if [ ! -z "$star" ]; then
slash=$(echo $val |grep "^*/")
if [ "$val" != '*' ] && [ -z "$slash" ]; then
echo "Error: $var is out of range"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
else
if [ -n "$slash" ]; then
digit=$(echo $val | cut -f 2 -d / )
fi
if [ "$val" = '*' ]; then
digit=0
fi
fi
fi
if [ "$limit" -lt "$digit" ]; then
echo "Error: $var is out of range"
log_event 'debug' "$E_INVALID $V_EVENT"
exit $E_INVALID
fi
}
# Defining format_ext function
format_ext() {
val="$1"
@ -313,6 +371,7 @@ format_validation() {
ssl) format_usr "$v" ;;
domain) format_dom "$v" ;;
database) format_db "$v" ;;
day) format_mhd "$v" ;;
db_user) format_dbu "$v" ;;
dvalue) format_dvl "$v" ;;
fname) format_usr "$v" ;;
@ -328,6 +387,7 @@ format_validation() {
ns8) format_dom "$v" ;;
email) format_eml "$v" ;;
extentions) format_ext "$v" ;;
hour) format_mhd "$v" ;;
host) format_usr "$v" ;;
interface) format_ifc "$v" ;;
ip) format_ip "$v" ;;
@ -337,6 +397,8 @@ format_validation() {
mask) format_ip "$v" ;;
max_usr) format_int "$v" ;;
max_db) format_int "$v" ;;
min) format_mhd "$v" ;;
month) format_mhd "$v" ;;
lname) format_usr "$v" ;;
owner) format_usr "$v" ;;
package) format_usr "$v" ;;
@ -349,6 +411,7 @@ format_validation() {
template) format_usr "$v" ;;
ttl) format_int "$v" ;;
user) format_usr "$v" ;;
wday) format_mhd "$v" ;;
esac
done
}