changeset 540:23736ebcbfbb

Previous commit provked a segfault, this fixes it.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Sat, 11 Sep 2010 09:21:16 +0900
parents 6994e9a3c528
children fac6907479ad
files extensions/app_radgw/radius.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/app_radgw/radius.c	Sat Sep 11 08:52:36 2010 +0900
+++ b/extensions/app_radgw/radius.c	Sat Sep 11 09:21:16 2010 +0900
@@ -356,12 +356,14 @@
 		    printf("WARNING: Could not add Message-Authenticator\n");
 		    return -1;
 	    }
+	    msg->hdr->length = htons(msg->buf_used);
+	    os_memcpy(msg->hdr->authenticator, req_authenticator,
+		      sizeof(msg->hdr->authenticator));
+	    hmac_md5(secret, secret_len, msg->buf, msg->buf_used,
+		     (u8 *) (attr + 1));
+	} else {
+	    msg->hdr->length = htons(msg->buf_used);
 	}
-	msg->hdr->length = htons(msg->buf_used);
-	os_memcpy(msg->hdr->authenticator, req_authenticator,
-		  sizeof(msg->hdr->authenticator));
-	hmac_md5(secret, secret_len, msg->buf, msg->buf_used,
-		 (u8 *) (attr + 1));
 
 	/* ResponseAuth = MD5(Code+ID+Length+RequestAuth+Attributes+Secret) */
 	addr[0] = (u8 *) msg->hdr;
"Welcome to our mercurial repository"