16,12 → 16,18 |
fi |
|
# Remove user from his IPSET |
|
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;" |
db_query_additionalGroups='' |
[ -n "$FILTER_ID" ] && db_query_additionalGroups="( SELECT attribute, value FROM radgroupreply WHERE groupname = '$FILTER_ID' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) UNION " |
db_query="SELECT attribute, value FROM ( \ |
( SELECT attribute, value FROM radreply WHERE username = '$USER_NAME' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) UNION \ |
( 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 \ |
$db_query_additionalGroups \ |
( SELECT attribute, value FROM radgroupreply WHERE groupname = 'default' AND (attribute IN ('Alcasar-Filter', 'Alcasar-Protocols-Filter')) ) \ |
) attrs GROUP BY attribute;" |
db_res=$(mysql -u root -p$(cat $PASSWD_FILE | grep ^db_root= | cut -d'=' -f2-) -D radius -e "$db_query" -Ns) |
|
filter=$(echo "$db_res" | awk '$1 == "Alcasar-Filter" { print $2 }') |
filterProto=$(echo "$db_res" | awk '$1 == "Alcasar-Protocols-Filter" { print $2 }') |
filter=$(echo "$db_res" | awk '$1 == "Alcasar-Filter" { print $2 }') |
filterProto=$(echo "$db_res" | awk '$1 == "Alcasar-Protocols-Filter" { print $2 }') |
|
if [ "$filter" == '4' ]; then # HAVP_WL |
set_filter="havp_wl" |