static struct ldb_parse_tree *build_equality_operation(
	TALLOC_CTX *mem_ctx,
	bool add_asterix,     /* prepend an '*' to the name          */
	const uint8_t *name,  /* the value being matched             */
	const char *attr,     /* the attribute to check name against */
	size_t size)          /* length of name                      */
{

	struct ldb_parse_tree *el = NULL;  /* Equality node being built */
	struct ldb_val *value = NULL;      /* Value the attr will be compared
					      with */
	size_t length = 0;                 /* calculated length of the value
	                                      including option '*' prefix and
					      '\0' string terminator */

	el = talloc(mem_ctx, struct ldb_parse_tree);
	if (el == NULL) {
		DBG_ERR("Unable to allocate ldb_parse_tree\n");
		return NULL;
	}

	el->operation = LDB_OP_EQUALITY;
	el->u.equality.attr = talloc_strdup(mem_ctx, attr);
	value = &el->u.equality.value;
	length = (add_asterix) ? size + 2 : size + 1;
	value->data = talloc_zero_array(el, uint8_t, length);
	if (value->data == NULL) {
		DBG_ERR("Unable to allocate value->data\n");
		TALLOC_FREE(el);
		return NULL;
	}

	value->length = length;
	if (add_asterix) {
		value->data[0] = '*';
		if (name != NULL) {
			memcpy(&value->data[1], name, size);
		}
	} else if (name != NULL) {
		memcpy(value->data, name, size);
	}
	return el;
}
static struct ldb_parse_tree *build_equality_operation(
	TALLOC_CTX *mem_ctx,
	bool add_asterix,      
	const uint8_t *name,   
	const char *attr,      
	size_t size)           
{

	struct ldb_parse_tree *el = NULL;   
	struct ldb_val *value = NULL;       
	size_t length = 0;                  

	el = talloc(mem_ctx, struct ldb_parse_tree);
	if (el == NULL) {
		DBG_ERR("Unable to allocate ldb_parse_tree\n");
		return NULL;
	}

	el->operation = LDB_OP_EQUALITY;
	el->u.equality.attr = talloc_strdup(mem_ctx, attr);
	value = &el->u.equality.value;
	length = (add_asterix) ? size + 2 : size + 1;
	value->data = talloc_zero_array(el, uint8_t, length);
	if (value->data == NULL) {
		DBG_ERR("Unable to allocate value->data\n");
		TALLOC_FREE(el);
		return NULL;
	}

	value->length = length;
	if (add_asterix) {
		value->data[0] = '*';
		if (name != NULL) {
			memcpy(&value->data[1], name, size);
		}
	} else if (name != NULL) {
		memcpy(value->data, name, size);
	}
	return el;
}