Subversion Repositories ALCASAR

Rev

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

Rev 2594 Rev 2692
Line 1... Line 1...
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# $Id: alcasar-macup.sh 2594 2018-08-19 23:11:42Z tom.houdayer $
3
# $Id: alcasar-macup.sh 2692 2019-01-25 23:18:50Z tom.houdayer $
4
#
4
#
5
# alcasar-macup.sh
5
# alcasar-macup.sh
6
#
6
#
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 28... Line 28...
28
		username=$(echo "$db_res"           | cut -f1)
28
		username=$(echo "$db_res"           | cut -f1)
29
		timeout=$(echo "$db_res"            | cut -f2)
29
		timeout=$(echo "$db_res"            | cut -f2)
30
		acctterminatecause=$(echo "$db_res" | cut -f3)
30
		acctterminatecause=$(echo "$db_res" | cut -f3)
31
 
31
 
32
		if [ "$acctterminatecause" != "User-Request" ]; then
32
		if [ "$acctterminatecause" != "User-Request" ]; then
33
			db_query="SELECT attribute, value FROM ((SELECT attribute, value FROM radreply WHERE (attribute='Alcasar-Reconnect-Timeout') AND username='$username') UNION (SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE (attribute='Alcasar-Reconnect-Timeout') AND username = '$username' ORDER BY ug.priority)) attrs GROUP BY attribute;"
33
			db_query="SELECT attribute, value FROM ((SELECT attribute, value FROM radreply WHERE (attribute='Alcasar-Reconnect-Timeout') AND username='$username') UNION (SELECT attribute, value FROM radgroupreply gr LEFT JOIN radusergroup ug ON gr.groupname = ug.groupname WHERE (attribute='Alcasar-Reconnect-Timeout') AND username = '$username' ORDER BY ug.priority) UNION (SELECT attribute, value FROM radgroupreply WHERE groupname = 'ldap' AND (attribute='Alcasar-Reconnect-Timeout'))) attrs GROUP BY attribute;"
34
			db_res=$(mysql -u root -p"$dbRootPass" -D radius -e "$db_query" -Bs)
34
			db_res=$(mysql -u root -p"$dbRootPass" -D radius -e "$db_query" -Bs)
35
 
35
 
36
			reconnectTimeout=$(echo "$db_res" | awk '$1 == "Alcasar-Reconnect-Timeout" { print $2 }')
36
			reconnectTimeout=$(echo "$db_res" | awk '$1 == "Alcasar-Reconnect-Timeout" { print $2 }')
37
 
37
 
38
			if [ -n "$reconnectTimeout" ] && [ $timeout -le $reconnectTimeout ]; then
38
			if [ -n "$reconnectTimeout" ] && [ $timeout -le $reconnectTimeout ]; then