Lines 605-610
static int partition_search(struct ldb_m
|
Link Here
|
---|
|
605 |
lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"), |
605 |
lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"), |
606 |
struct loadparm_context); |
606 |
struct loadparm_context); |
607 |
|
607 |
|
|
|
608 |
// Determine forestdnszones_dn for comparison below |
609 |
struct ldb_dn *forestdnszones_dn = ldb_dn_copy(ac, ldb_get_default_basedn(ldb)); |
610 |
if (!forestdnszones_dn) { |
611 |
return ldb_oom(ldb_module_get_ctx(module)); |
612 |
} |
613 |
if (!ldb_dn_add_child_fmt(forestdnszones_dn, "DC=ForestDnsZones")) { |
614 |
return ldb_oom(ldb_module_get_ctx(module)); |
615 |
} |
616 |
|
617 |
// Determine domaindnszones_dn for comparison below |
618 |
struct ldb_dn *domaindnszones_dn = ldb_dn_copy(ac, ldb_get_default_basedn(ldb)); |
619 |
if (!domaindnszones_dn) { |
620 |
return ldb_oom(ldb_module_get_ctx(module)); |
621 |
} |
622 |
if (!ldb_dn_add_child_fmt(domaindnszones_dn, "DC=DomainDnsZones")) { |
623 |
return ldb_oom(ldb_module_get_ctx(module)); |
624 |
} |
625 |
|
626 |
/* Don't return application partitions on GC search */ |
627 |
if (!no_gc_control ) { // not set by ldap_backend.c:ldapsrv_SearchRequest for GC port searches |
628 |
// This behaviour was found on a Windows Server 2008R2 Foundation |
629 |
// Looks like it's generally true that AD GC search doesn't return Forest+DomainDNSZones |
630 |
// let's only treat the Windows Server 2008R2 Foundation case for now: |
631 |
if (ldb_dn_is_null(req->op.search.base) && domain_scope_control) { |
632 |
// workaround: set base to avoid partition_send_all below, skip Forest and DomainDNSZones |
633 |
req->op.search.base = ldb_dn_copy(ac, ldb_get_default_basedn(ldb)); |
634 |
} |
635 |
} |
636 |
|
608 |
/* Search from the base DN */ |
637 |
/* Search from the base DN */ |
609 |
if (ldb_dn_is_null(req->op.search.base)) { |
638 |
if (ldb_dn_is_null(req->op.search.base)) { |
610 |
if (!phantom_root) { |
639 |
if (!phantom_root) { |
Lines 628-633
static int partition_search(struct ldb_m
|
Link Here
|
---|
|
628 |
} |
657 |
} |
629 |
|
658 |
|
630 |
if (phantom_root) { |
659 |
if (phantom_root) { |
|
|
660 |
|
661 |
/* Don't return application partitions on GC search */ |
662 |
if (!no_gc_control && domain_scope_control) { |
663 |
if (ldb_dn_compare(data->partitions[i]->ctrl->dn, forestdnszones_dn) == 0) { |
664 |
continue; |
665 |
} |
666 |
if (ldb_dn_compare(data->partitions[i]->ctrl->dn, domaindnszones_dn) == 0) { |
667 |
continue; |
668 |
} |
669 |
} |
670 |
|
631 |
/* Phantom root: Find all partitions under the |
671 |
/* Phantom root: Find all partitions under the |
632 |
* search base. We match if: |
672 |
* search base. We match if: |
633 |
* |
673 |
* |