diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-08-17 11:21:11 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-08-17 21:21:50 +1000 |
commit | 6baa834ebe710d73cfd54e465479a2b2de9d2476 (patch) | |
tree | 07e98dfeb43179fc25684f2e80580dc558c5717d /source4/lib | |
parent | 527042f78bc1672ca9a2f766b232165fb2a81d9f (diff) | |
download | samba-6baa834ebe710d73cfd54e465479a2b2de9d2476.tar.gz samba-6baa834ebe710d73cfd54e465479a2b2de9d2476.tar.bz2 samba-6baa834ebe710d73cfd54e465479a2b2de9d2476.zip |
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 <abartlet@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 5 | ||||
-rw-r--r-- | source4/lib/registry/ldb.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index f3ec1ed606..6625d94dbd 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -110,6 +110,11 @@ struct ldb_dn; #define LDB_FLAG_MOD_MASK 0x3 /** + use this to extract the mod type from the operation + */ +#define LDB_FLAG_MOD_TYPE(flags) ((flags) & LDB_FLAG_MOD_MASK) + +/** Flag value used in ldap_modify() to indicate that attributes are being added. diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index c14ee70ace..91c6763902 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -830,7 +830,7 @@ static WERROR ldb_set_value(struct hive_key *parent, if (ret == LDB_ERR_NO_SUCH_OBJECT) { i = 0; while (i < msg->num_elements) { - if (msg->elements[i].flags == LDB_FLAG_MOD_DELETE) { + if (LDB_FLAG_MOD_TYPE(msg->elements[i].flags) == LDB_FLAG_MOD_DELETE) { ldb_msg_remove_element(msg, &msg->elements[i]); } else { ++i; |