*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
- * Copyright 2000,2001 The FreeRADIUS server project
+ * Copyright 2000,2001,2006 The FreeRADIUS server project
* Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
*/
/*
*
* MD5 Packet Format in EAP Type-Data
- * --- ------ ------ -- --- ---------
+ * --- ------ ------ -- --- ---------
* 0 1 2 3
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
*/
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
+
#include <stdio.h>
#include <stdlib.h>
#include "eap.h"
*md5_packet_ptr = NULL;
}
-/*
+/*
* We expect only RESPONSE for which SUCCESS or FAILURE is sent back
- */
+ */
MD5_PACKET *eapmd5_extract(EAP_DS *eap_ds)
{
md5_packet_t *data;
* one byte of type data (EAP-MD5) following the 4-byte
* EAP-Packet header.
*/
- if (!eap_ds ||
- !eap_ds->response ||
+ if (!eap_ds ||
+ !eap_ds->response ||
(eap_ds->response->code != PW_MD5_RESPONSE) ||
eap_ds->response->type.type != PW_EAP_MD5 ||
!eap_ds->response->type.data ||
}
-/*
+/*
* verify = MD5(id+password+challenge_sent)
*/
-int eapmd5_verify(MD5_PACKET *packet, VALUE_PAIR* password,
+int eapmd5_verify(MD5_PACKET *packet, VALUE_PAIR* password,
uint8_t *challenge)
{
char *ptr;
*/
*ptr++ = packet->id;
len++;
- memcpy(ptr, password->strvalue, password->length);
+ memcpy(ptr, password->vp_strvalue, password->length);
ptr += password->length;
len += password->length;
memcpy(ptr, challenge, MD5_CHALLENGE_LEN);
len += MD5_CHALLENGE_LEN;
- librad_md5_calc((u_char *)output, (u_char *)string, len);
+ fr_md5_calc((u_char *)output, (u_char *)string, len);
/*
* The length of the response is always 16 for MD5.
return 1;
}
-/*
+/*
* Compose the portions of the reply packet specific to the
* EAP-MD5 protocol, in the EAP reply typedata
*/
eap_ds->request->type.type = PW_EAP_MD5;
rad_assert(reply->length > 0);
- rad_assert(reply->value_size < 256);
eap_ds->request->type.data = malloc(reply->length);
if (eap_ds->request->type.data == NULL) {
+ eapmd5_free(&reply);
radlog(L_ERR, "rlm_eap_md5: out of memory");
return 0;
}