diff extensions/app_radgw/radius.c @ 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 2c097ed9d0ea
children 23736ebcbfbb
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,
"Welcome to our mercurial repository"