changeset 539:6994e9a3c528

The previous commit provoked an Accounting-Response with empty authenticator... Should be fixed now.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Sat, 11 Sep 2010 08:52:36 +0900
parents deb901984ce3
children 23736ebcbfbb
files extensions/app_radgw/radius.c extensions/app_radgw/rgw_clients.c
diffstat 2 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/app_radgw/radius.c	Fri Sep 10 23:10:17 2010 +0900
+++ b/extensions/app_radgw/radius.c	Sat Sep 11 08:52:36 2010 +0900
@@ -348,12 +348,14 @@
 	const u8 *addr[4];
 	size_t len[4];
 
-	os_memset(auth, 0, MD5_MAC_LEN);
-	attr = radius_msg_add_attr(msg, RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
-				   auth, MD5_MAC_LEN);
-	if (attr == NULL) {
-		printf("WARNING: Could not add Message-Authenticator\n");
-		return -1;
+	if (msg->hdr->code != RADIUS_CODE_ACCOUNTING_RESPONSE) {
+	    os_memset(auth, 0, MD5_MAC_LEN);
+	    attr = radius_msg_add_attr(msg, RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
+				       auth, MD5_MAC_LEN);
+	    if (attr == NULL) {
+		    printf("WARNING: Could not add Message-Authenticator\n");
+		    return -1;
+	    }
 	}
 	msg->hdr->length = htons(msg->buf_used);
 	os_memcpy(msg->hdr->authenticator, req_authenticator,
--- a/extensions/app_radgw/rgw_clients.c	Fri Sep 10 23:10:17 2010 +0900
+++ b/extensions/app_radgw/rgw_clients.c	Sat Sep 11 08:52:36 2010 +0900
@@ -840,14 +840,12 @@
 		return ENOTSUP;
 	}
 	
-	if ((*msg)->hdr->code != RADIUS_CODE_ACCOUNTING_RESPONSE) {
-	    if (radius_msg_finish_srv(*msg, cli->key.data, cli->key.len, req->radius.hdr->authenticator)) {
-		    TRACE_DEBUG(INFO, "An error occurred while preparing the RADIUS answer");
-		    radius_msg_free(*msg);
-		    free(*msg);
-		    *msg = NULL;
-		    return EINVAL;
-	    }
+	if (radius_msg_finish_srv(*msg, cli->key.data, cli->key.len, req->radius.hdr->authenticator)) {
+		TRACE_DEBUG(INFO, "An error occurred while preparing the RADIUS answer");
+		radius_msg_free(*msg);
+		free(*msg);
+		*msg = NULL;
+		return EINVAL;
 	}
 	
 	/* Debug */
"Welcome to our mercurial repository"