# count-attribute.
#
# The 'reset' parameter defines when the counters are all reset to
- # zero. It can be hourly, daily, weekly, or monthly.
+ # zero. It can be hourly, daily, weekly, monthly or never.
#
# The counter-name is the name of the attribute in the 'users'
# file used to access that counter. e.g.
*/
typedef struct rlm_counter_t {
char *filename; /* name of the database file */
- char *reset; /* daily, weekly, monthly */
+ char *reset; /* daily, weekly, monthly, never */
char *key_name; /* User-Name */
char *count_attribute; /* Acct-Session-Time */
char *counter_name; /* Daily-Session-Time */
tm->tm_mday = 1;
tm->tm_mon++;
data->reset_time = mktime(tm);
+ } else if (strcmp(data->reset, "never") == 0) {
+ data->reset_time = 0;
} else {
radlog(L_ERR, "rlm_counter: Unknown reset timer \"%s\"",
data->reset);
/*
* Find the attribute for the allowed protocol
*/
- if (data->service_type == NULL) {
- radlog(L_ERR, "rlm_counter: 'allowed-servicetype' must be set.");
- exit(0);
- }
if (data->service_type != NULL) {
if ((dval = dict_valbyname(PW_SERVICE_TYPE, data->service_type)) == NULL) {
radlog(L_ERR, "rlm_counter: Failed to find attribute number for %s",
* not need to login again
*/
- if (res >= (data->reset_time - request->timestamp))
+ if (data->reset_time && res >= (data->reset_time - request->timestamp))
res += check_vp->lvalue;
DEBUG2("rlm_counter: (Check item - counter) is greater than zero");