comparison extensions/app_radgw/radius.c @ 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 4c935aecee6c
comparison
equal deleted inserted replaced
539:6994e9a3c528 540:23736ebcbfbb
354 auth, MD5_MAC_LEN); 354 auth, MD5_MAC_LEN);
355 if (attr == NULL) { 355 if (attr == NULL) {
356 printf("WARNING: Could not add Message-Authenticator\n"); 356 printf("WARNING: Could not add Message-Authenticator\n");
357 return -1; 357 return -1;
358 } 358 }
359 } 359 msg->hdr->length = htons(msg->buf_used);
360 msg->hdr->length = htons(msg->buf_used); 360 os_memcpy(msg->hdr->authenticator, req_authenticator,
361 os_memcpy(msg->hdr->authenticator, req_authenticator, 361 sizeof(msg->hdr->authenticator));
362 sizeof(msg->hdr->authenticator)); 362 hmac_md5(secret, secret_len, msg->buf, msg->buf_used,
363 hmac_md5(secret, secret_len, msg->buf, msg->buf_used, 363 (u8 *) (attr + 1));
364 (u8 *) (attr + 1)); 364 } else {
365 msg->hdr->length = htons(msg->buf_used);
366 }
365 367
366 /* ResponseAuth = MD5(Code+ID+Length+RequestAuth+Attributes+Secret) */ 368 /* ResponseAuth = MD5(Code+ID+Length+RequestAuth+Attributes+Secret) */
367 addr[0] = (u8 *) msg->hdr; 369 addr[0] = (u8 *) msg->hdr;
368 len[0] = 1 + 1 + 2; 370 len[0] = 1 + 1 + 2;
369 addr[1] = req_authenticator; 371 addr[1] = req_authenticator;
"Welcome to our mercurial repository"