Subversion Repositories ALCASAR

Rev

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

Rev 2505 Rev 2692
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-condown.sh 2505 2018-03-11 13:41:00Z tom.houdayer $
3
# $Id: alcasar-condown.sh 2692 2019-01-25 23:18:50Z 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-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;"
20
db_query="SELECT attribute, value FROM (( SELECT attribute, value FROM radreply WHERE (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) AND username='$USER_NAME') UNION ( SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) AND username = '$USER_NAME' ORDER BY ug.priority) UNION (SELECT attribute, value FROM radgroupreply WHERE groupname = 'ldap' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')))) 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-Protocols-Filter"         { print $2 }')
24
filterProto=$(echo "$db_res"        | awk '$1 == "Alcasar-Protocols-Filter" { print $2 }')
25
statusOpenRequired=$(echo "$db_res" | awk '$1 == "Alcasar-Status-Page-Must-Stay-Open" { print $2 }')
-
 
26
 
25
 
27
if [ "$filter" == '4' ]; then   # HAVP_WL
26
if [ "$filter" == '4' ]; then   # HAVP_WL
28
        set_filter="havp_wl"
27
        set_filter="havp_wl"
29
elif [ "$filter" == '3' ]; then # HAVP_BL
28
elif [ "$filter" == '3' ]; then # HAVP_BL
30
        set_filter="havp_bl"
29
        set_filter="havp_bl"