Skip to content

Commit

Permalink
move to %func(args) everywhere in raddb/*
Browse files Browse the repository at this point in the history
  • Loading branch information
jpereira committed Oct 4, 2023
1 parent bb341c9 commit c6e9f6b
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 100 deletions.
4 changes: 2 additions & 2 deletions raddb/mods-available/mschap
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ mschap {
# WARNING: Be VERY careful when editing the following line!
# Change the path, and ideally nothing else.
#
# ntlm_auth = "/path/to/ntlm_auth --request-nt-key --allow-mschapv2 --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%mschap(Challenge):-00} --nt-response=%{%mschap(NT-Response):-00}"
# ntlm_auth = "/path/to/ntlm_auth --request-nt-key --allow-mschapv2 --username=%{&Stripped-User-Name || &User-Name || 'None'} --challenge=%{%mschap(Challenge) || 00} --nt-response=%{%mschap(NT-Response) || 00}"

#
# ntlm_auth_timeout:: Time to wait for `ntlm_auth` to run.
Expand Down Expand Up @@ -336,7 +336,7 @@ mschap {
# TIP: We give both examples here, but *only one should be used*.
#
# local_cpw = "%exec(/path/to/script %mschap(User-Name) %{MS-CHAP-New-Password.Cleartext})"
# local_cpw = "%sql(UPDATE radcheck set value='%{MS-CHAP-New-NT-Password}' where username='%{User-Name}' and attribute='Password.NT'}"
# local_cpw = "%sql(UPDATE radcheck set value='%{MS-CHAP-New-NT-Password}' where username='%{User-Name}' and attribute='Password.NT')"
}

#
Expand Down
2 changes: 1 addition & 1 deletion raddb/mods-config/sql/cui/mysql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ post-auth {
}

accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"
type {
start {
query = "\
Expand Down
2 changes: 1 addition & 1 deletion raddb/mods-config/sql/cui/postgresql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ post-auth {
}

accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"
type {
start {
query = "\
Expand Down
3 changes: 2 additions & 1 deletion raddb/mods-config/sql/cui/sqlite/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ post-auth {
}

accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"

type {
start {
query = "\
Expand Down
14 changes: 7 additions & 7 deletions raddb/mods-config/sql/main/cassandra/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Use Stripped-User-Name, if it's there.
# Else use User-Name, if it's there,
# Else use hard-coded string "DEFAULT" as the user name.
#sql_user_name = "%{%{Stripped-User-Name}:-%{%{User-Name}:-DEFAULT}}"
#sql_user_name = "%{&Stripped-User-Name || &User-Name || 'DEFAULT'}"
#
sql_user_name = "%{User-Name}"

Expand All @@ -49,7 +49,7 @@ sql_user_name = "%{User-Name}"
# distrust the provided Event-Timestamp.
#event_timestamp_epoch = "%l"

event_timestamp_epoch = "%{%(integer:%{Event-Timestamp}):-%l}"
event_timestamp_epoch = "%integer(%{&Event-Timestamp || %l})"

# event_timestamp is the SQL snippet for converting an epoch timestamp
# to an SQL date.
Expand Down Expand Up @@ -143,7 +143,7 @@ authorize_group_reply_query = "\
# as INSERTS are really UPSERTS so we can work around it.
#######################################################################
accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"

# Write SQL queries to a logfile. This is potentially useful for bulk inserts
# when used with the rlm_sql_null driver.
Expand Down Expand Up @@ -201,7 +201,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{&NAS-Port-Id || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
${....event_timestamp}, \
Expand Down Expand Up @@ -263,7 +263,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{&NAS-Port-Id || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
null, \
Expand Down Expand Up @@ -326,7 +326,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{&NAS-Port-Id || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
${....event_timestamp}, \
Expand Down Expand Up @@ -368,7 +368,7 @@ post-auth {
(username, pass, reply, authdate, class) \
VALUES ( \
'%{SQL-User-Name}', \
'%{%{User-Password}:-%{Chap-Password}}', \
'%{&User-Password || &Chap-Password}', \
'%{reply.Packet-Type}', \
'%{%l * 1000 + %M / 1000}', \
'%{reply.Class}')"
Expand Down
36 changes: 18 additions & 18 deletions raddb/mods-config/sql/main/mssql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Use Stripped-User-Name, if it's there.
# Else use User-Name, if it's there,
# Else use hard-coded string "none" as the user name.
#sql_user_name = "%{%{Stripped-User-Name}:-%{%{User-Name}:-none}}"
#sql_user_name = "%{&Stripped-User-Name || &User-Name || 'none'}"
#
sql_user_name = "%{User-Name}"

Expand All @@ -38,7 +38,7 @@ sql_user_name = "%{User-Name}"
# distrust the provided Event-Timestamp.
#event_timestamp_epoch = "%l"

event_timestamp_epoch = "%{%(integer:%{Event-Timestamp}):-%l}"
event_timestamp_epoch = "%integer(%{&Event-Timestamp || %l})"

# event_timestamp is the SQL snippet for converting an epoch timestamp
# to an SQL date.
Expand Down Expand Up @@ -141,7 +141,7 @@ simul_verify_query = "\
# combination of attributes, or custom 'Acct-Status-Type' values.
#######################################################################
accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"

# Write SQL queries to a logfile. This is potentially useful for bulk inserts
# when used with the rlm_sql_null driver.
Expand All @@ -155,8 +155,8 @@ accounting {
AcctStopTime=${....event_timestamp}, \
AcctSessionTime=${....event_timestamp_epoch} - \
DATEDIFF(SS, '1970-01-01', AcctStartTime), \
AcctTerminateCause='%{%{Acct-Terminate-Cause}:-NAS-Reboot}', \
AcctStopDelay = %{%{Acct-Delay-Time}:-0} \
AcctTerminateCause='%{&Acct-Terminate-Cause || &NAS-Reboot}', \
AcctStopDelay = %{&Acct-Delay-Time || 0} \
WHERE AcctStopTime = 0 \
AND NASIPAddress = '%{NAS-IP-Address}' \
AND AcctStartTime <= ${....event_timestamp}"
Expand Down Expand Up @@ -211,7 +211,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
'0', \
Expand All @@ -238,7 +238,7 @@ accounting {
UPDATE ${....acct_table1} \
SET \
AcctStartTime = ${....event_timestamp}, \
AcctStartDelay = '%{%{Acct-Delay-Time}:-0}', \
AcctStartDelay = '%{&Acct-Delay-Time || 0}', \
ConnectInfo_start = '%{Connect-Info}' \
WHERE AcctUniqueId = '%{Acct-Unique-Session-ID}' \
AND AcctStopTime = 0"
Expand All @@ -251,8 +251,8 @@ accounting {
AcctInterval = DATEDIFF(second, CASE WHEN AcctUpdateTime > 0 THEN AcctUpdateTime ELSE AcctStartTime END, ${....event_timestamp}), \
AcctUpdateTime = ${....event_timestamp}, \
AcctSessionTime = '%{Acct-Session-Time}', \
AcctInputOctets = convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
AcctOutputOctets = convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
AcctInputOctets = convert(bigint, '%{&Acct-Input-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Input-Octets || 0}', \
AcctOutputOctets = convert(bigint, '%{&Acct-Output-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Output-Octets || 0}', \
FramedIPAddress = '%{Framed-IP-Address}', \
FramedIPv6Address = '%{Framed-IPv6-Address}', \
FramedIPv6Prefix = '%{Framed-IPv6-Prefix}', \
Expand Down Expand Up @@ -295,7 +295,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
${....event_timestamp}, \
Expand Down Expand Up @@ -323,10 +323,10 @@ accounting {
SET \
AcctStopTime = ${....event_timestamp}, \
AcctSessionTime = '%{Acct-Session-Time}', \
AcctInputOctets = convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
AcctOutputOctets = convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
AcctInputOctets = convert(bigint, '%{&Acct-Input-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Input-Octets || 0}', \
AcctOutputOctets = convert(bigint, '%{&Acct-Output-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Output-Octets || 0}', \
AcctTerminateCause = '%{Acct-Terminate-Cause}', \
AcctStopDelay = '%{%{Acct-Delay-Time}:-0}', \
AcctStopDelay = '%{&Acct-Delay-Time || 0}', \
ConnectInfo_stop = '%{Connect-Info}', \
Class = '%{Class}' \
WHERE AcctUniqueId = '%{Acct-Unique-Session-ID}' \
Expand Down Expand Up @@ -367,16 +367,16 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
'%{Acct-Session-Time}', \
'%{Acct-Authentic}', \
'', \
'%{Connect-Info}', \
NULL, \
convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
convert(bigint, '%{&Acct-Input-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Input-Octets || 0}', \
convert(bigint, '%{&Acct-Output-Gigawords || 0}' * POWER(2.0, 32)) | '%{&Acct-Output-Octets || 0}', \
'%{Called-Station-Id}', \
'%{Calling-Station-Id}', \
'%{Acct-Terminate-Cause}', \
Expand All @@ -388,7 +388,7 @@ accounting {
'%{Framed-Interface-Id}', \
'%{Delegated-IPv6-Prefix}', \
'0', \
'%{%{Acct-Delay-Time}:-0}', \
'%{&Acct-Delay-Time || 0}', \
'%{Class}')"
}
}
Expand All @@ -404,7 +404,7 @@ post-auth {
(userName, pass, reply, authdate, class) \
VALUES(\
'%{User-Name}', \
'%{%{User-Password}:-CHAP-PASSWORD}', \
'%{&User-Password || CHAP-PASSWORD}', \
'%{reply.Packet-Type}', \
'%S.%{%M / 1000}', \
'%{reply.Class}')"
Expand Down
52 changes: 26 additions & 26 deletions raddb/mods-config/sql/main/mysql/queries.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Use Stripped-User-Name, if it's there.
# Else use User-Name, if it's there,
# Else use hard-coded string "DEFAULT" as the user name.
#sql_user_name = "%{%{Stripped-User-Name}:-%{%{User-Name}:-DEFAULT}}"
#sql_user_name = "%{&Stripped-User-Name || &User-Name || 'DEFAULT'}"
#
sql_user_name = "%{User-Name}"

Expand All @@ -49,7 +49,7 @@ sql_user_name = "%{User-Name}"
# distrust the provided Event-Timestamp.
#event_timestamp_epoch = "%l"

event_timestamp_epoch = "%{%(integer:%{Event-Timestamp}):-%l}"
event_timestamp_epoch = %integer(%{&Event-Timestamp || %l})

# event_timestamp is the SQL snippet for converting an epoch timestamp
# to an SQL date.
Expand Down Expand Up @@ -167,7 +167,7 @@ authorize_group_reply_query = "\
# combination of attributes, or custom 'Acct-Status-Type' values.
#######################################################################
accounting {
reference = "%{tolower:type.%{Acct-Status-Type}.query}"
reference = "%tolower(type.%{Acct-Status-Type}.query)"

# Write SQL queries to a logfile. This is potentially useful for bulk inserts
# when used with the rlm_sql_null driver.
Expand Down Expand Up @@ -205,7 +205,7 @@ accounting {
acctstoptime = ${....event_timestamp}, \
acctsessiontime = '${....event_timestamp_epoch}' \
- UNIX_TIMESTAMP(acctstarttime), \
acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' \
acctterminatecause = '%{&Acct-Terminate-Cause || &NAS-Reboot}' \
WHERE acctstoptime IS NULL \
AND nasipaddress = '%{NAS-IP-Address}' \
AND acctstarttime <= ${....event_timestamp}"
Expand Down Expand Up @@ -261,7 +261,7 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
${....event_timestamp}, \
${....event_timestamp}, \
Expand Down Expand Up @@ -315,11 +315,11 @@ accounting {
framedipv6prefix = '%{Framed-IPv6-Prefix}', \
framedinterfaceid = '%{Framed-Interface-Id}', \
delegatedipv6prefix = '%{Delegated-IPv6-Prefix}', \
acctsessiontime = %{%{Acct-Session-Time}:-NULL}, \
acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}' \
<< 32 | '%{%{Acct-Input-Octets}:-0}', \
acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' \
<< 32 | '%{%{Acct-Output-Octets}:-0}', \
acctsessiontime = %{&Acct-Session-Time || NULL}, \
acctinputoctets = '%{&Acct-Input-Gigawords || 0}' \
<< 32 | '%{&Acct-Input-Octets || 0}', \
acctoutputoctets = '%{&Acct-Output-Gigawords || 0}' \
<< 32 | '%{&Acct-Output-Octets || 0}', \
class = '%{Class}' \
WHERE acctuniqueid = '%{Acct-Unique-Session-Id}'"

Expand All @@ -336,17 +336,17 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
FROM_UNIXTIME(${....event_timestamp_epoch} - %{%{Acct-Session-Time}:-0}), \
FROM_UNIXTIME(${....event_timestamp_epoch} - %{&Acct-Session-Time || 0}), \
${....event_timestamp}, \
NULL, \
%{%{Acct-Session-Time}:-NULL}, \
%{&Acct-Session-Time || NULL}, \
'%{Acct-Authentic}', \
'%{Connect-Info}', \
'', \
'%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', \
'%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', \
'%{&Acct-Input-Gigawords || 0}' << 32 | '%{&Acct-Input-Octets || 0}', \
'%{&Acct-Output-Gigawords || 0}' << 32 | '%{&Acct-Output-Octets || 0}', \
'%{Called-Station-Id}', \
'%{Calling-Station-Id}', \
'', \
Expand All @@ -367,11 +367,11 @@ accounting {
query = "\
UPDATE ${....acct_table2} SET \
acctstoptime = ${....event_timestamp}, \
acctsessiontime = %{%{Acct-Session-Time}:-NULL}, \
acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}' \
<< 32 | '%{%{Acct-Input-Octets}:-0}', \
acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' \
<< 32 | '%{%{Acct-Output-Octets}:-0}', \
acctsessiontime = %{&Acct-Session-Time || NULL}, \
acctinputoctets = '%{&Acct-Input-Gigawords || 0}' \
<< 32 | '%{&Acct-Input-Octets || 0}', \
acctoutputoctets = '%{&Acct-Output-Gigawords || 0}' \
<< 32 | '%{&Acct-Output-Octets || 0}', \
acctterminatecause = '%{Acct-Terminate-Cause}', \
connectinfo_stop = '%{Connect-Info}', \
class = '%{Class}' \
Expand All @@ -390,17 +390,17 @@ accounting {
'%{SQL-User-Name}', \
'%{Realm}', \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
'%{&NAS-Port-ID || &NAS-Port}', \
'%{NAS-Port-Type}', \
FROM_UNIXTIME(${....event_timestamp_epoch} - %{%{Acct-Session-Time}:-0}), \
FROM_UNIXTIME(${....event_timestamp_epoch} - %{&Acct-Session-Time || 0}), \
${....event_timestamp}, \
${....event_timestamp}, \
%{%{Acct-Session-Time}:-NULL}, \
%{&Acct-Session-Time || NULL}, \
'%{Acct-Authentic}', \
'', \
'%{Connect-Info}', \
'%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', \
'%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', \
'%{&Acct-Input-Gigawords || 0}' << 32 | '%{&Acct-Input-Octets || 0}', \
'%{&Acct-Output-Gigawords || 0}' << 32 | '%{&Acct-Output-Octets || 0}', \
'%{Called-Station-Id}', \
'%{Calling-Station-Id}', \
'%{Acct-Terminate-Cause}', \
Expand Down Expand Up @@ -433,7 +433,7 @@ post-auth {
(username, pass, reply, authdate, class) \
VALUES ( \
'%{SQL-User-Name}', \
'%{%{User-Password}:-%{Chap-Password}}', \
'%{&User-Password || &Chap-Password}', \
'%{reply.Packet-Type}', \
'%S.%M', \
'%{reply.Class}')"
Expand Down

0 comments on commit c6e9f6b

Please sign in to comment.