s4-dcerpc: Do not return linked attribute on deleted objects it makes W2k8R2 loops...
authorMatthieu Patou <mat@matws.net>
Mon, 18 Jul 2011 20:59:20 +0000 (00:59 +0400)
committerMatthieu Patou <mat@samba.org>
Tue, 26 Jul 2011 22:46:56 +0000 (00:46 +0200)
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Wed Jul 27 00:46:56 CEST 2011 on sn-devel-104

source4/rpc_server/drsuapi/getncchanges.c

index dc50fc0c0ca5841f7ce7c731b8552908ac5e94d6..2abab787bc5d72f41f7987d84e717a9993dfa5a8 100644 (file)
@@ -362,7 +362,21 @@ static WERROR get_nc_changes_add_la(TALLOC_CTX *mem_ctx,
                struct GUID guid;
                struct ldb_dn *tdn;
                int ret;
-
+               const char *v;
+
+               v = ldb_msg_find_attr_as_string(msg, "isDeleted", "false");
+               if (strncasecmp(v, "true", 4) == 0) {
+                       v = ldb_msg_find_attr_as_string(msg, "isRecycled", "false");
+                       /*
+                        * Do not skip link when the object is just deleted (isRecycled not present)
+                        * Do it for tomstones or recycled ones
+                        */
+                       if (strncasecmp(v, "true", 4) == 0) {
+                               DEBUG(2, (" object %s is deleted, not returning linked attribute !\n",
+                                                       ldb_dn_get_linearized(msg->dn)));
+                               return WERR_OK;
+                       }
+               }
                status = dsdb_get_extended_dn_guid(dsdb_dn->dn, &guid, "GUID");
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,(__location__ " Unable to extract GUID in linked attribute '%s' in '%s'\n",