s4:dsdb/repl_meta_data: let replmd_process_backlink() use dsdb_module_obj_by_guid()
authorStefan Metzmacher <metze@samba.org>
Tue, 28 Feb 2023 23:42:28 +0000 (00:42 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 23 Mar 2023 07:16:34 +0000 (07:16 +0000)
This will simplify the following changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12967

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 871e1d56ec2d05aeaad82aed6546552b8fb1d28d..0fb5bcf9d67570d60ae6c5d9d1b262f853d139e7 100644 (file)
@@ -425,6 +425,8 @@ static int linked_attr_modify(struct ldb_module *module,
 static int replmd_process_backlink(struct ldb_module *module, struct la_backlink *bl, struct ldb_request *parent)
 {
        struct ldb_dn *target_dn, *source_dn;
+       struct ldb_message *old_msg = NULL;
+       const char *attrs[] = { NULL };
        int ret;
        struct ldb_context *ldb = ldb_module_get_ctx(module);
        struct ldb_message *msg;
@@ -437,7 +439,12 @@ static int replmd_process_backlink(struct ldb_module *module, struct la_backlink
          - construct ldb_message
               - either an add or a delete
         */
-       ret = dsdb_module_dn_by_guid(module, frame, &bl->target_guid, &target_dn, parent);
+       ret = dsdb_module_obj_by_guid(module,
+                                     frame,
+                                     &old_msg,
+                                     &bl->target_guid,
+                                     attrs,
+                                     parent);
        if (ret != LDB_SUCCESS) {
                struct GUID_txt_buf guid_str;
                DBG_WARNING("Failed to find target DN for linked attribute with GUID %s\n",
@@ -446,6 +453,7 @@ static int replmd_process_backlink(struct ldb_module *module, struct la_backlink
                talloc_free(frame);
                return LDB_SUCCESS;
        }
+       target_dn = old_msg->dn;
 
        msg = ldb_msg_new(frame);
        if (msg == NULL) {