update disconnect
Ming-Ching Tiew
mctiew at yahoo.com
Thu May 14 16:53:54 CEST 2009
I am trying to get the 'update disconnect' to work putting this into
the preacct section :-
---------------------------------------------------------
if ( "%{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}" ) {
update disconnect {
Reply-Message = "You have been disconnected by the administrator!"
}
#%{exec:/usr/local/dialup_admin/bin/disconnect.sh %{User-Name} %{Acct-Session-Id} %{NAS-IP-Address} %{Packet-Src-Port} }
"%{sql:DELETE FROM radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}"
}
--------------------------cut----------------------------
The update disconnect did not work but the (commented) exec using a script
based on radclient works, What's wrong ?
Though the exec method works but I have to open up the port, which means
the firewall thinks that's a separate connection, which is lousy.
The update disconnect did not work but the (commented) exec using a script based on radclient works,
What's wrong ?
Though the exec method works but I have to open up the port, which means
the firewall thinks that's a separate connection, which is lousy.
Secondly, the sql DELETE, seems to be executed twice, here is the log :-
----------------------------cut------------------------------------
expand: %{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'} -> 1
? Evaluating ("%{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}" ) -> TRUE
++? if ("%{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}" ) -> TRUE
++- entering if ("%{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}" ) {...}
+++[disconnect] returns noop
sql_xlat
expand: %{User-Name} -> test1
sql_set_user escaped user --> 'test1'
expand: DELETE FROM radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now' -> DELETE FROM radcheck WHERE UserName = 'test1' and attribute = 'Acct-Logout-Now'
rlm_sql (sql): Reserving sql socket id: 3
rlm_sql_mysql: MYSQL Error: No Fields
rlm_sql_mysql: MYSQL error:
rlm_sql (sql): Attempting to connect rlm_sql_mysql #3
rlm_sql_mysql: Starting connect to MySQL server for #3
rlm_sql (sql): Connected new DB handle, #3
rlm_sql (sql): failed after re-connect
SQL query did not succeed
rlm_sql (sql): Released sql socket id: 3
expand: %{sql:DELETE FROM radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'} ->
+++[expand] returns noop
++- if ("%{sql:SELECT value from radcheck WHERE UserName = '%{User-Name}' and attribute = 'Acct-Logout-Now'}" ) returns noop
---------------------------cut--------------------------------------
If I understand the log correctly, the second sql access is displayed
first, that's why there is a failure, whereas the first sql access
is displayed later, but it's a noop.
Any comments ?
More information about the Freeradius-Users
mailing list