From: Alan T. DeKok Date: Tue, 24 Oct 2017 15:57:11 +0000 (-0400) Subject: no more need for rad_accounting() or acct.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fe058b95b0c0e3923c4ecb17f910c9ebbbcd6d0;p=thirdparty%2Ffreeradius-server.git no more need for rad_accounting() or acct.c --- diff --git a/src/include/radiusd.h b/src/include/radiusd.h index fd19c4557bf..53eaab79c97 100644 --- a/src/include/radiusd.h +++ b/src/include/radiusd.h @@ -371,9 +371,6 @@ typedef enum { * Function prototypes. */ -/* acct.c */ -rlm_rcode_t rad_accounting(REQUEST *); - rlm_rcode_t rad_coa_recv(REQUEST *request); /* session.c */ diff --git a/src/main/acct.c b/src/main/acct.c deleted file mode 100644 index 9c866dc7989..00000000000 --- a/src/main/acct.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * acct.c Accounting routines. - * - * Version: $Id$ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * Copyright 2000,2006 The FreeRADIUS server project - * Copyright 2000 Miquel van Smoorenburg - * Copyright 2000 Alan DeKok - * Copyright 2000 Alan Curry - */ - -RCSID("$Id$") - -#include -#include - -#ifdef WITH_ACCOUNTING -/* - * rad_accounting: call modules. - * - * The return value of this function isn't actually used right now, so - * it's not entirely clear if it is returning the right things. --Pac. - */ -rlm_rcode_t rad_accounting(REQUEST *request) -{ - rlm_rcode_t rcode = RLM_MODULE_OK; - - -#ifdef WITH_PROXY -#define WAS_PROXIED (request->proxy) -#else -#define WAS_PROXIED (0) -#endif - - /* - * Run the modules only once, before proxying. - */ - if (!WAS_PROXIED) { - VALUE_PAIR *vp; - int acct_type = 0; - - rcode = process_preacct(request); - switch (rcode) { - /* - * The module has a number of OK return codes. - */ - case RLM_MODULE_NOOP: - case RLM_MODULE_OK: - case RLM_MODULE_UPDATED: - break; - /* - * The module handled the request, stop here. - */ - case RLM_MODULE_HANDLED: - return rcode; - /* - * The module failed, or said the request is - * invalid, therefore we stop here. - */ - case RLM_MODULE_FAIL: - case RLM_MODULE_INVALID: - case RLM_MODULE_NOTFOUND: - case RLM_MODULE_REJECT: - case RLM_MODULE_USERLOCK: - default: - return rcode; - } - - /* - * Do the data storage before proxying. This is to ensure - * that we log the packet, even if the proxy never does. - */ - vp = fr_pair_find_by_num(request->control, 0, FR_ACCT_TYPE, TAG_ANY); - if (vp) DEBUG2(" Found Acct-Type %s", fr_dict_enum_alias_by_value(NULL, vp->da, &vp->data)); - - rcode = process_accounting(acct_type, request); - switch (rcode) { - /* - * In case the accounting module returns FAIL, - * it's still useful to send the data to the - * proxy. - */ - case RLM_MODULE_FAIL: - case RLM_MODULE_NOOP: - case RLM_MODULE_OK: - case RLM_MODULE_UPDATED: - break; - /* - * The module handled the request, don't reply. - */ - case RLM_MODULE_HANDLED: - return rcode; - /* - * Neither proxy, nor reply to invalid requests. - */ - case RLM_MODULE_INVALID: - case RLM_MODULE_NOTFOUND: - case RLM_MODULE_REJECT: - case RLM_MODULE_USERLOCK: - default: - return rcode; - } - } - -#ifdef WITH_PROXY - /* - * We didn't see a reply to the proxied request. Fail. - */ - if (request->proxy && !request->proxy->reply) return RLM_MODULE_FAIL; -#endif - - /* - * We get here IF we're not proxying, OR if we've - * received the accounting reply from the end server, - * THEN we can reply to the NAS. - * If the accounting module returns NOOP, the data - * storage did not succeed, so radiusd should not send - * Accounting-Response. - */ - switch (rcode) { - /* - * Send back an ACK to the NAS. - */ - case RLM_MODULE_OK: - case RLM_MODULE_UPDATED: - request->reply->code = FR_CODE_ACCOUNTING_RESPONSE; - break; - - /* - * Failed to log or to proxy the accounting data, - * therefore don't reply to the NAS. - */ - case RLM_MODULE_FAIL: - case RLM_MODULE_INVALID: - case RLM_MODULE_NOOP: - case RLM_MODULE_NOTFOUND: - case RLM_MODULE_REJECT: - case RLM_MODULE_USERLOCK: - default: - break; - } - return rcode; -} -#endif diff --git a/src/main/radiusd.mk b/src/main/radiusd.mk index 0504b9a3071..bdf2961ed03 100644 --- a/src/main/radiusd.mk +++ b/src/main/radiusd.mk @@ -1,5 +1,5 @@ TARGET := radiusd -SOURCES := acct.c \ +SOURCES := \ auth.c \ conduit.c \ client.c \ diff --git a/src/main/unit_test_module.mk b/src/main/unit_test_module.mk index 5b88223293a..b3c710bb1a0 100644 --- a/src/main/unit_test_module.mk +++ b/src/main/unit_test_module.mk @@ -1,6 +1,5 @@ TARGET := unit_test_module SOURCES := \ - acct.c \ auth.c \ client.c \ crypt.c \