From: Alan T. DeKok Date: Fri, 5 Sep 2014 13:39:17 +0000 (-0400) Subject: map->dst->tmpl_da can be NULL if it's not TMPL_TYPE_ATTR X-Git-Tag: release_3_0_5~618 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfeb3e8d1627e466d621bf5876651b9c9bcb197d;p=thirdparty%2Ffreeradius-server.git map->dst->tmpl_da can be NULL if it's not TMPL_TYPE_ATTR --- diff --git a/src/main/map.c b/src/main/map.c index 2bd56afbbd8..b43507275ef 100644 --- a/src/main/map.c +++ b/src/main/map.c @@ -623,10 +623,18 @@ int map_to_vp(VALUE_PAIR **out, REQUEST *request, value_pair_map_t const *map, U { vp_cursor_t from; - rad_assert(!map->dst->tmpl_da || - (map->src->tmpl_da->type == map->dst->tmpl_da->type) || - (map->src->tmpl_da->type == PW_TYPE_OCTETS) || - (map->dst->tmpl_da->type == PW_TYPE_OCTETS)); + if (map->dst->type != TMPL_TYPE_ATTR) { + rad_assert(map->dst->tmpl_da == NULL); + } else { + rad_assert(map->dst->tmpl_da != NULL); + + /* + * Matching type, OR src/dst is octets. + */ + rad_assert((map->src->tmpl_da->type == map->dst->tmpl_da->type) || + (map->src->tmpl_da->type == PW_TYPE_OCTETS) || + (map->dst->tmpl_da->type == PW_TYPE_OCTETS)); + } /* * @todo should log error, and return -1 for v3.1 (causes update to fail) @@ -634,11 +642,13 @@ int map_to_vp(VALUE_PAIR **out, REQUEST *request, value_pair_map_t const *map, U if (tmpl_copy_vps(request, &found, request, map->src) < 0) return 0; vp = fr_cursor_init(&from, &found); + /* * Src/Dst attributes don't match, convert src attributes * to match dst. */ - if (map->src->tmpl_da->type != map->dst->tmpl_da->type) { + if ((map->dst->type == TMPL_TYPE_ATTR) && + (map->src->tmpl_da->type != map->dst->tmpl_da->type)) { vp_cursor_t to; (void) fr_cursor_init(&to, out);