comparison 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
comparison
equal deleted inserted replaced
538:deb901984ce3 539:6994e9a3c528
346 u8 auth[MD5_MAC_LEN]; 346 u8 auth[MD5_MAC_LEN];
347 struct radius_attr_hdr *attr; 347 struct radius_attr_hdr *attr;
348 const u8 *addr[4]; 348 const u8 *addr[4];
349 size_t len[4]; 349 size_t len[4];
350 350
351 os_memset(auth, 0, MD5_MAC_LEN); 351 if (msg->hdr->code != RADIUS_CODE_ACCOUNTING_RESPONSE) {
352 attr = radius_msg_add_attr(msg, RADIUS_ATTR_MESSAGE_AUTHENTICATOR, 352 os_memset(auth, 0, MD5_MAC_LEN);
353 auth, MD5_MAC_LEN); 353 attr = radius_msg_add_attr(msg, RADIUS_ATTR_MESSAGE_AUTHENTICATOR,
354 if (attr == NULL) { 354 auth, MD5_MAC_LEN);
355 printf("WARNING: Could not add Message-Authenticator\n"); 355 if (attr == NULL) {
356 return -1; 356 printf("WARNING: Could not add Message-Authenticator\n");
357 return -1;
358 }
357 } 359 }
358 msg->hdr->length = htons(msg->buf_used); 360 msg->hdr->length = htons(msg->buf_used);
359 os_memcpy(msg->hdr->authenticator, req_authenticator, 361 os_memcpy(msg->hdr->authenticator, req_authenticator,
360 sizeof(msg->hdr->authenticator)); 362 sizeof(msg->hdr->authenticator));
361 hmac_md5(secret, secret_len, msg->buf, msg->buf_used, 363 hmac_md5(secret, secret_len, msg->buf, msg->buf_used,
"Welcome to our mercurial repository"