1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-22 16:23:49 +03:00

CVE-2023-0614 ldb: Add ldb_parse_tree_get_attr()

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

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton
2023-03-03 17:31:54 +13:00
committed by Andrew Bartlett
parent f995c3805d
commit fdeb6ea15c
3 changed files with 29 additions and 0 deletions

View File

@@ -997,3 +997,28 @@ struct ldb_parse_tree *ldb_parse_tree_copy_shallow(TALLOC_CTX *mem_ctx,
return nt;
}
/* Get the attribute (if any) associated with the top node of a parse tree. */
const char *ldb_parse_tree_get_attr(const struct ldb_parse_tree *tree)
{
switch (tree->operation) {
case LDB_OP_AND:
case LDB_OP_OR:
case LDB_OP_NOT:
return NULL;
case LDB_OP_EQUALITY:
return tree->u.equality.attr;
case LDB_OP_SUBSTRING:
return tree->u.substring.attr;
case LDB_OP_GREATER:
case LDB_OP_LESS:
case LDB_OP_APPROX:
return tree->u.comparison.attr;
case LDB_OP_PRESENT:
return tree->u.present.attr;
case LDB_OP_EXTENDED:
return tree->u.extended.attr;
}
return NULL;
}