1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

librpc/rpc: allow dcesrv_context to propose the preferred ndr syntax

This allows specific services to use ndr64.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2023-08-14 12:48:28 +02:00 committed by Andrew Bartlett
parent f8b76235fe
commit 5a6978205e
3 changed files with 22 additions and 4 deletions

View File

@ -704,10 +704,7 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
p->default_auth_state = auth;
/*
* For now we only support NDR32.
*/
p->preferred_transfer = &ndr_transfer_syntax_ndr;
p->preferred_transfer = dce_ctx->preferred_transfer;
*_p = p;
return NT_STATUS_OK;
@ -1594,6 +1591,8 @@ static NTSTATUS dcesrv_check_or_create_context(struct dcesrv_call_state *call,
context->context_id = ctx->context_id;
context->iface = iface;
context->transfer_syntax = *selected_transfer;
context->ndr64 = ndr_syntax_id_equal(&context->transfer_syntax,
&ndr_transfer_syntax_ndr64);
DLIST_ADD(call->conn->contexts, context);
call->context = context;
talloc_set_destructor(context, dcesrv_connection_context_destructor);
@ -2034,6 +2033,10 @@ static NTSTATUS dcesrv_request(struct dcesrv_call_state *call)
return dcesrv_fault(call, faultcode);
}
if (call->context->ndr64) {
call->ndr_pull->flags |= LIBNDR_FLAG_NDR64;
}
/* unravel the NDR for the packet */
status = call->context->iface->ndr_pull(call, call, pull, &call->r);
if (!NT_STATUS_IS_OK(status)) {
@ -2566,6 +2569,11 @@ _PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
dce_ctx->broken_connections = NULL;
dce_ctx->callbacks = cb;
/*
* For now we only support NDR32.
*/
dce_ctx->preferred_transfer = &ndr_transfer_syntax_ndr;
*_dce_ctx = dce_ctx;
return NT_STATUS_OK;
}

View File

@ -232,6 +232,7 @@ struct dcesrv_connection_context {
/* the negotiated transfer syntax */
struct ndr_syntax_id transfer_syntax;
bool ndr64;
};
@ -454,6 +455,11 @@ struct dcesrv_context {
struct dcesrv_connection *broken_connections;
/*
* Our preferred transfer syntax.
*/
const struct ndr_syntax_id *preferred_transfer;
struct dcesrv_context_callbacks *callbacks;
};

View File

@ -168,6 +168,10 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
push->flags |= LIBNDR_FLAG_BIGENDIAN;
}
if (context->ndr64) {
push->flags |= LIBNDR_FLAG_NDR64;
}
status = context->iface->ndr_push(call, call, push, call->r);
if (!NT_STATUS_IS_OK(status)) {
return dcesrv_fault(call, call->fault_code);