From 31ffe971785333d6afb4885aba41d8be29c6e0e5 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Wed, 13 Jul 2016 13:29:19 +1200 Subject: [PATCH] extended_dn_out: Force showing of one-way links if they exist Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett --- selftest/knownfail | 3 --- source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 12 +++++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/selftest/knownfail b/selftest/knownfail index 74543dd75dd..1a92a5d3198 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -285,6 +285,3 @@ # fl2000dc doesn't support AES ^samba4.krb5.kdc.*as-req-aes.*fl2000dc - -^samba4.ldap.linked_attributes.python\(ad_dc_ntvfs\).__main__.LATests.test_one_way_attributes\(ad_dc_ntvfs:local\) -^samba4.ldap.linked_attributes.python\(ad_dc_ntvfs\).__main__.LATests.test_pretend_one_way_attributes\(ad_dc_ntvfs:local\) diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c index 31835a73d29..d29a50ce053 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c @@ -325,7 +325,8 @@ struct extended_search_context { renames of the target */ static int fix_one_way_link(struct extended_search_context *ac, struct ldb_dn *dn, - bool is_deleted_objects, bool *remove_value) + bool is_deleted_objects, bool *remove_value, + uint32_t linkID) { struct GUID guid; NTSTATUS status; @@ -348,9 +349,9 @@ static int fix_one_way_link(struct extended_search_context *ac, struct ldb_dn *d search_flags = DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SEARCH_ALL_PARTITIONS | DSDB_SEARCH_ONE_ONLY; - if (ldb_request_get_control(ac->req, LDB_CONTROL_SHOW_DEACTIVATED_LINK_OID) || - is_deleted_objects) { - search_flags |= DSDB_SEARCH_SHOW_DELETED; + if (linkID == 0) { + /* You must ALWAYS show one-way links regardless of the state of the target */ + search_flags |= (DSDB_SEARCH_SHOW_DELETED | DSDB_SEARCH_SHOW_RECYCLED); } ret = dsdb_module_search(ac->module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE, attrs, @@ -611,7 +612,8 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares, if (attribute->one_way_link && strcasecmp(attribute->lDAPDisplayName, "objectCategory") != 0) { bool remove_value; - ret = fix_one_way_link(ac, dn, is_deleted_objects, &remove_value); + ret = fix_one_way_link(ac, dn, is_deleted_objects, &remove_value, + attribute->linkID); if (ret != LDB_SUCCESS) { talloc_free(dsdb_dn); return ldb_module_done(ac->req, NULL, NULL, ret); -- 2.47.3