diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2013-10-14 16:45:00 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-10-14 16:45:00 +0400 |
commit | e112b9a40ce02081d52cfc144a9842ff3b4cd8d4 (patch) | |
tree | 0a94c81f63c0311c3ee9a16606b0a7635664803f /accel-pppd | |
parent | 9265a505207b8eaa59202628ac93e4a45d155d62 (diff) | |
download | accel-ppp-e112b9a40ce02081d52cfc144a9842ff3b4cd8d4.tar.gz accel-ppp-e112b9a40ce02081d52cfc144a9842ff3b4cd8d4.zip |
radius: properly handle send failures
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/radius/acct.c | 10 | ||||
-rw-r--r-- | accel-pppd/radius/auth.c | 3 | ||||
-rw-r--r-- | accel-pppd/radius/req.c | 5 |
3 files changed, 12 insertions, 6 deletions
diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index 49c47fb3..161b959a 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -276,12 +276,14 @@ int rad_acct_start(struct radius_pd_t *rpd) if (conf_acct_delay_time) { time(&ts); rad_packet_change_int(rpd->acct_req->pack, NULL, "Acct-Delay-Time", ts - rpd->acct_timestamp); - if (req_set_RA(rpd->acct_req, rpd->acct_req->serv->secret)) + if (req_set_RA(rpd->acct_req, rpd->acct_req->serv->secret)) { + rad_server_req_exit(rpd->acct_req); goto out_err; + } } if (rad_req_send(rpd->acct_req, conf_verbose ? log_ppp_info1 : NULL)) - goto out_err; + goto out; __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_sent, 1); @@ -311,6 +313,7 @@ int rad_acct_start(struct radius_pd_t *rpd) break; } +out: rad_server_req_exit(rpd->acct_req); if (rpd->acct_req->reply) @@ -431,7 +434,7 @@ void rad_acct_stop(struct radius_pd_t *rpd) break; } if (rad_req_send(rpd->acct_req, conf_verbose ? log_ppp_info1 : NULL)) - break; + goto out; __sync_add_and_fetch(&rpd->acct_req->serv->stat_acct_sent, 1); rad_req_wait(rpd->acct_req, conf_timeout); if (!rpd->acct_req->reply) { @@ -456,6 +459,7 @@ void rad_acct_stop(struct radius_pd_t *rpd) break; } +out: rad_server_req_exit(rpd->acct_req); if (rpd->acct_req->reply) diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 37b72915..0efe1c6f 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -193,7 +193,7 @@ static int rad_auth_send(struct rad_req_t *req) stat_accm_add(req->serv->stat_auth_lost_5m, 1); } } - +out: rad_server_req_exit(req); if (!req->reply) { @@ -212,7 +212,6 @@ static int rad_auth_send(struct rad_req_t *req) } } -out: return PWDB_DENIED; } diff --git a/accel-pppd/radius/req.c b/accel-pppd/radius/req.c index 3224134f..70e0431f 100644 --- a/accel-pppd/radius/req.c +++ b/accel-pppd/radius/req.c @@ -146,7 +146,10 @@ struct rad_req_t *rad_req_alloc2(struct radius_pd_t *rpd, int code, const char * if (code == CODE_ACCOUNTING_REQUEST) req->server_port = req->serv->acct_port; - make_socket(req); + if (make_socket(req)) { + rad_req_free(req); + req = NULL; + } return req; } |