1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-01 05:47:28 +03:00

CVE-2020-25722 s4/dsdb/util: remove unused dsdb_get_single_valued_attr()

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>
This commit is contained in:
Douglas Bagnall 2021-10-21 13:49:28 +13:00 committed by Jule Anger
parent b9962c1e5e
commit 5fe2633b2a

View File

@ -1564,40 +1564,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.