summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-07-08 13:17:24 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-07-08 13:17:24 +0000
commit84ebd8d6eeaf469b518ae04a53c30d1ddbe84e4f (patch)
treed173412e74255d7bae364b12e63559bdca6aa2ab /radsecproxy.c
parent47500fdd554b60c4df4285be2f43b808665e07d8 (diff)
accountingresponse option for realms for sending accounting response when no accounting server is configured
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@300 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index c8809d6..99332c1 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1911,6 +1911,9 @@ void radsrv(struct request *rq) {
if (realm->message && code == RAD_Access_Request) {
debug(DBG_INFO, "radsrv: sending reject to %s for %s", rq->from->conf->host, userascii);
respondreject(rq, realm->message);
+ } else if (realm->accresp && code == RAD_Accounting_Request) {
+ acclog(attrs, len, rq->from->conf->host);
+ respondaccounting(rq);
}
goto exit;
}
@@ -2675,7 +2678,7 @@ struct list *addsrvconfs(char *value, char **names) {
return conflist;
}
-void addrealm(char *value, char **servers, char **accservers, char *message) {
+void addrealm(char *value, char **servers, char **accservers, char *message, uint8_t accresp) {
int n;
struct realm *realm;
char *s, *regex = NULL;
@@ -2720,7 +2723,8 @@ void addrealm(char *value, char **servers, char **accservers, char *message) {
if (message && strlen(message) > 253)
debugx(1, DBG_ERR, "ReplyMessage can be at most 253 bytes");
realm->message = message;
-
+ realm->accresp = accresp;
+
if (regcomp(&realm->regex, regex ? regex : value + 1, REG_ICASE | REG_NOSUB))
debugx(1, DBG_ERR, "addrealm: failed to compile regular expression %s", regex ? regex : value + 1);
if (regex)
@@ -3075,6 +3079,7 @@ void confserver_cb(struct gconffile **cf, char *block, char *opt, char *val) {
void confrealm_cb(struct gconffile **cf, char *block, char *opt, char *val) {
char **servers = NULL, **accservers = NULL, *msg = NULL;
+ uint8_t accresp = 0;
debug(DBG_DBG, "confrealm_cb called for %s", block);
@@ -3082,10 +3087,11 @@ void confrealm_cb(struct gconffile **cf, char *block, char *opt, char *val) {
"server", CONF_MSTR, &servers,
"accountingServer", CONF_MSTR, &accservers,
"ReplyMessage", CONF_STR, &msg,
+ "AccountingResponse", CONF_BLN, &accresp,
NULL
);
- addrealm(val, servers, accservers, msg);
+ addrealm(val, servers, accservers, msg, accresp);
}
void conftls_cb(struct gconffile **cf, char *block, char *opt, char *val) {