s4-cracknames: use consistent search for crossRef objects
authorAndrew Tridgell <tridge@samba.org>
Wed, 7 Sep 2011 07:18:24 +0000 (17:18 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 8 Sep 2011 03:02:54 +0000 (05:02 +0200)
This matches the search in other places

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Sep  8 05:02:54 CEST 2011 on sn-devel-104

source4/dsdb/samdb/cracknames.c

index 105de560566487461af53f62d3f7cfba9084378e..56655ffaeb58cc012c1b83a1164233fbfe8a5272 100644 (file)
@@ -442,8 +442,10 @@ WERROR DsCrackNameOneName(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
                s[0] = '\0';
                s++;
 
                s[0] = '\0';
                s++;
 
-               domain_filter = talloc_asprintf(mem_ctx, "(&(objectClass=crossRef)(ncName=%s))", 
-                                               ldb_dn_get_linearized(samdb_dns_domain_to_dn(sam_ctx, mem_ctx, str)));
+               domain_filter = talloc_asprintf(mem_ctx, "(&(objectClass=crossRef)(dnsRoot=%s)(systemFlags:%s:=%u))",
+                                               ldb_binary_encode_string(mem_ctx, str),
+                                               LDB_OID_COMPARATOR_AND,
+                                               SYSTEM_FLAG_CR_NTDS_DOMAIN);
                W_ERROR_HAVE_NO_MEMORY(domain_filter);
 
                /* There may not be anything after the domain component (search for the domain itself) */
                W_ERROR_HAVE_NO_MEMORY(domain_filter);
 
                /* There may not be anything after the domain component (search for the domain itself) */