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>
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;
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);
}
/*
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;
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;
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;
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;