summaryrefslogtreecommitdiff
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
commit9bd9afbfb5d3307c3d7071f611434afeac0d6042 (patch)
tree438b503a334754980be03057be9108173b608777
parent66cbf6fc9f6cd9d92e59d9a5a90b166a3053e484 (diff)
accountingresponse option for realms for sending accounting response when no accounting server is configured
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@300 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r--radsecproxy.c12
-rw-r--r--radsecproxy.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 720ea7f..b2e734e 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -2077,6 +2077,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;
}
@@ -2901,7 +2904,7 @@ void freerealm(struct realm *realm) {
free(realm);
}
-struct realm *addrealm(struct list *realmlist, char *value, char **servers, char **accservers, char *message) {
+struct realm *addrealm(struct list *realmlist, char *value, char **servers, char **accservers, char *message, uint8_t accresp) {
int n;
struct realm *realm;
char *s, *regex = NULL;
@@ -2962,6 +2965,7 @@ struct realm *addrealm(struct list *realmlist, char *value, char **servers, char
goto errexit;
}
realm->message = message;
+ realm->accresp = accresp;
if (regcomp(&realm->regex, regex ? regex : value + 1, REG_ICASE | REG_NOSUB)) {
debug(DBG_ERR, "addrealm: failed to compile regular expression %s", regex ? regex : value + 1);
@@ -3045,7 +3049,7 @@ void adddynamicrealmserver(struct realm *realm, struct clsrvconf *conf, char *id
realm->subrealms = list_create();
if (!realm->subrealms)
goto errexit;
- newrealm = addrealm(realm->subrealms, realmname, NULL, NULL, NULL);
+ newrealm = addrealm(realm->subrealms, realmname, NULL, NULL, NULL, 0);
if (!newrealm)
goto errexit;
@@ -3612,6 +3616,7 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
int confrealm_cb(struct gconffile **cf, void *arg, 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);
@@ -3619,11 +3624,12 @@ int confrealm_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
"server", CONF_MSTR, &servers,
"accountingServer", CONF_MSTR, &accservers,
"ReplyMessage", CONF_STR, &msg,
+ "AccountingResponse", CONF_BLN, &accresp,
NULL
))
debugx(1, DBG_ERR, "configuration error");
- addrealm(realms, val, servers, accservers, msg);
+ addrealm(realms, val, servers, accservers, msg, accresp);
return 1;
}
diff --git a/radsecproxy.h b/radsecproxy.h
index f5a977f..5a0b3e0 100644
--- a/radsecproxy.h
+++ b/radsecproxy.h
@@ -132,6 +132,7 @@ struct server {
struct realm {
char *name;
char *message;
+ uint8_t accresp;
regex_t regex;
pthread_mutex_t subrealms_mutex;
struct list *subrealms;