~ubuntu-branches/ubuntu/feisty/freeradius/feisty-security

« back to all changes in this revision

Viewing changes to src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-12-16 20:45:11 UTC
  • mfrom: (3.1.10 feisty)
  • Revision ID: james.westby@ubuntu.com-20061216204511-3pbbsu4s8jtehsor
Tags: 1.1.3-3
Fix POSIX compliance problem in init script.  Closes: #403384. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * eap_leap.c  EAP LEAP functionality.
3
3
 *
4
 
 * Version:     $Id: eap_leap.c,v 1.7 2004/05/28 07:20:15 phampson Exp $
 
4
 * Version:     $Id: eap_leap.c,v 1.7.4.1 2006/02/06 16:23:54 nbk Exp $
5
5
 *
6
6
 *   This program is free software; you can redistribute it and/or modify
7
7
 *   it under the terms of the GNU General Public License as published by
195
195
/*
196
196
 *  Get the NT-Password hash.
197
197
 */
198
 
static void eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
 
198
static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
199
199
{
200
200
        if (password->attribute == PW_PASSWORD) {
201
201
                int i;
219
219
                md4_calc(ntpwdhash, unicode, password->length * 2);
220
220
 
221
221
        } else {                /* MUST be NT-Password */
222
 
                /*
223
 
                 *      FIXME: Check for broken (32-character)
224
 
                 *      NT-Password's?
225
 
                 */
 
222
                if (password->length == 32) {
 
223
                        password->length = lrad_hex2bin(password->strvalue,
 
224
                                                        password->strvalue,
 
225
                                                        16);
 
226
                }
 
227
                if (password->length != 16) {
 
228
                        radlog(L_ERR, "rlm_eap_leap: Bad NT-Password");
 
229
                        return 0;
 
230
                }
 
231
 
226
232
                memcpy(ntpwdhash, password->strvalue, 16);
227
233
        }
 
234
        return 1;
228
235
}
229
236
 
230
237
 
245
252
                return 0;
246
253
        }
247
254
 
248
 
        eapleap_ntpwdhash(ntpwdhash, password);
 
255
        if (!eapleap_ntpwdhash(ntpwdhash, password)) {
 
256
                return 0;
 
257
        }
249
258
 
250
259
        /*
251
260
         *      Calculate and verify the CHAP challenge.
316
325
        /*
317
326
         *  MPPE hash = ntpwdhash(ntpwdhash(unicode(pw)))
318
327
         */
319
 
        eapleap_ntpwdhash(ntpwdhash, password);
 
328
        if (!eapleap_ntpwdhash(ntpwdhash, password)) {
 
329
                eapleap_free(&reply);
 
330
                return NULL;
 
331
        }
320
332
        md4_calc(ntpwdhashhash, ntpwdhash, 16);
321
333
 
322
334
        /*
372
384
 *      If an EAP LEAP request needs to be initiated then
373
385
 *      create such a packet.
374
386
 */
375
 
LEAP_PACKET *eapleap_initiate(EAP_DS *eap_ds, VALUE_PAIR *user_name)
 
387
LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
376
388
{
377
389
        int i;
378
390
        LEAP_PACKET     *reply;