]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libnet_dssync: make use of dcerpc_binding_handle_auth_session_key()
authorStefan Metzmacher <metze@samba.org>
Sat, 14 Sep 2024 13:57:03 +0000 (15:57 +0200)
committerJule Anger <janger@samba.org>
Thu, 12 Jun 2025 11:27:14 +0000 (11:27 +0000)
Note we only need to call this once per connection, not after
each request...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 099c8d904ece0edbefecbaa51fa50256fd2ea7c0)

source3/libnet/libnet_dssync.c

index 7d5d8366b2272f9a739be09f857c75dcc4cdc7f0..7f10f2dd4b1a907b029c6fdeee498dc7663a942e 100644 (file)
@@ -467,6 +467,15 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
                }
        }
 
+       status = dcerpc_binding_handle_auth_session_key(
+                       b, mem_ctx, &ctx->session_key);
+       if (!NT_STATUS_IS_OK(status)) {
+               ctx->error_message = talloc_asprintf(ctx,
+                       "Failed to get Session Key: %s",
+                       nt_errstr(status));
+               goto out;
+       }
+
        for (y=0, last_query = false; !last_query; y++) {
                struct drsuapi_DsReplicaObjectListItemEx *first_object = NULL;
                struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr = NULL;
@@ -577,14 +586,6 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
                        }
                }
 
-               status = cli_get_session_key(mem_ctx, ctx->cli, &ctx->session_key);
-               if (!NT_STATUS_IS_OK(status)) {
-                       ctx->error_message = talloc_asprintf(ctx,
-                               "Failed to get Session Key: %s",
-                               nt_errstr(status));
-                       goto out;
-               }
-
                libnet_dssync_decrypt_attributes(mem_ctx,
                                                 &ctx->session_key,
                                                 first_object);