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

s4:libnet: make use of dcerpc_binding_handle_get_binding()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-09-18 23:33:53 +02:00 committed by Ralph Boehme
parent 9fe85a9353
commit ad20c6656a
3 changed files with 27 additions and 8 deletions

View File

@ -2303,6 +2303,7 @@ static void becomeDC_drsuapi1_add_entry_recv(struct tevent_req *subreq)
struct composite_context *c = s->creq; struct composite_context *c = s->creq;
struct drsuapi_DsAddEntry *r = talloc_get_type_abort(s->ndr_struct_ptr, struct drsuapi_DsAddEntry *r = talloc_get_type_abort(s->ndr_struct_ptr,
struct drsuapi_DsAddEntry); struct drsuapi_DsAddEntry);
const struct dcerpc_binding *bd1 = NULL;
char *binding_str; char *binding_str;
uint32_t assoc_group_id; uint32_t assoc_group_id;
@ -2493,7 +2494,8 @@ static void becomeDC_drsuapi1_add_entry_recv(struct tevent_req *subreq)
} }
/* w2k3 uses the same assoc_group_id as on the first connection, so we do */ /* w2k3 uses the same assoc_group_id as on the first connection, so we do */
assoc_group_id = dcerpc_binding_get_assoc_group_id(s->drsuapi1.pipe->binding); bd1 = dcerpc_binding_handle_get_binding(s->drsuapi1.pipe->binding_handle);
assoc_group_id = dcerpc_binding_get_assoc_group_id(bd1);
c->status = dcerpc_binding_set_assoc_group_id(s->drsuapi2.binding, assoc_group_id); c->status = dcerpc_binding_set_assoc_group_id(s->drsuapi2.binding, assoc_group_id);
if (!composite_is_ok(c)) return; if (!composite_is_ok(c)) return;
@ -2541,6 +2543,7 @@ static void becomeDC_drsuapi2_bind_recv(struct tevent_req *subreq)
struct libnet_BecomeDC_state *s = tevent_req_callback_data(subreq, struct libnet_BecomeDC_state *s = tevent_req_callback_data(subreq,
struct libnet_BecomeDC_state); struct libnet_BecomeDC_state);
struct composite_context *c = s->creq; struct composite_context *c = s->creq;
const struct dcerpc_binding *bd1 = NULL;
char *binding_str; char *binding_str;
uint32_t assoc_group_id; uint32_t assoc_group_id;
WERROR status; WERROR status;
@ -2571,7 +2574,8 @@ static void becomeDC_drsuapi2_bind_recv(struct tevent_req *subreq)
} }
/* w2k3 uses the same assoc_group_id as on the first connection, so we do */ /* w2k3 uses the same assoc_group_id as on the first connection, so we do */
assoc_group_id = dcerpc_binding_get_assoc_group_id(s->drsuapi1.pipe->binding); bd1 = dcerpc_binding_handle_get_binding(s->drsuapi1.pipe->binding_handle);
assoc_group_id = dcerpc_binding_get_assoc_group_id(bd1);
c->status = dcerpc_binding_set_assoc_group_id(s->drsuapi3.binding, assoc_group_id); c->status = dcerpc_binding_set_assoc_group_id(s->drsuapi3.binding, assoc_group_id);
if (!composite_is_ok(c)) return; if (!composite_is_ok(c)) return;
/* w2k3 uses the concurrent multiplex feature on the 3rd connection, so we do */ /* w2k3 uses the concurrent multiplex feature on the 3rd connection, so we do */

View File

@ -903,7 +903,8 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
talloc_steal(mem_ctx, r->out.realm); talloc_steal(mem_ctx, r->out.realm);
r->out.samr_pipe = samr_pipe; r->out.samr_pipe = samr_pipe;
talloc_reparent(tmp_ctx, mem_ctx, samr_pipe); talloc_reparent(tmp_ctx, mem_ctx, samr_pipe);
r->out.samr_binding = samr_pipe->binding; r->out.samr_binding =
dcerpc_binding_handle_get_binding(samr_pipe->binding_handle);
r->out.user_handle = u_handle; r->out.user_handle = u_handle;
talloc_steal(mem_ctx, u_handle); talloc_steal(mem_ctx, u_handle);
r->out.error_string = r2.samr_handle.out.error_string; r->out.error_string = r2.samr_handle.out.error_string;

View File

@ -151,7 +151,10 @@ static void continue_pipe_connect(struct composite_context *ctx)
if (s->monitor_fn) { if (s->monitor_fn) {
struct monitor_msg msg; struct monitor_msg msg;
struct msg_net_rpc_connect data; struct msg_net_rpc_connect data;
const struct dcerpc_binding *b = s->r.out.dcerpc_pipe->binding; struct dcerpc_binding_handle *bh =
s->r.out.dcerpc_pipe->binding_handle;
const struct dcerpc_binding *b =
dcerpc_binding_handle_get_binding(bh);
/* prepare monitor message and post it */ /* prepare monitor message and post it */
data.host = dcerpc_binding_get_string_option(b, "host"); data.host = dcerpc_binding_get_string_option(b, "host");
@ -367,7 +370,10 @@ static void continue_rpc_connect(struct composite_context *ctx)
if (s->monitor_fn) { if (s->monitor_fn) {
struct monitor_msg msg; struct monitor_msg msg;
struct msg_net_rpc_connect data; struct msg_net_rpc_connect data;
const struct dcerpc_binding *b = s->r.out.dcerpc_pipe->binding; struct dcerpc_binding_handle *bh =
s->r.out.dcerpc_pipe->binding_handle;
const struct dcerpc_binding *b =
dcerpc_binding_handle_get_binding(bh);
data.host = dcerpc_binding_get_string_option(b, "host"); data.host = dcerpc_binding_get_string_option(b, "host");
data.endpoint = dcerpc_binding_get_string_option(b, "endpoint"); data.endpoint = dcerpc_binding_get_string_option(b, "endpoint");
@ -550,7 +556,10 @@ static void continue_dci_rpc_connect(struct composite_context *ctx)
if (s->monitor_fn) { if (s->monitor_fn) {
struct monitor_msg msg; struct monitor_msg msg;
struct msg_net_rpc_connect data; struct msg_net_rpc_connect data;
const struct dcerpc_binding *b = s->r.out.dcerpc_pipe->binding; struct dcerpc_binding_handle *bh =
s->r.out.dcerpc_pipe->binding_handle;
const struct dcerpc_binding *b =
dcerpc_binding_handle_get_binding(bh);
data.host = dcerpc_binding_get_string_option(b, "host"); data.host = dcerpc_binding_get_string_option(b, "host");
data.endpoint = dcerpc_binding_get_string_option(b, "endpoint"); data.endpoint = dcerpc_binding_get_string_option(b, "endpoint");
@ -784,11 +793,13 @@ static void continue_epm_map_binding_send(struct composite_context *c)
struct rpc_connect_dci_state *s; struct rpc_connect_dci_state *s;
struct composite_context *epm_map_req; struct composite_context *epm_map_req;
struct cli_credentials *epm_creds = NULL; struct cli_credentials *epm_creds = NULL;
const struct dcerpc_binding *b = NULL;
s = talloc_get_type(c->private_data, struct rpc_connect_dci_state); s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
/* prepare to get endpoint mapping for the requested interface */ /* prepare to get endpoint mapping for the requested interface */
s->final_binding = dcerpc_binding_dup(s, s->lsa_pipe->binding); b = dcerpc_binding_handle_get_binding(s->lsa_pipe->binding_handle);
s->final_binding = dcerpc_binding_dup(s, b);
if (composite_nomem(s->final_binding, c)) return; if (composite_nomem(s->final_binding, c)) return;
/* /*
@ -871,7 +882,10 @@ static void continue_secondary_conn(struct composite_context *ctx)
if (s->monitor_fn) { if (s->monitor_fn) {
struct monitor_msg msg; struct monitor_msg msg;
struct msg_net_rpc_connect data; struct msg_net_rpc_connect data;
const struct dcerpc_binding *b = s->r.out.dcerpc_pipe->binding; struct dcerpc_binding_handle *bh =
s->r.out.dcerpc_pipe->binding_handle;
const struct dcerpc_binding *b =
dcerpc_binding_handle_get_binding(bh);
/* prepare monitor message and post it */ /* prepare monitor message and post it */
data.host = dcerpc_binding_get_string_option(b, "host"); data.host = dcerpc_binding_get_string_option(b, "host");