changeset 385:69057a6d68ec

Fix a possible race condition
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 05 Jul 2010 18:45:07 +0900
parents 75009e72a0ed
children ce8d20725308
files extensions/app_radgw/rgw_worker.c extensions/app_radgw/rgwx_auth.c
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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),  );
--- 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);
"Welcome to our mercurial repository"