2 * rlm_eap_md5.c Handles that are called from eap
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Copyright 2000,2001 The FreeRADIUS server project
21 * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
32 static int md5_attach(CONF_SECTION *conf, void **arg)
38 * send an initial eap-md5 request
39 * ie access challenge to the user/peer.
41 * Frame eap reply packet.
42 * len = header + type + md5_typedata
43 * md5_typedata = value_size + value
45 static int md5_initiate(void *type_arg, EAP_HANDLER *handler)
49 reply = eapmd5_initiate(handler->eap_ds);
53 eapmd5_compose(handler->eap_ds, reply);
59 static int md5_authenticate(void *arg, EAP_HANDLER *handler)
63 md5_packet_t *request;
69 * Password is never sent over the wire.
70 * Always get the configured password, for each user.
72 password = pairfind(handler->configured, PW_PASSWORD);
73 if (password == NULL) {
74 radlog(L_INFO, "rlm_eap_md5: No password configured for this user");
79 * Allocate memory AFTER doing sanity checks.
81 if (!(packet = eapmd5_extract(handler->eap_ds)))
84 username = (char *)handler->username->strvalue;
86 temp = (EAP_DS *)handler->prev_eapds;
87 request = temp?(md5_packet_t *)(temp->request->type.data):NULL;
88 reply = eapmd5_process(packet, handler->eap_ds->request->id,
89 handler->username, password, request);
95 eapmd5_compose(handler->eap_ds, reply);
102 static int md5_detach(void **arg)
108 * The module name should be the only globally exported symbol.
109 * That is, everything else should be 'static'.
111 EAP_TYPE rlm_eap_md5 = {
113 md5_attach, /* attach */
114 md5_initiate, /* Start the initial request, after Identity */
115 md5_authenticate, /* authentication */
116 md5_detach /* detach */