]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2020-25722 s4/dsdb/util: remove unused dsdb_get_single_valued_attr()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 21 Oct 2021 00:49:28 +0000 (13:49 +1300)
committerJule Anger <janger@samba.org>
Mon, 8 Nov 2021 09:52:11 +0000 (10:52 +0100)
Nobody uses it now. It never really did what it said it did. Almost
every use was wrong. It was a trap.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14876

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/util.c

index da152e4d7544d8406aad042905e7309691e7f2b9..4c67873643a2ca9ef32e579817525638cb56504b 100644 (file)
@@ -1562,40 +1562,6 @@ int dsdb_get_expected_new_values(TALLOC_CTX *mem_ctx,
        return LDB_SUCCESS;
 }
 
-/*
- * Gets back a single-valued attribute by the rules of the DSDB triggers when
- * performing a modify operation.
- *
- * In order that the constraint checking by the "objectclass_attrs" LDB module
- * does work properly, the change request should remain similar or only be
- * enhanced (no other modifications as deletions, variations).
- */
-struct ldb_message_element *dsdb_get_single_valued_attr(const struct ldb_message *msg,
-                                                       const char *attr_name,
-                                                       enum ldb_request_type operation)
-{
-       struct ldb_message_element *el = NULL;
-       unsigned int i;
-
-       /* We've to walk over all modification entries and consider the last
-        * non-delete one which belongs to "attr_name".
-        *
-        * If "el" is NULL afterwards then that means there was no interesting
-        * change entry. */
-       for (i = 0; i < msg->num_elements; i++) {
-               if (ldb_attr_cmp(msg->elements[i].name, attr_name) == 0) {
-                       if ((operation == LDB_MODIFY) &&
-                           (LDB_FLAG_MOD_TYPE(msg->elements[i].flags)
-                                               == LDB_FLAG_MOD_DELETE)) {
-                               continue;
-                       }
-                       el = &msg->elements[i];
-               }
-       }
-
-       return el;
-}
-
 /*
  * This function determines the (last) structural or 88 object class of a passed
  * "objectClass" attribute - per MS-ADTS 3.1.1.1.4 this is the last value.