From: Alan T. DeKok Date: Tue, 18 Dec 2018 16:41:39 +0000 (-0500) Subject: Revert "add '&' if it's not already there" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4c8a0666b3cf9d6fa5e4209592d8fca1b50aa19;p=thirdparty%2Ffreeradius-server.git Revert "add '&' if it's not already there" This reverts commit 8966bfdf901c06c84762ae8aaa0d37084f9eb0b4. --- diff --git a/src/lib/ldap/map.c b/src/lib/ldap/map.c index ebc36d6f3fa..df845b85bd7 100644 --- a/src/lib/ldap/map.c +++ b/src/lib/ldap/map.c @@ -75,28 +75,14 @@ int fr_ldap_map_getvalue(TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, vp fr_box_strvalue_len(self->values[i]->bv_val, self->values[i]->bv_len)); /* - * The data in LDAP *must* be attribute - * names. If there isn't a leading '&', - * just add one... + * bv_val is NOT \0 terminated, so we need to make it + * safe (\0 terminate it) before passing it to any + * functions which take C strings and no lengths. */ - if (self->values[i]->bv_val[0] != '&') { - attr_str = talloc_zero_array(NULL, char, self->values[i]->bv_len + 2); - if (!attr_str) goto alloc_fail; - - attr_str[0] = '&'; - memcpy(attr_str + 1, self->values[i]->bv_val, self->values[i]->bv_len); - } else { - /* - * bv_val is NOT \0 terminated, so we need to make it - * safe (\0 terminate it) before passing it to any - * functions which take C strings and no lengths. - */ - attr_str = talloc_bstrndup(NULL, self->values[i]->bv_val, self->values[i]->bv_len); - if (!attr_str) { - alloc_fail: - RWDEBUG("Failed making attribute string safe"); - continue; - } + attr_str = talloc_bstrndup(NULL, self->values[i]->bv_val, self->values[i]->bv_len); + if (!attr_str) { + RWDEBUG("Failed making attribute string safe"); + continue; } if (map_afrom_attr_str(ctx, &attr,