1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

s4:lib/messaging: implement irpc_bh_get_binding()

We just use NCACN_INTERNAL here...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-09-17 20:43:28 +02:00 committed by Ralph Boehme
parent 66411b96b8
commit a6034592fa

View File

@ -1168,12 +1168,21 @@ struct server_id imessaging_get_server_id(struct imessaging_context *msg_ctx)
struct irpc_bh_state { struct irpc_bh_state {
struct imessaging_context *msg_ctx; struct imessaging_context *msg_ctx;
const struct dcerpc_binding *binding;
struct server_id server_id; struct server_id server_id;
const struct ndr_interface_table *table; const struct ndr_interface_table *table;
uint32_t timeout; uint32_t timeout;
struct security_token *token; struct security_token *token;
}; };
static const struct dcerpc_binding *irpc_bh_get_binding(struct dcerpc_binding_handle *h)
{
struct irpc_bh_state *hs = dcerpc_binding_handle_data(h,
struct irpc_bh_state);
return hs->binding;
}
static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h) static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h)
{ {
struct irpc_bh_state *hs = dcerpc_binding_handle_data(h, struct irpc_bh_state *hs = dcerpc_binding_handle_data(h,
@ -1450,6 +1459,7 @@ static void irpc_bh_do_ndr_print(struct dcerpc_binding_handle *h,
static const struct dcerpc_binding_handle_ops irpc_bh_ops = { static const struct dcerpc_binding_handle_ops irpc_bh_ops = {
.name = "wbint", .name = "wbint",
.get_binding = irpc_bh_get_binding,
.is_connected = irpc_bh_is_connected, .is_connected = irpc_bh_is_connected,
.set_timeout = irpc_bh_set_timeout, .set_timeout = irpc_bh_set_timeout,
.raw_call_send = irpc_bh_raw_call_send, .raw_call_send = irpc_bh_raw_call_send,
@ -1467,8 +1477,10 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
struct server_id server_id, struct server_id server_id,
const struct ndr_interface_table *table) const struct ndr_interface_table *table)
{ {
struct dcerpc_binding_handle *h; struct dcerpc_binding_handle *h = NULL;
struct irpc_bh_state *hs; struct irpc_bh_state *hs = NULL;
struct dcerpc_binding *b = NULL;
NTSTATUS status;
h = dcerpc_binding_handle_create(mem_ctx, h = dcerpc_binding_handle_create(mem_ctx,
&irpc_bh_ops, &irpc_bh_ops,
@ -1485,6 +1497,34 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
hs->table = table; hs->table = table;
hs->timeout = IRPC_CALL_TIMEOUT; hs->timeout = IRPC_CALL_TIMEOUT;
status = dcerpc_parse_binding(hs, "", &b);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(h);
return NULL;
}
status = dcerpc_binding_set_transport(b, NCACN_INTERNAL);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(h);
return NULL;
}
status = dcerpc_binding_set_string_option(b, "host", "localhost");
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(h);
return NULL;
}
status = dcerpc_binding_set_string_option(b, "endpoint", "irpc");
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(h);
return NULL;
}
status = dcerpc_binding_set_abstract_syntax(b, &table->syntax_id);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(h);
return NULL;
}
hs->binding = b;
return h; return h;
} }