summaryrefslogtreecommitdiff
path: root/accel-pppd/radius
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r--accel-pppd/radius/auth.c4
-rw-r--r--accel-pppd/radius/dict.c2
-rw-r--r--accel-pppd/radius/radius.c25
-rw-r--r--accel-pppd/radius/radius.h6
-rw-r--r--accel-pppd/radius/radius_p.h12
-rw-r--r--accel-pppd/radius/serv.c10
6 files changed, 38 insertions, 21 deletions
diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c
index 8665867c..10d0454c 100644
--- a/accel-pppd/radius/auth.c
+++ b/accel-pppd/radius/auth.c
@@ -147,9 +147,9 @@ static void rad_auth_finalize(struct radius_pd_t *rpd, int r)
{
hold_pd(rpd);
- rpd->auth_ctx->cb(rpd->auth_ctx->cb_arg, r);
-
if (rpd->auth_ctx) {
+ rpd->auth_ctx->cb(rpd->auth_ctx->cb_arg, r);
+
if (r == PWDB_SUCCESS) {
rpd->auth_reply = rpd->auth_ctx->req->reply;
rpd->auth_ctx->req->reply = NULL;
diff --git a/accel-pppd/radius/dict.c b/accel-pppd/radius/dict.c
index cb1fb28b..4924c895 100644
--- a/accel-pppd/radius/dict.c
+++ b/accel-pppd/radius/dict.c
@@ -76,7 +76,7 @@ static int dict_load(const char *fname)
struct rad_dict_value_t *val;
struct rad_dict_vendor_t *vendor;
struct list_head *items;
- struct list_head *parent_items;
+ struct list_head *parent_items = NULL;
f = fopen(fname, "r");
if (!f) {
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 139b8b81..9137f610 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -930,15 +930,19 @@ static int parse_server(const char *opt, in_addr_t *addr, int *port, char **secr
*p1 = 0;
if (p2)
*p2 = 0;
- else
+ else {
+ _free(str);
return -1;
+ }
*addr = inet_addr(str);
if (p1) {
*port = atoi(p1 + 1);
- if (*port <=0 )
+ if (*port <=0) {
+ _free(str);
return -1;
+ }
}
p1 = _strdup(p2 + 1);
@@ -1042,28 +1046,35 @@ static void radius_init(void)
const char *dict = NULL;
struct conf_sect_t *s = conf_get_section("radius");
- if (!s)
+ if (!s) {
+ log_emerg("radius: config section not found\n");
_exit(EXIT_FAILURE);
+ }
struct conf_option_t *opt1;
rpd_pool = mempool_create(sizeof(struct radius_pd_t));
auth_ctx_pool = mempool_create(sizeof(struct radius_auth_ctx));
- if (load_config())
+ if (load_config()) {
+ log_emerg("radius: config load failed\n");
_exit(EXIT_FAILURE);
-
+ }
list_for_each_entry(opt1, &s->items, entry) {
if (strcmp(opt1->name, "dictionary") || !opt1->val)
continue;
dict = opt1->val;
- if (rad_dict_load(dict))
+ if (rad_dict_load(dict)) {
+ log_emerg("radius: dictionary load failed\n");
_exit(0);
+ }
}
- if (!dict && rad_dict_load(DICTIONARY))
+ if (!dict && rad_dict_load(DICTIONARY)) {
+ log_emerg("radius: default dictionary load failed\n");
_exit(0);
+ }
pwdb_register(&pwdb);
ipdb_register(&ipdb);
diff --git a/accel-pppd/radius/radius.h b/accel-pppd/radius/radius.h
index 9fc8869d..6ca94fb0 100644
--- a/accel-pppd/radius/radius.h
+++ b/accel-pppd/radius/radius.h
@@ -80,7 +80,7 @@ struct rad_dict_attr_t
const char *name;
int id;
int type:30;
- int array:1;
+ unsigned int array:1;
int size;
struct list_head values;
struct list_head tlv;
@@ -94,7 +94,7 @@ struct rad_attr_t
//struct rad_dict_value_t *val;
int len;
int cnt;
- int alloc:1;
+ unsigned int alloc:1;
void *raw;
rad_value_t val;
};
@@ -106,7 +106,7 @@ struct rad_packet_t
int len;
struct timespec tv;
struct list_head attrs;
- void *buf;
+ uint8_t *buf;
};
struct rad_plugin_t
diff --git a/accel-pppd/radius/radius_p.h b/accel-pppd/radius/radius_p.h
index 0c185d28..14c1fb2f 100644
--- a/accel-pppd/radius/radius_p.h
+++ b/accel-pppd/radius/radius_p.h
@@ -47,10 +47,10 @@ struct radius_pd_t {
struct ap_session *ses;
pthread_mutex_t lock;
int refs:8;
- int authenticated:1;
- int acct_started:1;
- int ipv6_dp_assigned:1;
- int ipv6_dp_sent:1;
+ unsigned int authenticated:1;
+ unsigned int acct_started:1;
+ unsigned int ipv6_dp_assigned:1;
+ unsigned int ipv6_dp_sent:1;
struct rad_packet_t *auth_reply;
@@ -101,8 +101,8 @@ struct rad_req_t {
int prio;
int try;
- int active:1;
- int async:1;
+ unsigned int active:1;
+ unsigned int async:1;
time_t ts;
diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c
index 65af74d3..6d1eb4c6 100644
--- a/accel-pppd/radius/serv.c
+++ b/accel-pppd/radius/serv.c
@@ -197,6 +197,8 @@ int rad_server_req_enter(struct rad_req_t *req)
pthread_mutex_lock(&req->serv->lock);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+
if (ts.tv_sec < req->serv->fail_time) {
pthread_mutex_unlock(&req->serv->lock);
return -1;
@@ -616,15 +618,19 @@ static int parse_server_old(const char *opt, in_addr_t *addr, int *port, char **
*p1 = 0;
if (p2)
*p2 = 0;
- else
+ else {
+ _free(str);
return -1;
+ }
*addr = inet_addr(str);
if (p1) {
*port = atoi(p1 + 1);
- if (*port <=0 )
+ if (*port <=0) {
+ _free(str);
return -1;
+ }
}
*secret = _strdup(p2 + 1);