]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "add '&' if it's not already there"
authorAlan T. DeKok <aland@freeradius.org>
Tue, 18 Dec 2018 16:41:39 +0000 (11:41 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 18 Dec 2018 16:41:39 +0000 (11:41 -0500)
This reverts commit 8966bfdf901c06c84762ae8aaa0d37084f9eb0b4.

src/lib/ldap/map.c

index ebc36d6f3fa200d1476f3ee9104152c94908a3ac..df845b85bd712cbc7bc4c74f212dd5cf77beca66 100644 (file)
@@ -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,