mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s4:dsdb: Access correct member of union
Accessing the wrong member of a union invokes undefined behaviour. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
3e076b374b
commit
0a202264d3
@ -5902,10 +5902,14 @@ bool dsdb_attr_in_parse_tree(struct ldb_parse_tree *tree,
|
||||
case LDB_OP_NOT:
|
||||
return dsdb_attr_in_parse_tree(tree->u.isnot.child, attr);
|
||||
case LDB_OP_EQUALITY:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, attr) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case LDB_OP_GREATER:
|
||||
case LDB_OP_LESS:
|
||||
case LDB_OP_APPROX:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, attr) == 0) {
|
||||
if (ldb_attr_cmp(tree->u.comparison.attr, attr) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -252,18 +252,27 @@ static int ldb_parse_tree_collect_acl_attrs(const struct ldb_module *module,
|
||||
return 0;
|
||||
}
|
||||
|
||||
FALL_THROUGH;
|
||||
case LDB_OP_EQUALITY:
|
||||
if (ldb_attr_always_visible(tree->u.present.attr)) {
|
||||
/* No need to check this attribute. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
FALL_THROUGH;
|
||||
break;
|
||||
|
||||
case LDB_OP_EQUALITY:
|
||||
if (ldb_attr_always_visible(tree->u.equality.attr)) {
|
||||
/* No need to check this attribute. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: /* single attribute in tree */
|
||||
attr = ldb_parse_tree_get_attr(tree);
|
||||
return attr_vec_add_unique(mem_ctx, attrs, attr);
|
||||
break;
|
||||
}
|
||||
|
||||
attr = ldb_parse_tree_get_attr(tree);
|
||||
return attr_vec_add_unique(mem_ctx, attrs, attr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -296,10 +296,14 @@ static int parse_tree_anr_present(struct ldb_parse_tree *tree, void *private_con
|
||||
struct anr_present_ctx *ctx = private_context;
|
||||
switch (tree->operation) {
|
||||
case LDB_OP_EQUALITY:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, ctx->attr) == 0) {
|
||||
ctx->found_anr = true;
|
||||
}
|
||||
break;
|
||||
case LDB_OP_GREATER:
|
||||
case LDB_OP_LESS:
|
||||
case LDB_OP_APPROX:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, ctx->attr) == 0) {
|
||||
if (ldb_attr_cmp(tree->u.comparison.attr, ctx->attr) == 0) {
|
||||
ctx->found_anr = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1696,10 +1696,14 @@ static int operational_present(struct ldb_parse_tree *tree, void *private_contex
|
||||
struct operational_present_ctx *ctx = private_context;
|
||||
switch (tree->operation) {
|
||||
case LDB_OP_EQUALITY:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, ctx->attr) == 0) {
|
||||
ctx->found_operational = true;
|
||||
}
|
||||
break;
|
||||
case LDB_OP_GREATER:
|
||||
case LDB_OP_LESS:
|
||||
case LDB_OP_APPROX:
|
||||
if (ldb_attr_cmp(tree->u.equality.attr, ctx->attr) == 0) {
|
||||
if (ldb_attr_cmp(tree->u.comparison.attr, ctx->attr) == 0) {
|
||||
ctx->found_operational = true;
|
||||
}
|
||||
break;
|
||||
|
@ -111,11 +111,14 @@ static int resolve_oids_parse_tree_need(struct ldb_context *ldb,
|
||||
return resolve_oids_parse_tree_need(ldb, schema,
|
||||
tree->u.isnot.child);
|
||||
case LDB_OP_EQUALITY:
|
||||
attr = tree->u.equality.attr;
|
||||
valp = &tree->u.equality.value;
|
||||
break;
|
||||
case LDB_OP_GREATER:
|
||||
case LDB_OP_LESS:
|
||||
case LDB_OP_APPROX:
|
||||
attr = tree->u.equality.attr;
|
||||
valp = &tree->u.equality.value;
|
||||
attr = tree->u.comparison.attr;
|
||||
valp = &tree->u.comparison.value;
|
||||
break;
|
||||
case LDB_OP_SUBSTRING:
|
||||
attr = tree->u.substring.attr;
|
||||
@ -300,11 +303,14 @@ static int resolve_oids_parse_tree_replace(struct ldb_context *ldb,
|
||||
return resolve_oids_parse_tree_replace(ldb, schema,
|
||||
tree->u.isnot.child);
|
||||
case LDB_OP_EQUALITY:
|
||||
attrp = &tree->u.equality.attr;
|
||||
valp = &tree->u.equality.value;
|
||||
break;
|
||||
case LDB_OP_GREATER:
|
||||
case LDB_OP_LESS:
|
||||
case LDB_OP_APPROX:
|
||||
attrp = &tree->u.equality.attr;
|
||||
valp = &tree->u.equality.value;
|
||||
attrp = &tree->u.comparison.attr;
|
||||
valp = &tree->u.comparison.value;
|
||||
break;
|
||||
case LDB_OP_SUBSTRING:
|
||||
attrp = &tree->u.substring.attr;
|
||||
|
Loading…
Reference in New Issue
Block a user