changeset 412:2d1f1c6ae1cd

Simplified algo to delete the handled attributes
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 15 Jun 2009 13:35:01 +0900
parents 7b3d4431610a
children 844f921713d5
files extensions/radius_gw/sub_auth.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/radius_gw/sub_auth.c	Thu Jun 11 18:08:17 2009 +0900
+++ b/extensions/radius_gw/sub_auth.c	Mon Jun 15 13:35:01 2009 +0900
@@ -100,7 +100,6 @@
 	int got_eap = 0;
 	int got_empty_eap = 0;
 	uint32_t status_type;
-	size_t *nattr_pos;
 	size_t nattr_used = 0;
 	dict_object_t * avp_tun_dict;
 	msg_avp_t ** avp_tun = NULL;
@@ -296,7 +295,6 @@
 	CHECK_FCT( dict_search( DICT_AVP, AVP_BY_NAME, "Tunneling", &avp_tun_dict, ENOENT));
 	
 	/* Convert the attributes one by one */
-	CHECK_MALLOC( nattr_pos = malloc(rad_req->attr_size * sizeof(size_t)) );
 	for (idx = 0; idx < rad_req->attr_used; idx++) {
 		struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]);
 		dict_object_t * avp_dict;
@@ -808,16 +806,14 @@
 		/* Default */		
 			default: /* unknown attribute */
 				/* We just keep the attribute in the RADIUS message */
-				nattr_pos[nattr_used++] = rad_req->attr_pos[idx];
+				rad_req->attr_pos[nattr_used++] = rad_req->attr_pos[idx];
 		}
 	}
 	
-	/* Destroy tunnel pointers in case we used it */
+	/* Destroy tunnel pointers (if we used it) */
 	free(avp_tun);
 	
 	/* Update the radius message to remove all handled attributes */
-	free(rad_req->attr_pos);
-	rad_req->attr_pos = nattr_pos;
 	rad_req->attr_used = nattr_used;
 
 	return 0;
"Welcome to our mercurial repository"