Subversion Repositories ALCASAR

Rev

Rev 2965 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2965 Rev 3269
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-condown.sh 2965 2021-07-04 22:15:08Z rexy $
3
# $Id: alcasar-condown.sh 3269 2025-04-21 21:57:13Z rexy $
4
#
4
#
5
# alcasar-condown.sh
5
# alcasar-condown.sh
6
# by Rexy & Pierre RIVAULT
6
# by Rexy & Pierre RIVAULT
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 22... Line 22...
22
db_query="SELECT attribute, value FROM ( \
22
db_query="SELECT attribute, value FROM ( \
23
 	( SELECT attribute, value FROM radreply WHERE username = '$USER_NAME' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) UNION \
23
 	( SELECT attribute, value FROM radreply WHERE username = '$USER_NAME' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) UNION \
24
	( SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE username = '$USER_NAME' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ORDER BY ug.priority ) UNION \
24
	( SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE username = '$USER_NAME' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ORDER BY ug.priority ) UNION \
25
	( SELECT attribute, value FROM radgroupreply WHERE groupname = 'default' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) \
25
	( SELECT attribute, value FROM radgroupreply WHERE groupname = 'default' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) \
26
) attrs GROUP BY attribute;"
26
) attrs GROUP BY attribute;"
27
db_res=$(mysql -u$DB_USER -p$DB_PASSWORD -D radius -e "$db_query" -Ns)
27
db_res=$(mariadb -u$DB_USER -p$DB_PASSWORD -D radius -e "$db_query" -Ns)
28
 
28
 
29
filter=$(echo "$db_res"      | awk '$1 == "Alcasar-Filter"           { print $2 }')
29
filter=$(echo "$db_res"      | awk '$1 == "Alcasar-Filter"           { print $2 }')
30
filterProto=$(echo "$db_res" | awk '$1 == "Alcasar-Protocols-Filter" { print $2 }')
30
filterProto=$(echo "$db_res" | awk '$1 == "Alcasar-Protocols-Filter" { print $2 }')
31
 
31
 
32
if [ "$filter" == '4' ]; then	# AV_WL
32
if [ "$filter" == '4' ]; then	# AV_WL