Subversion Repositories ALCASAR

Rev

Rev 2501 | Rev 2712 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2501 Rev 2505
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-condown.sh 2501 2018-02-28 00:34:14Z tom.houdayer $
3
# $Id: alcasar-condown.sh 2505 2018-03-11 13:41:00Z tom.houdayer $
4
#
4
#
5
# alcasar-condown.sh
5
# alcasar-condown.sh
6
# by Rexy
6
# by Rexy
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
8
 
8
 
Line 15... Line 15...
15
	exit 1
15
	exit 1
16
fi
16
fi
17
 
17
 
18
# Remove user from his IPSET
18
# Remove user from his IPSET
19
 
19
 
20
db_query="SELECT attribute, value FROM (( SELECT attribute, value FROM radreply WHERE (attribute='Alcasar-Filter' OR attribute='Alcasar-Filter-Proto' OR attribute='Alcasar-Status-Open-Required') AND username='$USER_NAME') UNION ( SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE (attribute='Alcasar-Filter' OR attribute='Alcasar-Filter-Proto' OR attribute='Alcasar-Status-Open-Required') AND username = '$USER_NAME' ORDER BY ug.priority)) attrs GROUP BY attribute;"
20
db_query="SELECT attribute, value FROM (( SELECT attribute, value FROM radreply WHERE (attribute='Alcasar-Filter' OR attribute='Alcasar-Protocols-Filter' OR attribute='Alcasar-Status-Page-Must-Stay-Open') AND username='$USER_NAME') UNION ( SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE (attribute='Alcasar-Filter' OR attribute='Alcasar-Protocols-Filter' OR attribute='Alcasar-Status-Page-Must-Stay-Open') AND username = '$USER_NAME' ORDER BY ug.priority)) attrs GROUP BY attribute;"
21
db_res=$(mysql -u root -p$(cat $PASSWD_FILE | grep ^db_root= | cut -d'=' -f2-) -D radius -e "$db_query" -Ns)
21
db_res=$(mysql -u root -p$(cat $PASSWD_FILE | grep ^db_root= | cut -d'=' -f2-) -D radius -e "$db_query" -Ns)
22
 
22
 
23
filter=$(echo "$db_res"             | awk '$1 == "Alcasar-Filter"               { print $2 }')
23
filter=$(echo "$db_res"             | awk '$1 == "Alcasar-Filter"               { print $2 }')
24
filterProto=$(echo "$db_res"        | awk '$1 == "Alcasar-Filter-Proto"         { print $2 }')
24
filterProto=$(echo "$db_res"        | awk '$1 == "Alcasar-Protocols-Filter"         { print $2 }')
25
statusOpenRequired=$(echo "$db_res" | awk '$1 == "Alcasar-Status-Open-Required" { print $2 }')
25
statusOpenRequired=$(echo "$db_res" | awk '$1 == "Alcasar-Status-Page-Must-Stay-Open" { print $2 }')
26
 
26
 
27
if [ "$filter" == '4' ]; then	# HAVP_WL
27
if [ "$filter" == '4' ]; then	# HAVP_WL
28
	set_filter="havp_wl"
28
	set_filter="havp_wl"
29
elif [ "$filter" == '3' ]; then	# HAVP_BL
29
elif [ "$filter" == '3' ]; then	# HAVP_BL
30
	set_filter="havp_bl"
30
	set_filter="havp_bl"