s4-rpc_server/drsuapi: Ensure logs show DN for replicated objects, not (null)
authorAndrew Bartlett <abartlet@samba.org>
Wed, 28 Jun 2023 03:57:47 +0000 (15:57 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 13 Aug 2023 21:59:29 +0000 (21:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15407
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15401

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/rpc_server/drsuapi/getncchanges.c

index 947cb7f0f77ff9a1993d8bb3f786e51a8f422ca8..be28799e28afb7f5f5676497c1abe1bccb49cf61 100644 (file)
@@ -3567,7 +3567,15 @@ allowed:
                        getncchanges_chunk_add_objects(repl_chunk, new_objs);
 
                        talloc_free(getnc_state->last_dn);
-                       getnc_state->last_dn = talloc_move(getnc_state, &msg->dn);
+                       /*
+                        * talloc_steal() as we still need msg->dn to
+                        * be a valid pointer for the log on the next
+                        * line.
+                        *
+                        * msg only remains in scope for the next 25
+                        * lines or so anyway.
+                        */
+                       getnc_state->last_dn = talloc_steal(getnc_state, msg->dn);
                }
 
                DEBUG(8,(__location__ ": %s object %s new tmp_highest_usn=%" PRIu64 "\n",