be `+&coa:Session-Timeout+`. That allows the server to send a CoA packet
which updates the `+Session-Timeout+` for the user.
-In v4, when the `key` field was set to `User-Name`, the module would
-also look for `Stripped-User-Name` as the key. In v4, this
-functionality has been moved to the configuration. To get the same
-functionality, the key should now be specified as a dynamic expansion:
-
-```
-key = "%{%{Stripped-User-Name}:-%{User-Name}}"
-```
-
=== rlm_sqlippool
NOTE: The `+ipv6+` configuration item has been deleted. It was
# | `%%e` | unix time value of end of reset period.
# |===
#
-# key = "%{%{Stripped-User-Name}:-%{User-Name}}"
+# key = &User-Name
#
# counter_name:: Name of the `check` attribute to use to access the counter in
# the `users` file or SQL `radcheck` or `radcheckgroup` tables.
counter_name = &Daily-Session-Time
check_name = &control:Max-Daily-Session
reply_name = &reply:Session-Timeout
- key = "%{%{Stripped-User-Name}:-%{User-Name}}"
+ key = &User-Name
reset = daily
{ FR_CONF_OFFSET("query", FR_TYPE_STRING | FR_TYPE_XLAT | FR_TYPE_REQUIRED, rlm_sqlcounter_t, query) },
{ FR_CONF_OFFSET("reset", FR_TYPE_STRING | FR_TYPE_REQUIRED, rlm_sqlcounter_t, reset) },
- { FR_CONF_OFFSET("key", FR_TYPE_TMPL | FR_TYPE_ATTRIBUTE, rlm_sqlcounter_t, key_attr), .dflt = "%{%{Stripped-User-Name}:-%{User-Name}}", .quote = T_BARE_WORD },
+ { FR_CONF_OFFSET("key", FR_TYPE_TMPL | FR_TYPE_ATTRIBUTE, rlm_sqlcounter_t, key_attr), .dflt = "&request:User-Name", .quote = T_BARE_WORD },
/* Just used to register a paircmp against */
{ FR_CONF_OFFSET("counter_name", FR_TYPE_TMPL | FR_TYPE_ATTRIBUTE | FR_TYPE_REQUIRED, rlm_sqlcounter_t, paircmp_attr) },
{ NULL }
};
+static fr_dict_attr_t const *attr_user_name;
static fr_dict_attr_t const *attr_reply_message;
static fr_dict_attr_t const *attr_session_timeout;
extern fr_dict_attr_autoload_t rlm_sqlcounter_dict_attr[];
fr_dict_attr_autoload_t rlm_sqlcounter_dict_attr[] = {
+ { .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
{ .out = &attr_reply_message, .name = "Reply-Message", .type = FR_TYPE_STRING, .dict = &dict_radius },
{ .out = &attr_session_timeout, .name = "Session-Timeout", .type = FR_TYPE_UINT32, .dict = &dict_radius },
{ NULL }
find_next_reset(inst, fr_time_to_sec(request->packet->timestamp));
}
- tmpl_find_vp(&key_vp, request, inst->key_attr);
+ /*
+ * Look for the key. User-Name is special. It means
+ * The REAL username, after stripping.
+ */
+ if ((inst->key_attr->tmpl_list == PAIR_LIST_REQUEST) &&
+ (inst->key_attr->tmpl_da == attr_user_name)) {
+ key_vp = request->username;
+ } else {
+ tmpl_find_vp(&key_vp, request, inst->key_attr);
+ }
if (!key_vp) {
RWDEBUG2("Couldn't find key attribute, %s, doing nothing...", inst->key_attr->tmpl_da->name);
return RLM_MODULE_NOOP;