"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c" between
freeradius-server-3.0.22.tar.bz2 and freeradius-server-3.0.23.tar.bz2

About: FreeRADIUS Server Project - a high performance and highly configurable RADIUS server.

ttls.c  (freeradius-server-3.0.22.tar.bz2):ttls.c  (freeradius-server-3.0.23.tar.bz2)
/* /*
* rlm_eap_ttls.c contains the interfaces that are called from eap * rlm_eap_ttls.c contains the interfaces that are called from eap
* *
* Version: $Id: 4e01134af5a37ca6f4e1b7b4605cbf09a5123f67 $ * Version: $Id: cbe423951a7a27f5da1ded6eb12fd7e9587ccaed $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* *
* Copyright 2003 Alan DeKok <aland@freeradius.org> * Copyright 2003 Alan DeKok <aland@freeradius.org>
* Copyright 2006 The FreeRADIUS server project * Copyright 2006 The FreeRADIUS server project
*/ */
RCSID("$Id: 4e01134af5a37ca6f4e1b7b4605cbf09a5123f67 $") RCSID("$Id: cbe423951a7a27f5da1ded6eb12fd7e9587ccaed $")
#include "eap_ttls.h" #include "eap_ttls.h"
#include "eap_chbind.h" #include "eap_chbind.h"
/* /*
* 0 1 2 3 * 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 * 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
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | AVP Code | * | AVP Code |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
skipping to change at line 147 skipping to change at line 147
static VALUE_PAIR *diameter2vp(REQUEST *request, REQUEST *fake, SSL *ssl, static VALUE_PAIR *diameter2vp(REQUEST *request, REQUEST *fake, SSL *ssl,
uint8_t const *data, size_t data_len) uint8_t const *data, size_t data_len)
{ {
uint32_t attr; uint32_t attr;
uint32_t vendor; uint32_t vendor;
uint32_t length; uint32_t length;
size_t offset; size_t offset;
size_t size; size_t size;
size_t data_left = data_len; size_t data_left = data_len;
VALUE_PAIR *first = NULL; VALUE_PAIR *first = NULL;
VALUE_PAIR *vp; VALUE_PAIR *vp = NULL;
RADIUS_PACKET *packet = fake->packet; /* FIXME: api issues */ RADIUS_PACKET *packet = fake->packet; /* FIXME: api issues */
vp_cursor_t out; vp_cursor_t out;
DICT_ATTR const *da;
fr_cursor_init(&out, &first); fr_cursor_init(&out, &first);
/* /*
* Parse while there's still data. * Parse while there's still data.
*/ */
while (data_left >= 9) { while (data_left >= 9) {
size_t attr_len; size_t attr_len;
rad_assert(data_left <= data_len); rad_assert(data_left <= data_len);
skipping to change at line 260 skipping to change at line 261
buffer[0] = PW_VENDOR_SPECIFIC; buffer[0] = PW_VENDOR_SPECIFIC;
buffer[1] = size + 2; buffer[1] = size + 2;
memcpy(buffer + 2, data, size); memcpy(buffer + 2, data, size);
vp = NULL; vp = NULL;
decoded = rad_attr2vp(packet, NULL, NULL, NULL, decoded = rad_attr2vp(packet, NULL, NULL, NULL,
buffer, size + 2, &vp); buffer, size + 2, &vp);
if (decoded < 0) { if (decoded < 0) {
REDEBUG2("diameter2vp failed decoding attr: %s", REDEBUG2("diameter2vp failed decoding attr: %s",
fr_strerror()); fr_strerror());
goto do_octets; goto raw;
} }
if ((size_t) decoded != size + 2) { if ((size_t) decoded != size + 2) {
REDEBUG2("diameter2vp failed to entirely decode V SA"); REDEBUG2("diameter2vp failed to entirely decode V SA");
fr_pair_list_free(&vp); fr_pair_list_free(&vp);
goto do_octets; goto raw;
} }
fr_cursor_merge(&out, vp); fr_cursor_merge(&out, vp);
goto next_attr; goto next_attr;
} }
/* /*
* Create it. If this fails, it's because we're OOM. * Create it. If this fails, it's because we're OOM.
*/ */
do_octets: da = dict_attrbyvalue(attr, vendor);
vp = fr_pair_afrom_num(packet, attr, vendor); if (!da) goto raw;
vp = fr_pair_afrom_da(packet, da);
if (!vp) { if (!vp) {
RDEBUG2("Failure in creating VP"); RDEBUG2("Failure in creating VP");
fr_pair_list_free(&first); fr_pair_list_free(&first);
return NULL; return NULL;
} }
/* /*
* If it's a type from our dictionary, then * If it's a type from our dictionary, then
* we need to put the data in a relevant place. * we need to put the data in a relevant place.
* *
* @todo: Export the lib/radius.c decoder, and use it here! * @todo: Export the lib/radius.c decoder, and use it here!
*/ */
switch (vp->da->type) { switch (vp->da->type) {
case PW_TYPE_INTEGER: case PW_TYPE_INTEGER:
case PW_TYPE_DATE: case PW_TYPE_DATE:
if (size != vp->vp_length) { if (size != vp->vp_length) {
DICT_ATTR const *da;
/* /*
* Bad format. Create a "raw" * Bad format. Create a "raw"
* attribute. * attribute.
*/ */
raw: raw:
if (vp) fr_pair_list_free(&vp); if (vp) fr_pair_list_free(&vp);
da = dict_unknown_afrom_fields(packet, attr, vend or); da = dict_unknown_afrom_fields(packet, attr, vend or);
if (!da) return NULL; if (!da) return NULL;
vp = fr_pair_afrom_da(packet, da); vp = fr_pair_afrom_da(packet, da);
if (!vp) return NULL; if (!vp) return NULL;
 End of changes. 8 change blocks. 
9 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)