extended_dn_out: Force showing of one-way links if they exist
authorGarming Sam <garming@catalyst.net.nz>
Wed, 13 Jul 2016 01:29:19 +0000 (13:29 +1200)
committerGarming Sam <garming@samba.org>
Fri, 15 Jul 2016 08:01:29 +0000 (10:01 +0200)
Signed-off-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/knownfail
source4/dsdb/samdb/ldb_modules/extended_dn_out.c

index 74543dd75dd808b6db43fd144031f1a6b2bf5499..1a92a5d3198fb137d00f04170905c349b300e613 100644 (file)
 
 # 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\)
index 31835a73d296954b577b78411880c4495facafca..d29a50ce05369bfca46571c0668b5f701ea92b3a 100644 (file)
@@ -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);