From 6baa834ebe710d73cfd54e465479a2b2de9d2476 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 17 Aug 2010 11:21:11 +1000 Subject: s4-ldb: use LDB_FLAG_MOD_TYPE() to extract element type from messages The flags field of message elements is part of a set of flags. We had LDB_FLAG_MOD_MASK for extracting the type, but it was only rarely being used (only 1 call used it correctly). This adds LDB_FLAG_MOD_MASK() to make it more obvious what is going on. This will allow us to use some of the other flags bits for internal markers on elements Pair-Programmed-With: Andrew Bartlett --- source4/dsdb/common/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/common') diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 701040f233..7fcc3bf0a4 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -766,7 +766,7 @@ int samdb_msg_find_old_and_new_ldb_val(const struct ldb_message *msg, for (i = 0; i < msg->num_elements; i++) { if (ldb_attr_cmp(msg->elements[i].name, name) == 0) { - if (msg->elements[i].flags == LDB_FLAG_MOD_DELETE) { + if (LDB_FLAG_MOD_TYPE(msg->elements[i].flags) == LDB_FLAG_MOD_DELETE) { *old_val = &msg->elements[i].values[0]; } else { *new_val = &msg->elements[i].values[0]; @@ -874,7 +874,7 @@ int samdb_msg_add_addval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, for (i = 0; i < msg->num_elements; i++) { el = &msg->elements[i]; if ((ldb_attr_cmp(el->name, attr_name) == 0) && - (el->flags == LDB_FLAG_MOD_ADD)) { + (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_ADD)) { found = true; break; } @@ -930,7 +930,7 @@ int samdb_msg_add_delval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, for (i = 0; i < msg->num_elements; i++) { el = &msg->elements[i]; if ((ldb_attr_cmp(el->name, attr_name) == 0) && - (el->flags == LDB_FLAG_MOD_DELETE)) { + (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_DELETE)) { found = true; break; } -- cgit