# HG changeset patch # User Sebastien Decugis # Date 1278323107 -32400 # Node ID 69057a6d68ec11cffadb810ad28b9f8075f4fd8f # Parent 75009e72a0ed3da4661c66c2cd6514fd5848f62b Fix a possible race condition diff -r 75009e72a0ed -r 69057a6d68ec extensions/app_radgw/rgw_worker.c --- a/extensions/app_radgw/rgw_worker.c Mon Jul 05 18:11:36 2010 +0900 +++ b/extensions/app_radgw/rgw_worker.c Mon Jul 05 18:45:07 2010 +0900 @@ -291,17 +291,18 @@ } } - /* Now try and send the RADIUS answer */ - if (rad_ans) { - CHECK_FCT_DO( rgw_client_finish_send(&rad_ans, pa->rad, pa->cli), goto out); - } - -out: + if (!keepsession) { /* Destroy remaining session data (stateless gateway) */ CHECK_FCT_DO( fd_sess_destroy(&pa->sess), ); } + /* Now try and send the RADIUS answer */ + if (rad_ans) { + CHECK_FCT_DO( rgw_client_finish_send(&rad_ans, pa->rad, pa->cli), ); + } + +out: /* Clear the Diameter message */ if (*ans) { CHECK_FCT_DO( fd_msg_free(*ans), ); diff -r 75009e72a0ed -r 69057a6d68ec extensions/app_radgw/rgwx_auth.c --- a/extensions/app_radgw/rgwx_auth.c Mon Jul 05 18:11:36 2010 +0900 +++ b/extensions/app_radgw/rgwx_auth.c Mon Jul 05 18:45:07 2010 +0900 @@ -1051,7 +1051,7 @@ rad_req->attr_used = nattr_used; /* Store the request identifier in the session (if provided) */ - if (session) { + if (*session) { unsigned char * req_auth; CHECK_MALLOC(req_auth = malloc(16)); memcpy(req_auth, &rad_req->hdr->authenticator[0], 16);