s4:dsdb Use ldb_match_msg_objectclass in operational.c
authorAndrew Bartlett <abartlet@samba.org>
Mon, 7 Dec 2009 04:28:51 +0000 (15:28 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 7 Dec 2009 04:28:51 +0000 (15:28 +1100)
This avoids not only a possibly non-portable compiler expression, but
also the need to look up the schema each time.

Andrew Bartlett

source4/dsdb/samdb/ldb_modules/operational.c

index 161de8449e78a6c1e7592d407a8bec4a8f9aab8a..badc0c5fa152ae03ae2c9cc7fc7274527d2cff76 100644 (file)
@@ -100,16 +100,11 @@ static int construct_canonical_name(struct ldb_module *module,
 static int construct_primary_group_token(struct ldb_module *module,
                                         struct ldb_message *msg)
 {
-       struct ldb_parse_tree objectclass_is_group = {
-               .operation = LDB_OP_EQUALITY,
-               .u.equality.attr = "objectClass", 
-               .u.equality.value = data_blob_string_const("group")
-       };
        struct ldb_context *ldb;
        uint32_t primary_group_token;
        
        ldb = ldb_module_get_ctx(module);
-       if (ldb_match_msg(ldb, msg, &objectclass_is_group, msg->dn, LDB_SCOPE_BASE) == 1) {
+       if (ldb_match_msg_objectclass(msg, "group") == 1) {
                primary_group_token
                        = samdb_result_rid_from_sid(ldb, msg, "objectSid", 0);
                if (primary_group_token == 0) {