From: Stefan Metzmacher Date: Sat, 14 Sep 2024 13:57:03 +0000 (+0200) Subject: s3:libnet_dssync: make use of dcerpc_binding_handle_auth_session_key() X-Git-Tag: samba-4.21.7~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3200bd21d4dc4c0a9cfc7526300576ced590b670;p=thirdparty%2Fsamba.git s3:libnet_dssync: make use of dcerpc_binding_handle_auth_session_key() Note we only need to call this once per connection, not after each request... Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme (cherry picked from commit 099c8d904ece0edbefecbaa51fa50256fd2ea7c0) --- diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 7d5d8366b22..7f10f2dd4b1 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -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);