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;
68 if (!(packet = eapmd5_extract(handler->eap_ds)))
71 username = (char *)handler->username->strvalue;
74 * Password is never sent over the wire.
75 * Always get the configured password, for each user.
77 password = paircopy2(handler->configured, PW_PASSWORD);
78 if (password == NULL) {
79 radlog(L_INFO, "rlm_eap_md5: No password configured for this user");
84 temp = (EAP_DS *)handler->prev_eapds;
85 request = temp?(md5_packet_t *)(temp->request->type.data):NULL;
86 reply = eapmd5_process(packet, handler->eap_ds->request->id,
87 handler->username, password, request);
93 eapmd5_compose(handler->eap_ds, reply);
100 static int md5_detach(void **arg)
106 * The module name should be the only globally exported symbol.
107 * That is, everything else should be 'static'.
109 EAP_TYPE rlm_eap_md5 = {
111 md5_attach, /* attach */
112 md5_initiate, /* Start the initial request, after Identity */
113 md5_authenticate, /* authentication */
114 md5_detach /* detach */