From: Alan T. DeKok Date: Thu, 27 Oct 2011 07:37:10 +0000 (+0200) Subject: Make Session-Timeout the default X-Git-Tag: release_3_0_0_beta0~539 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ff5c00ce4db8b0f2aaef858634093c76858029f;p=thirdparty%2Ffreeradius-server.git Make Session-Timeout the default by using it in the data structure, rather than checking for it in the code --- diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index 0bd3dbb0deb..f8e15f96f3e 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -89,7 +89,7 @@ typedef struct rlm_sqlcounter_t { static const CONF_PARSER module_config[] = { { "counter-name", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,counter_name), NULL, NULL }, { "check-name", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,check_name), NULL, NULL }, - { "reply-name", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,reply_name), NULL, NULL }, + { "reply-name", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,reply_name), NULL, "Session-Timeout" }, { "key", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,key_name), NULL, NULL }, { "sqlmod-inst", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,sqlmod_inst), NULL, NULL }, { "query", PW_TYPE_STRING_PTR, offsetof(rlm_sqlcounter_t,query), NULL, NULL }, @@ -482,28 +482,16 @@ static int sqlcounter_instantiate(CONF_SECTION *conf, void **instance) } data->key_attr = dattr; - /* - * Discover the attribute number of the reply. - * If not set, set it to Session-Timeout - * for backward compatibility. - */ - if (data->reply_name == NULL) { - DEBUG2("rlm_sqlcounter: Reply attribute set to Session-Timeout."); - data->reply_attr = dict_attrbyvalue(PW_SESSION_TIMEOUT, 0); - data->reply_name = strdup("Session-Timeout"); - } - else { - dattr = dict_attrbyname(data->reply_name); - if (dattr == NULL) { - radlog(L_ERR, "rlm_sqlcounter: No such attribute %s", + dattr = dict_attrbyname(data->reply_name); + if (dattr == NULL) { + radlog(L_ERR, "rlm_sqlcounter: No such attribute %s", data->reply_name); - sqlcounter_detach(data); - return -1; - } - data->reply_attr = dattr; - DEBUG2("rlm_sqlcounter: Reply attribute %s is number %d", - data->reply_name, dattr->attr); + sqlcounter_detach(data); + return -1; } + data->reply_attr = dattr; + DEBUG2("rlm_sqlcounter: Reply attribute %s is number %d", + data->reply_name, dattr->attr); /* * Check the "sqlmod-inst" option.