From: Alan T. DeKok Date: Thu, 6 Mar 2025 14:18:31 +0000 (-0500) Subject: remove '&' from sqlcounter configuration and source X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44491f8b1e8b9fbc1db43bc404b47c828a025a89;p=thirdparty%2Ffreeradius-server.git remove '&' from sqlcounter configuration and source --- diff --git a/doc/antora/modules/reference/pages/raddb/mods-available/sqlcounter.adoc b/doc/antora/modules/reference/pages/raddb/mods-available/sqlcounter.adoc index f5291564ec..05c827246f 100644 --- a/doc/antora/modules/reference/pages/raddb/mods-available/sqlcounter.adoc +++ b/doc/antora/modules/reference/pages/raddb/mods-available/sqlcounter.adoc @@ -67,14 +67,14 @@ from the database. reset_period_start_name:: The name of the attribute which is used to store the time that the current reset period started. -The default is `&control.${.:instance}-Reset-Start` +The default is `control.${.:instance}-Reset-Start` Note because we are counting seconds, this attribute is of type `uint64`, and not `date`. reset_period_end_name:: The name of the attribute which is used to store the time that the current reset period will end. -The default is `&control.${.:instance}-Reset-End` +The default is `control.${.:instance}-Reset-End` Note because we are counting seconds, this attribute is of type `uint64`, and not `date`. @@ -87,7 +87,7 @@ After the sqlcounter module has run, the counter attribute will exist. check_name:: Name of the attribute containing the limit to compare the counter to. reply_name:: Name of the attribute to populate with the remaining session time. -e.g. `&reply.Session-Timeout`. If the attribute already exists and contains +e.g. `reply.Session-Timeout`. If the attribute already exists and contains a lower value, then it will not be updated. reply_message_name:: Name of the attribute into which a message should be placed @@ -146,51 +146,51 @@ NOTE: You may need to edit `raddb/dictionary` to add the `Expire-After` attribut # sqlcounter { # sql_module_instance = sql_foo # reset = 12h -# key = "%{&Stripped-User-Name || &User-Name}" -# if (&control.Daily-Session-Time > 3600) { -# &Reply-Message := "You've used up more than one hour today" +# key = "%{Stripped-User-Name || User-Name}" +# if (control.Daily-Session-Time > 3600) { +# Reply-Message := "You've used up more than one hour today" # reject # } sqlcounter dailycounter { sql_module_instance = sql dialect = ${modules.sql.dialect} -# reset_period_start_name = &control.${.:instance}-Reset-Start -# reset_period_end_name = &control.${.:instance}-Reset-End - counter_name = &control.Daily-Session-Time - check_name = &control.Max-Daily-Session - reply_name = &reply.Session-Timeout +# reset_period_start_name = control.${.:instance}-Reset-Start +# reset_period_end_name = control.${.:instance}-Reset-End + counter_name = control.Daily-Session-Time + check_name = control.Max-Daily-Session + reply_name = reply.Session-Timeout auto_extend = yes - key = "%{&Stripped-User-Name || &User-Name}" - reply_message_name = &Reply-Message + key = "%{Stripped-User-Name || User-Name}" + reply_message_name = Reply-Message reset = daily $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf } sqlcounter monthlycounter { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Monthly-Session-Time - check_name = &control.Max-Monthly-Session - reply_name = &reply.Session-Timeout + counter_name = Monthly-Session-Time + check_name = control.Max-Monthly-Session + reply_name = reply.Session-Timeout auto_extend = yes - key = &User-Name + key = User-Name reset = monthly $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf } sqlcounter noresetcounter { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Max-All-Session-Time - check_name = &control.Max-All-Session - key = &User-Name + counter_name = Max-All-Session-Time + check_name = control.Max-All-Session + key = User-Name reset = never $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf } sqlcounter expire_on_login { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Expire-After-Initial-Login - check_name = &control.Expire-After - key = &User-Name + counter_name = Expire-After-Initial-Login + check_name = control.Expire-After + key = User-Name reset = never $INCLUDE ${modconfdir}/sql/counter/${dialect}/${.:instance}.conf } diff --git a/raddb/mods-available/sqlcounter b/raddb/mods-available/sqlcounter index 576a7c6dfa..c30ee5db19 100644 --- a/raddb/mods-available/sqlcounter +++ b/raddb/mods-available/sqlcounter @@ -69,19 +69,19 @@ # The `query` parameter specifies the SQL query used to get the current Counter value # from the database. # -# key = "%{&Stripped-User-Name || &User-Name}" +# key = "%{Stripped-User-Name || User-Name}" # # reset_period_start_name:: The name of the attribute which is used to store the # time that the current reset period started. # -# The default is `&control.${.:instance}-Reset-Start` +# The default is `control.${.:instance}-Reset-Start` # # Note because we are counting seconds, this attribute is of type `uint64`, and not `date`. # # reset_period_end_name:: The name of the attribute which is used to store the # time that the current reset period will end. # -# The default is `&control.${.:instance}-Reset-End` +# The default is `control.${.:instance}-Reset-End` # # Note because we are counting seconds, this attribute is of type `uint64`, and not `date`. # @@ -90,15 +90,15 @@ # # After the sqlcounter module has run, the counter attribute will exist. # -# if (&control.Daily-Session-Time > 3600) { -# &Reply-Message := "You've used up more than one hour today" +# if (control.Daily-Session-Time > 3600) { +# Reply-Message := "You've used up more than one hour today" # reject # } # # check_name:: Name of the attribute containing the limit to compare the counter to. # # reply_name:: Name of the attribute to populate with the remaining session time. -# e.g. `&reply.Session-Timeout`. If the attribute already exists and contains +# e.g. `reply.Session-Timeout`. If the attribute already exists and contains # a lower value, then it will not be updated. # # reply_message_name:: Name of the attribute into which a message should be placed @@ -125,14 +125,14 @@ sqlcounter dailycounter { sql_module_instance = sql dialect = ${modules.sql.dialect} -# reset_period_start_name = &control.${.:instance}-Reset-Start -# reset_period_end_name = &control.${.:instance}-Reset-End - counter_name = &control.Daily-Session-Time - check_name = &control.Max-Daily-Session - reply_name = &reply.Session-Timeout +# reset_period_start_name = control.${.:instance}-Reset-Start +# reset_period_end_name = control.${.:instance}-Reset-End + counter_name = control.Daily-Session-Time + check_name = control.Max-Daily-Session + reply_name = reply.Session-Timeout auto_extend = yes - key = "%{&Stripped-User-Name || &User-Name}" - reply_message_name = &Reply-Message + key = "%{Stripped-User-Name || User-Name}" + reply_message_name = Reply-Message reset = daily @@ -146,11 +146,11 @@ sqlcounter monthlycounter { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Monthly-Session-Time - check_name = &control.Max-Monthly-Session - reply_name = &reply.Session-Timeout + counter_name = Monthly-Session-Time + check_name = control.Max-Monthly-Session + reply_name = reply.Session-Timeout auto_extend = yes - key = &User-Name + key = User-Name reset = monthly @@ -164,9 +164,9 @@ sqlcounter noresetcounter { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Max-All-Session-Time - check_name = &control.Max-All-Session - key = &User-Name + counter_name = Max-All-Session-Time + check_name = control.Max-All-Session + key = User-Name reset = never @@ -185,9 +185,9 @@ sqlcounter expire_on_login { sql_module_instance = sql dialect = ${modules.sql.dialect} - counter_name = &Expire-After-Initial-Login - check_name = &control.Expire-After - key = &User-Name + counter_name = Expire-After-Initial-Login + check_name = control.Expire-After + key = User-Name reset = never diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index e4e75b347d..bead038b6e 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -61,8 +61,8 @@ RCSID("$Id$") * be used as the instance handle. */ typedef struct { - tmpl_t *start_attr; //!< &control.${.:instance}-Start - tmpl_t *end_attr; //!< &control.${.:instance}-End + tmpl_t *start_attr; //!< control.${.:instance}-Start + tmpl_t *end_attr; //!< control.${.:instance}-End tmpl_t *counter_attr; //!< Daily-Session-Time. tmpl_t *limit_attr; //!< Max-Daily-Session. @@ -88,12 +88,12 @@ static const conf_parser_t module_config[] = { { FR_CONF_OFFSET_FLAGS("auto_extend", CONF_FLAG_OK_MISSING, rlm_sqlcounter_t, auto_extend) }, { FR_CONF_OFFSET_FLAGS("utc", CONF_FLAG_OK_MISSING, rlm_sqlcounter_t, utc) }, - { FR_CONF_OFFSET_FLAGS("key", CONF_FLAG_NOT_EMPTY, rlm_sqlcounter_t, key), .dflt = "%{%{Stripped-User-Name} || %{User-Name}}", .quote = T_DOUBLE_QUOTED_STRING }, + { FR_CONF_OFFSET_FLAGS("key", CONF_FLAG_NOT_EMPTY, rlm_sqlcounter_t, key), .dflt = "%{Stripped-User-Name || User-Name}", .quote = T_DOUBLE_QUOTED_STRING }, { FR_CONF_OFFSET_FLAGS("reset_period_start_name", CONF_FLAG_ATTRIBUTE, rlm_sqlcounter_t, start_attr), - .dflt = "&control.${.:instance}-Reset-Start", .quote = T_BARE_WORD }, + .dflt = "control.${.:instance}-Reset-Start", .quote = T_BARE_WORD }, { FR_CONF_OFFSET_FLAGS("reset_period_end_name", CONF_FLAG_ATTRIBUTE, rlm_sqlcounter_t, end_attr), - .dflt = "&control.${.:instance}-Reset-End", .quote = T_BARE_WORD }, + .dflt = "control.${.:instance}-Reset-End", .quote = T_BARE_WORD }, /* Attribute to write counter value to*/ { FR_CONF_OFFSET_FLAGS("counter_name", CONF_FLAG_ATTRIBUTE | CONF_FLAG_REQUIRED, rlm_sqlcounter_t, counter_attr) },