s4:dsdb/repl: make use of dcerpc_binding_set_string_option("target_principal")
authorStefan Metzmacher <metze@samba.org>
Tue, 4 Feb 2014 02:07:00 +0000 (03:07 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 13 Feb 2014 10:54:17 +0000 (11:54 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source4/dsdb/repl/drepl_partitions.c

index 4c5dde27f7738d6a7a6338e7008503661ccab73b..847a7e1f2f39cbbdf2b54ee36b9c2ae48ecce9f7 100644 (file)
@@ -307,6 +307,7 @@ WERROR dreplsrv_out_connection_attach(struct dreplsrv_service *s,
        if (!conn) {
                NTSTATUS nt_status;
                char *binding_str;
+               const char *target_principal = NULL;
 
                conn = talloc_zero(s, struct dreplsrv_out_connection);
                W_ERROR_HAVE_NO_MEMORY(conn);
@@ -324,7 +325,14 @@ WERROR dreplsrv_out_connection_attach(struct dreplsrv_service *s,
 
                /* use the GC principal for DRS replication */
                nt_status = dreplsrv_get_target_principal(s, conn->binding,
-                                                         rft, &conn->binding->target_principal);
+                                                         rft, &target_principal);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       return ntstatus_to_werror(nt_status);
+               }
+
+               nt_status = dcerpc_binding_set_string_option(conn->binding,
+                                                            "target_principal",
+                                                            target_principal);
                if (!NT_STATUS_IS_OK(nt_status)) {
                        return ntstatus_to_werror(nt_status);
                }