From 4c4323009fa83f00ed319de59a3aad48fcd65994 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:04 +0100 Subject: r26327: Explicit loadparm_context for RPC client functions. (This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07) --- source4/client/client.c | 11 ++--- source4/dsdb/repl/drepl_out_helpers.c | 2 +- source4/lib/registry/registry.h | 1 + source4/lib/registry/rpc.c | 3 +- source4/lib/registry/tools/regdiff.c | 2 +- source4/libnet/libnet.c | 4 +- source4/libnet/libnet.h | 2 + source4/libnet/libnet_become_dc.c | 3 +- source4/libnet/libnet_join.c | 5 ++- source4/libnet/libnet_rpc.c | 5 ++- source4/libnet/libnet_unbecome_dc.c | 3 +- source4/libnet/libnet_vampire.c | 2 +- source4/librpc/rpc/dcerpc.i | 3 +- source4/librpc/rpc/dcerpc_auth.c | 6 ++- source4/librpc/rpc/dcerpc_connect.c | 28 +++++++----- source4/librpc/rpc/dcerpc_schannel.c | 7 ++- source4/librpc/rpc/dcerpc_secondary.c | 8 +++- source4/librpc/rpc/dcerpc_util.c | 32 ++++++++------ source4/librpc/rpc/dcerpc_wrap.c | 21 ++++++--- source4/rpc_server/remote/dcesrv_remote.c | 3 +- source4/rpc_server/spoolss/dcesrv_spoolss.c | 2 +- source4/scripting/ejs/ejsnet/net_ctx.c | 2 +- source4/scripting/ejs/smbcalls_rpc.c | 3 +- source4/torture/libnet/domain.c | 2 +- source4/torture/libnet/libnet_BecomeDC.c | 6 +-- source4/torture/libnet/libnet_domain.c | 14 +++--- source4/torture/libnet/libnet_group.c | 2 +- source4/torture/libnet/libnet_lookup.c | 8 ++-- source4/torture/libnet/libnet_rpc.c | 2 +- source4/torture/libnet/libnet_share.c | 4 +- source4/torture/libnet/libnet_user.c | 10 ++--- source4/torture/rpc/async_bind.c | 2 +- source4/torture/rpc/bind.c | 3 +- source4/torture/rpc/dfs.c | 12 +++--- source4/torture/rpc/dssync.c | 2 +- source4/torture/rpc/mgmt.c | 2 +- source4/torture/rpc/rpc.c | 8 ++-- source4/torture/rpc/samba3rpc.c | 66 +++++++++++++---------------- source4/torture/rpc/samlogon.c | 2 +- source4/torture/rpc/samr_accessmask.c | 4 +- source4/torture/rpc/samsync.c | 4 +- source4/torture/rpc/scanner.c | 2 +- source4/torture/rpc/schannel.c | 27 ++++++------ source4/torture/rpc/session_key.c | 2 +- source4/torture/rpc/testjoin.c | 4 +- source4/utils/net/net_join.c | 2 +- source4/utils/net/net_password.c | 4 +- source4/utils/net/net_time.c | 2 +- source4/utils/net/net_user.c | 4 +- source4/utils/net/net_vampire.c | 6 +-- source4/winbind/wb_connect_sam.c | 3 +- source4/winbind/wb_init_domain.c | 15 ++++--- 52 files changed, 218 insertions(+), 164 deletions(-) (limited to 'source4') diff --git a/source4/client/client.c b/source4/client/client.c index 6debaac2e9..6842e2e91d 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -2545,7 +2545,7 @@ static void display_share_result(struct srvsvc_NetShareCtr1 *ctr1) /**************************************************************************** try and browse available shares on a host ****************************************************************************/ -static bool browse_host(const char *query_host) +static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host) { struct dcerpc_pipe *p; char *binding; @@ -2559,7 +2559,8 @@ static bool browse_host(const char *query_host) status = dcerpc_pipe_connect(mem_ctx, &p, binding, &ndr_table_srvsvc, - cmdline_credentials, NULL); + cmdline_credentials, NULL, + lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to connect to %s - %s\n", binding, nt_errstr(status)); @@ -3055,9 +3056,9 @@ static struct smbclient_context *do_connect(TALLOC_CTX *mem_ctx, /**************************************************************************** handle a -L query ****************************************************************************/ -static int do_host_query(const char *query_host, const char *workgroup) +static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host, const char *workgroup) { - browse_host(query_host); + browse_host(lp_ctx, query_host); list_servers(workgroup); return(0); } @@ -3219,7 +3220,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c } if (query_host) { - return do_host_query(query_host, lp_workgroup(global_loadparm)); + return do_host_query(global_loadparm, query_host, lp_workgroup(global_loadparm)); } if (message) { diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c index fce61d1184..aede6e6595 100644 --- a/source4/dsdb/repl/drepl_out_helpers.c +++ b/source4/dsdb/repl/drepl_out_helpers.c @@ -78,7 +78,7 @@ static struct composite_context *dreplsrv_out_drsuapi_send(struct dreplsrv_out_c creq = dcerpc_pipe_connect_b_send(st, conn->binding, &ndr_table_drsuapi, conn->service->system_session_info->credentials, - c->event_ctx); + c->event_ctx, conn->service->task->lp_ctx); composite_continue(c, creq, dreplsrv_out_drsuapi_connect_recv, st); return c; diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index c53e3dfbe5..edd6c6713f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -186,6 +186,7 @@ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, const char *location, struct event_context *ev); WERROR reg_open_wine(struct registry_context **ctx, const char *path); diff --git a/source4/lib/registry/rpc.c b/source4/lib/registry/rpc.c index c694223909..ac0eecd0ac 100644 --- a/source4/lib/registry/rpc.c +++ b/source4/lib/registry/rpc.c @@ -375,6 +375,7 @@ static struct registry_operations reg_backend_rpc = { _PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, const char *location, struct event_context *ev) { NTSTATUS status; @@ -393,7 +394,7 @@ _PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, status = dcerpc_pipe_connect(*ctx /* TALLOC_CTX */, &p, location, &ndr_table_winreg, - credentials, ev); + credentials, ev, lp_ctx); rctx->pipe = p; if(NT_STATUS_IS_ERR(status)) { diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 1996861a2a..ea4b754fe7 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -44,7 +44,7 @@ static struct registry_context *open_backend(poptContext pc, error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials); break; case REG_REMOTE: - error = reg_open_remote(&ctx, NULL, cmdline_credentials, + error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx, remote_host, NULL); break; case REG_NULL: diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c index 86804df1ea..4502599217 100644 --- a/source4/libnet/libnet.c +++ b/source4/libnet/libnet.c @@ -22,7 +22,8 @@ #include "lib/events/events.h" #include "param/param.h" -struct libnet_context *libnet_context_init(struct event_context *ev) +struct libnet_context *libnet_context_init(struct event_context *ev, + struct loadparm_context *lp_ctx) { struct libnet_context *ctx; @@ -41,6 +42,7 @@ struct libnet_context *libnet_context_init(struct event_context *ev) } } ctx->event_ctx = ev; + ctx->lp_ctx = lp_ctx; /* name resolution methods */ ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order(global_loadparm)); diff --git a/source4/libnet/libnet.h b/source4/libnet/libnet.h index 56a7d0ba20..4f3acc6010 100644 --- a/source4/libnet/libnet.h +++ b/source4/libnet/libnet.h @@ -50,6 +50,8 @@ struct libnet_context { const char **name_res_methods; struct event_context *event_ctx; + + struct loadparm_context *lp_ctx; }; diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 0f8b86fddf..a691fca420 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -1526,7 +1526,8 @@ static void becomeDC_drsuapi_connect_send(struct libnet_BecomeDC_state *s, } creq = dcerpc_pipe_connect_b_send(s, drsuapi->binding, &ndr_table_drsuapi, - s->libnet->cred, s->libnet->event_ctx); + s->libnet->cred, s->libnet->event_ctx, + s->libnet->lp_ctx); composite_continue(c, creq, recv_fn, s); } diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 25ad0ca440..2f14799ced 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -114,7 +114,8 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J drsuapi_binding, &ndr_table_drsuapi, ctx->cred, - ctx->event_ctx); + ctx->event_ctx, + ctx->lp_ctx); if (!NT_STATUS_IS_OK(status)) { r->out.error_string = talloc_asprintf(r, "Connection to DRSUAPI pipe of PDC of domain '%s' failed: %s", @@ -506,7 +507,7 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru status = dcerpc_pipe_auth(tmp_ctx, &samr_pipe, connect_with_info->out.dcerpc_pipe->binding, - &ndr_table_samr, ctx->cred); + &ndr_table_samr, ctx->cred, ctx->lp_ctx); if (!NT_STATUS_IS_OK(status)) { r->out.error_string = talloc_asprintf(mem_ctx, "SAMR bind failed: %s", diff --git a/source4/libnet/libnet_rpc.c b/source4/libnet/libnet_rpc.c index 85dd6c43e7..667f54c447 100644 --- a/source4/libnet/libnet_rpc.c +++ b/source4/libnet/libnet_rpc.c @@ -114,7 +114,8 @@ static struct composite_context* libnet_RpcConnectSrv_send(struct libnet_context /* connect to remote dcerpc pipe */ pipe_connect_req = dcerpc_pipe_connect_b_send(c, b, r->in.dcerpc_iface, - ctx->cred, c->event_ctx); + ctx->cred, c->event_ctx, + ctx->lp_ctx); if (composite_nomem(pipe_connect_req, c)) return c; composite_continue(c, pipe_connect_req, continue_pipe_connect, c); @@ -744,7 +745,7 @@ static void continue_epm_map_binding_send(struct composite_context *c) if (composite_nomem(talloc_reference(s->final_binding, s->lsa_pipe->binding), c)) return; epm_map_req = dcerpc_epm_map_binding_send(c, s->final_binding, s->r.in.dcerpc_iface, - s->lsa_pipe->conn->event_ctx); + s->lsa_pipe->conn->event_ctx, s->ctx->lp_ctx); if (composite_nomem(epm_map_req, c)) return; composite_continue(c, epm_map_req, continue_epm_map_binding, c); diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index a7b962f2a8..a39df4f254 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -540,7 +540,8 @@ static void unbecomeDC_drsuapi_connect_send(struct libnet_UnbecomeDC_state *s) if (!composite_is_ok(c)) return; creq = dcerpc_pipe_connect_b_send(s, s->drsuapi.binding, &ndr_table_drsuapi, - s->libnet->cred, s->libnet->event_ctx); + s->libnet->cred, s->libnet->event_ctx, + s->libnet->lp_ctx); composite_continue(c, creq, unbecomeDC_drsuapi_connect_recv, s); } diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index fbb7c8b6e5..e4c8833156 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -270,7 +270,7 @@ NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx } nt_status = dcerpc_bind_auth_schannel(samsync_ctx, p, &ndr_table_netlogon, - machine_account, DCERPC_AUTH_LEVEL_PRIVACY); + machine_account, ctx->lp_ctx, DCERPC_AUTH_LEVEL_PRIVACY); if (!NT_STATUS_IS_OK(nt_status)) { r->out.error_string = talloc_asprintf(mem_ctx, diff --git a/source4/librpc/rpc/dcerpc.i b/source4/librpc/rpc/dcerpc.i index 4a58b43085..862ba7d1b2 100644 --- a/source4/librpc/rpc/dcerpc.i +++ b/source4/librpc/rpc/dcerpc.i @@ -68,7 +68,8 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, const char *binding, const char *pipe_uuid, uint32_t pipe_version, - struct cli_credentials *credentials); + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx); %typemap(in) DATA_BLOB * (DATA_BLOB temp_data_blob) { temp_data_blob.data = PyString_AsString($input); diff --git a/source4/librpc/rpc/dcerpc_auth.c b/source4/librpc/rpc/dcerpc_auth.c index 0012b38f2e..f80ef86413 100644 --- a/source4/librpc/rpc/dcerpc_auth.c +++ b/source4/librpc/rpc/dcerpc_auth.c @@ -212,6 +212,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, struct dcerpc_pipe *p, const struct ndr_interface_table *table, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, uint8_t auth_type, uint8_t auth_level, const char *service) { @@ -240,7 +241,7 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx, c->status = gensec_client_start(p, &sec->generic_state, p->conn->event_ctx, - global_loadparm); + lp_ctx); if (!NT_STATUS_IS_OK(c->status)) { DEBUG(1, ("Failed to start GENSEC client mode: %s\n", nt_errstr(c->status))); @@ -374,11 +375,12 @@ NTSTATUS dcerpc_bind_auth_recv(struct composite_context *creq) NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p, const struct ndr_interface_table *table, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, uint8_t auth_type, uint8_t auth_level, const char *service) { struct composite_context *creq; - creq = dcerpc_bind_auth_send(p, p, table, credentials, + creq = dcerpc_bind_auth_send(p, p, table, credentials, lp_ctx, auth_type, auth_level, service); return dcerpc_bind_auth_recv(creq); } diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index b9913106f0..c39a944fdb 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -468,6 +468,7 @@ struct pipe_connect_state { struct dcerpc_binding *binding; const struct ndr_interface_table *table; struct cli_credentials *credentials; + struct loadparm_context *lp_ctx; }; @@ -663,7 +664,7 @@ static void continue_pipe_connect(struct composite_context *c, struct pipe_conne } auth_bind_req = dcerpc_pipe_auth_send(s->pipe, s->binding, s->table, - s->credentials); + s->credentials, s->lp_ctx); composite_continue(c, auth_bind_req, continue_pipe_auth, c); } @@ -703,7 +704,8 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx, struct dcerpc_binding *binding, const struct ndr_interface_table *table, struct cli_credentials *credentials, - struct event_context *ev) + struct event_context *ev, + struct loadparm_context *lp_ctx) { struct composite_context *c; struct pipe_connect_state *s; @@ -735,6 +737,7 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx, s->binding = binding; s->table = table; s->credentials = credentials; + s->lp_ctx = lp_ctx; event_add_timed(c->event_ctx, c, timeval_current_ofs(DCERPC_REQUEST_TIMEOUT, 0), @@ -744,7 +747,8 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx, case NCA_UNKNOWN: { struct composite_context *binding_req; binding_req = dcerpc_epm_map_binding_send(c, s->binding, s->table, - s->pipe->conn->event_ctx); + s->pipe->conn->event_ctx, + s->lp_ctx); composite_continue(c, binding_req, continue_map_binding, c); return c; } @@ -755,7 +759,8 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx, if (!s->binding->endpoint) { struct composite_context *binding_req; binding_req = dcerpc_epm_map_binding_send(c, s->binding, s->table, - s->pipe->conn->event_ctx); + s->pipe->conn->event_ctx, + s->lp_ctx); composite_continue(c, binding_req, continue_map_binding, c); return c; } @@ -799,12 +804,13 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx, struct dcerpc_binding *binding, const struct ndr_interface_table *table, struct cli_credentials *credentials, - struct event_context *ev) + struct event_context *ev, + struct loadparm_context *lp_ctx) { struct composite_context *c; c = dcerpc_pipe_connect_b_send(parent_ctx, binding, table, - credentials, ev); + credentials, ev, lp_ctx); return dcerpc_pipe_connect_b_recv(c, parent_ctx, pp); } @@ -826,7 +832,7 @@ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx, const char *binding, const struct ndr_interface_table *table, struct cli_credentials *credentials, - struct event_context *ev) + struct event_context *ev, struct loadparm_context *lp_ctx) { struct composite_context *c; struct pipe_conn_state *s; @@ -867,7 +873,7 @@ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_ctx, is established */ pipe_conn_req = dcerpc_pipe_connect_b_send(c, b, table, - credentials, ev); + credentials, ev, lp_ctx); composite_continue(c, pipe_conn_req, continue_pipe_connect_b, c); return c; } @@ -922,12 +928,12 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, const char *binding, const struct ndr_interface_table *table, struct cli_credentials *credentials, - struct event_context *ev) + struct event_context *ev, + struct loadparm_context *lp_ctx) { struct composite_context *c; c = dcerpc_pipe_connect_send(parent_ctx, binding, - table, - credentials, ev); + table, credentials, ev, lp_ctx); return dcerpc_pipe_connect_recv(c, parent_ctx, pp); } diff --git a/source4/librpc/rpc/dcerpc_schannel.c b/source4/librpc/rpc/dcerpc_schannel.c index c6b3a5fc0f..fadf0add8c 100644 --- a/source4/librpc/rpc/dcerpc_schannel.c +++ b/source4/librpc/rpc/dcerpc_schannel.c @@ -286,6 +286,7 @@ struct auth_schannel_state { struct dcerpc_pipe *pipe; struct cli_credentials *credentials; const struct ndr_interface_table *table; + struct loadparm_context *lp_ctx; uint8_t auth_level; }; @@ -315,6 +316,7 @@ static void continue_schannel_key(struct composite_context *ctx) /* send bind auth request with received creds */ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, s->credentials, + s->lp_ctx, DCERPC_AUTH_TYPE_SCHANNEL, s->auth_level, NULL); if (composite_nomem(auth_req, c)) return; @@ -346,6 +348,7 @@ struct composite_context *dcerpc_bind_auth_schannel_send(TALLOC_CTX *tmp_ctx, struct dcerpc_pipe *p, const struct ndr_interface_table *table, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, uint8_t auth_level) { struct composite_context *c; @@ -365,6 +368,7 @@ struct composite_context *dcerpc_bind_auth_schannel_send(TALLOC_CTX *tmp_ctx, s->credentials = credentials; s->table = table; s->auth_level = auth_level; + s->lp_ctx = lp_ctx; /* start getting schannel key first */ schan_key_req = dcerpc_schannel_key_send(c, p, credentials); @@ -394,11 +398,12 @@ NTSTATUS dcerpc_bind_auth_schannel(TALLOC_CTX *tmp_ctx, struct dcerpc_pipe *p, const struct ndr_interface_table *table, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, uint8_t auth_level) { struct composite_context *c; - c = dcerpc_bind_auth_schannel_send(tmp_ctx, p, table, credentials, + c = dcerpc_bind_auth_schannel_send(tmp_ctx, p, table, credentials, lp_ctx, auth_level); return dcerpc_bind_auth_schannel_recv(c); } diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c index 4d3547b60c..1c4de0a2f2 100644 --- a/source4/librpc/rpc/dcerpc_secondary.c +++ b/source4/librpc/rpc/dcerpc_secondary.c @@ -226,6 +226,7 @@ struct sec_auth_conn_state { const struct ndr_interface_table *table; struct cli_credentials *credentials; struct composite_context *ctx; + struct loadparm_context *lp_ctx; }; static void dcerpc_secondary_auth_connection_bind(struct composite_context *ctx); @@ -234,7 +235,8 @@ static void dcerpc_secondary_auth_connection_continue(struct composite_context * struct composite_context* dcerpc_secondary_auth_connection_send(struct dcerpc_pipe *p, struct dcerpc_binding *binding, const struct ndr_interface_table *table, - struct cli_credentials *credentials) + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx) { struct composite_context *c, *secondary_conn_ctx; @@ -252,6 +254,7 @@ struct composite_context* dcerpc_secondary_auth_connection_send(struct dcerpc_pi s->binding = binding; s->table = table; s->credentials = credentials; + s->lp_ctx = lp_ctx; secondary_conn_ctx = dcerpc_secondary_connection_send(p, binding); @@ -278,7 +281,8 @@ static void dcerpc_secondary_auth_connection_bind(struct composite_context *ctx) s->ctx->status = dcerpc_secondary_connection_recv(ctx, &s->pipe2); if (!composite_is_ok(s->ctx)) return; - secondary_auth_ctx = dcerpc_pipe_auth_send(s->pipe2, s->binding, s->table, s->credentials); + secondary_auth_ctx = dcerpc_pipe_auth_send(s->pipe2, s->binding, s->table, s->credentials, + s->lp_ctx); composite_continue(s->ctx, secondary_auth_ctx, dcerpc_secondary_auth_connection_continue, s); } diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 6c23ec20a0..32cee4308e 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -895,7 +895,8 @@ static void continue_epm_map(struct rpc_request *req) struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, const struct ndr_interface_table *table, - struct event_context *ev) + struct event_context *ev, + struct loadparm_context *lp_ctx) { struct composite_context *c; struct epm_map_binding_state *s; @@ -984,7 +985,8 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, /* initiate rpc pipe connection */ pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding, &ndr_table_epmapper, - anon_creds, c->event_ctx); + anon_creds, c->event_ctx, + lp_ctx); if (composite_nomem(pipe_connect_req, c)) return c; composite_continue(c, pipe_connect_req, continue_epm_recv_binding, c); @@ -1008,11 +1010,12 @@ NTSTATUS dcerpc_epm_map_binding_recv(struct composite_context *c) Get endpoint mapping for rpc connection */ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, - const struct ndr_interface_table *table, struct event_context *ev) + const struct ndr_interface_table *table, struct event_context *ev, + struct loadparm_context *lp_ctx) { struct composite_context *c; - c = dcerpc_epm_map_binding_send(mem_ctx, binding, table, ev); + c = dcerpc_epm_map_binding_send(mem_ctx, binding, table, ev, lp_ctx); return dcerpc_epm_map_binding_recv(c); } @@ -1021,6 +1024,7 @@ struct pipe_auth_state { struct dcerpc_pipe *pipe; struct dcerpc_binding *binding; const struct ndr_interface_table *table; + struct loadparm_context *lp_ctx; struct cli_credentials *credentials; }; @@ -1124,7 +1128,8 @@ static void continue_ntlmssp_connection(struct composite_context *ctx) /* initiate a authenticated bind */ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, - s->credentials, DCERPC_AUTH_TYPE_NTLMSSP, + s->credentials, s->lp_ctx, + DCERPC_AUTH_TYPE_NTLMSSP, dcerpc_auth_level(s->pipe->conn), s->table->authservices->names[0]); composite_continue(c, auth_req, continue_auth, c); @@ -1155,7 +1160,7 @@ static void continue_spnego_after_wrong_pass(struct composite_context *ctx) /* initiate a authenticated bind */ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, - s->credentials, DCERPC_AUTH_TYPE_SPNEGO, + s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO, dcerpc_auth_level(s->pipe->conn), s->table->authservices->names[0]); composite_continue(c, auth_req, continue_auth, c); @@ -1184,7 +1189,8 @@ static void continue_auth_none(struct composite_context *ctx) struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p, struct dcerpc_binding *binding, const struct ndr_interface_table *table, - struct cli_credentials *credentials) + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx) { struct composite_context *c; struct pipe_auth_state *s; @@ -1207,6 +1213,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p, s->table = table; s->credentials = credentials; s->pipe = p; + s->lp_ctx = lp_ctx; conn = s->pipe->conn; conn->flags = binding->flags; @@ -1226,7 +1233,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p, * the schannel bind, then we have to get these * first */ auth_schannel_req = dcerpc_bind_auth_schannel_send(c, s->pipe, s->table, - s->credentials, + s->credentials, s->lp_ctx, dcerpc_auth_level(conn)); composite_continue(c, auth_schannel_req, continue_auth_schannel, c); return c; @@ -1272,7 +1279,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p, } else { /* try SPNEGO with fallback to NTLMSSP */ auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, - s->credentials, DCERPC_AUTH_TYPE_SPNEGO, + s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO, dcerpc_auth_level(conn), s->table->authservices->names[0]); composite_continue(c, auth_req, continue_auth_auto, c); @@ -1280,7 +1287,7 @@ struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p, } auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table, - s->credentials, auth_type, + s->credentials, s->lp_ctx, auth_type, dcerpc_auth_level(conn), s->table->authservices->names[0]); composite_continue(c, auth_req, continue_auth, c); @@ -1326,11 +1333,12 @@ NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx, struct dcerpc_pipe **p, struct dcerpc_binding *binding, const struct ndr_interface_table *table, - struct cli_credentials *credentials) + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx) { struct composite_context *c; - c = dcerpc_pipe_auth_send(*p, binding, table, credentials); + c = dcerpc_pipe_auth_send(*p, binding, table, credentials, lp_ctx); return dcerpc_pipe_auth_recv(c, mem_ctx, p); } diff --git a/source4/librpc/rpc/dcerpc_wrap.c b/source4/librpc/rpc/dcerpc_wrap.c index 48dd3b30a8..c9eb72fb9e 100644 --- a/source4/librpc/rpc/dcerpc_wrap.c +++ b/source4/librpc/rpc/dcerpc_wrap.c @@ -2523,9 +2523,7 @@ typedef struct cli_credentials cli_credentials; SWIGINTERN cli_credentials *new_cli_credentials(){ return cli_credentials_init(NULL); } -SWIGINTERN void delete_cli_credentials(cli_credentials *self){ - talloc_free(self); - } +SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); } SWIGINTERN swig_type_info* SWIG_pchar_descriptor(void) @@ -3550,6 +3548,7 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject char *arg4 = (char *) 0 ; uint32_t arg5 ; struct cli_credentials *arg6 = (struct cli_credentials *) 0 ; + struct loadparm_context *arg7 = (struct loadparm_context *) 0 ; NTSTATUS result; struct dcerpc_pipe *temp_dcerpc_pipe2 ; int res3 ; @@ -3562,12 +3561,15 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject int res5 = 0 ; void *argp6 = 0 ; int res6 = 0 ; + void *argp7 = 0 ; + int res7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; char * kwnames[] = { - (char *) "binding",(char *) "pipe_uuid",(char *) "pipe_version",(char *) "credentials", NULL + (char *) "binding",(char *) "pipe_uuid",(char *) "pipe_version",(char *) "credentials",(char *) "lp_ctx", NULL }; { @@ -3579,7 +3581,7 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject { arg2 = &temp_dcerpc_pipe2; } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:pipe_connect",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:pipe_connect",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res3 = SWIG_AsCharPtrAndSize(obj0, &buf3, NULL, &alloc3); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "pipe_connect" "', argument " "3"" of type '" "char const *""'"); @@ -3608,7 +3610,14 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject } arg6 = (struct cli_credentials *)(argp6); } - result = dcerpc_pipe_connect(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6); + if (obj4) { + res7 = SWIG_ConvertPtr(obj4, &argp7,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res7)) { + SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "pipe_connect" "', argument " "7"" of type '" "struct loadparm_context *""'"); + } + arg7 = (struct loadparm_context *)(argp7); + } + result = dcerpc_pipe_connect(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7); resultobj = SWIG_NewPointerObj((NTSTATUS *)memcpy((NTSTATUS *)malloc(sizeof(NTSTATUS)),&result,sizeof(NTSTATUS)), SWIGTYPE_p_NTSTATUS, SWIG_POINTER_OWN | 0 ); { /* Set REF_ALLOC flag so we don't have to do too much extra diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index 613b53519a..3b5c0a02ae 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -103,7 +103,8 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct status = dcerpc_pipe_connect(private, &(private->c_pipe), binding, table, - credentials, dce_call->event_ctx); + credentials, dce_call->event_ctx, + dce_call->conn->dce_ctx->lp_ctx); talloc_free(credentials); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index bd30f231bf..33a42dddab 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -1155,7 +1155,7 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_ creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */ status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_spoolss, - creds, NULL); + creds, NULL, dce_call->conn->dce_ctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { DEBUG(0, ("unable to call back to %s\n", r->in.str)); diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c index 97a05ab88f..396718367a 100644 --- a/source4/scripting/ejs/ejsnet/net_ctx.c +++ b/source4/scripting/ejs/ejsnet/net_ctx.c @@ -52,7 +52,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv) } ev = event_context_find(event_mem_ctx); - ctx = libnet_context_init(ev); + ctx = libnet_context_init(ev, global_loadparm); /* IF we generated a new event context, it will be under here, * and we need it to last as long as the libnet context, so * make it a child */ diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 049494cba6..535c1d2e34 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -158,7 +158,8 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv) ev = event_context_find(mprMemCtx()); - status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev); + status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev, + global_loadparm); if (!NT_STATUS_IS_OK(status)) goto done; /* callers don't allocate ref vars in the ejs interface */ diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index c75050eb55..ff1fbcab78 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -83,7 +83,7 @@ bool torture_domainopen(struct torture_context *torture) mem_ctx = talloc_init("test_domain_open"); evt_ctx = event_context_find(torture); - net_ctx = libnet_context_init(evt_ctx); + net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx); status = torture_rpc_connection(torture, &net_ctx->samr.pipe, diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 2b8fef0178..1eaed12701 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -258,8 +258,8 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, DEBUG(0,("Open the SAM LDB with system credentials: %s\n", s->path.samdb_ldb)); - s->ldb = ldb_wrap_connect(s, global_loadparm, s->path.samdb_ldb, - system_session(s, global_loadparm), + s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, s->path.samdb_ldb, + system_session(s, s->tctx->lp_ctx), NULL, 0, NULL); if (!s->ldb) { DEBUG(0,("Failed to open '%s'\n", @@ -758,7 +758,7 @@ bool torture_net_become_dc(struct torture_context *torture) return false; } - s->ctx = libnet_context_init(torture->ev); + s->ctx = libnet_context_init(torture->ev, torture->lp_ctx); s->ctx->cred = cmdline_credentials; s->ldb = ldb_init(s); diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index 6ec5302d91..3c8d574f0e 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -136,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) of specific server name. */ domain_name = lp_workgroup(torture->lp_ctx); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); return false; @@ -190,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_lsa"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc, - cmdline_credentials, NULL); + cmdline_credentials, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; @@ -255,7 +255,7 @@ bool torture_domain_open_samr(struct torture_context *torture) mem_ctx = talloc_init("test_domainopen_lsa"); - ctx = libnet_context_init(evt_ctx); + ctx = libnet_context_init(evt_ctx, torture->lp_ctx); ctx->cred = cmdline_credentials; /* we're accessing domain controller so the domain name should be @@ -320,7 +320,7 @@ bool torture_domain_close_samr(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -331,7 +331,7 @@ bool torture_domain_close_samr(struct torture_context *torture) mem_ctx = talloc_init("torture_domain_close_samr"); status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr, - ctx->cred, NULL); + ctx->cred, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("failed to connect to server: %s\n", nt_errstr(status)); ret = false; @@ -388,7 +388,7 @@ bool torture_domain_list(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index 5029d77dd6..02fc0f7fd5 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -216,7 +216,7 @@ bool torture_groupinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture group info"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index 6b4c03beb7..e4473b0fdd 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -40,7 +40,7 @@ bool torture_lookup(struct torture_context *torture) mem_ctx = talloc_init("test_lookup"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -84,7 +84,7 @@ bool torture_lookup_host(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_host"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -127,7 +127,7 @@ bool torture_lookup_pdc(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_pdc"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; talloc_steal(ctx, mem_ctx); @@ -171,7 +171,7 @@ bool torture_lookup_sam_name(struct torture_context *torture) struct libnet_context *ctx; struct libnet_LookupName r; - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; mem_ctx = talloc_init("torture lookup sam name"); diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 1e042c77a6..282837d3fe 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture, { struct libnet_context *ctx; - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; d_printf("Testing connection to LSA interface\n"); diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index d18e6ea9db..d693430b05 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -131,7 +131,7 @@ bool torture_listshares(struct torture_context *torture) goto done; } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, torture->lp_ctx); if (!libnetctx) { printf("Couldn't allocate libnet context\n"); ret = false; @@ -209,7 +209,7 @@ bool torture_delshare(struct torture_context *torture) status = torture_rpc_binding(torture, &bind); torture_assert_ntstatus_ok(torture, status, "Failed to get binding"); - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, torture->lp_ctx); libnetctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index f4c3bd9918..8671e438b7 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -241,7 +241,7 @@ bool torture_createuser(struct torture_context *torture) mem_ctx = talloc_init("test_createuser"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -287,7 +287,7 @@ bool torture_deleteuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -475,7 +475,7 @@ bool torture_modifyuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -609,7 +609,7 @@ bool torture_userinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture user info"); - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -674,7 +674,7 @@ bool torture_userlist(struct torture_context *torture) struct libnet_UserList req; int i; - ctx = libnet_context_init(NULL); + ctx = libnet_context_init(NULL, torture->lp_ctx); ctx->cred = cmdline_credentials; domain_name.string = lp_workgroup(torture->lp_ctx); diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 70743bd433..1ca3c62df0 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -78,7 +78,7 @@ bool torture_async_bind(struct torture_context *torture) for (i = 0; i < torture_numasync; i++) { table[i] = &ndr_table_lsarpc; bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, - table[i], creds, evt_ctx); + table[i], creds, evt_ctx, torture->lp_ctx); } /* recv bind requests */ diff --git a/source4/torture/rpc/bind.c b/source4/torture/rpc/bind.c index 1800901873..55c9d3686d 100644 --- a/source4/torture/rpc/bind.c +++ b/source4/torture/rpc/bind.c @@ -64,7 +64,8 @@ bool torture_multi_bind(struct torture_context *torture) return false; } - status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials); + status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials, + torture->lp_ctx); if (NT_STATUS_IS_OK(status)) { printf("(incorrectly) allowed re-bind to uuid %s - %s\n", diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index e169876b2b..dc2601d86e 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -44,6 +44,7 @@ }\ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, + struct torture_context *tctx, const char *host, const char *sharename, const char *dir) @@ -55,7 +56,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, printf("Creating share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL))) { + if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { return false; } @@ -85,6 +86,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, } static bool test_NetShareDel(TALLOC_CTX *mem_ctx, + struct torture_context *tctx, const char *host, const char *sharename) { @@ -94,7 +96,7 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx, printf("Deleting share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL))) { + if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { return false; } @@ -491,7 +493,7 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p, printf("Cleaning up StdRoot\n"); test_RemoveStdRoot(p, mem_ctx, host, sharename); - test_NetShareDel(mem_ctx, host, sharename); + test_NetShareDel(mem_ctx, tctx, host, sharename); torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", NULL); test_DeleteDir(cli, dir); torture_close_connection(cli); @@ -513,11 +515,11 @@ static bool test_StdRoot(struct dcerpc_pipe *p, test_cleanup_stdroot(p, mem_ctx, tctx, host, sharename, dir); ret &= test_CreateDir(mem_ctx, &cli, tctx, host, "C$", dir); - ret &= test_NetShareAdd(mem_ctx, host, sharename, path); + ret &= test_NetShareAdd(mem_ctx, tctx, host, sharename, path); ret &= test_AddStdRoot(p, mem_ctx, host, sharename); ret &= test_RemoveStdRoot(p, mem_ctx, host, sharename); ret &= test_AddStdRootForced(p, mem_ctx, host, sharename); - ret &= test_NetShareDel(mem_ctx, host, sharename); + ret &= test_NetShareDel(mem_ctx, tctx, host, sharename); ret &= test_DeleteDir(cli, dir); torture_close_connection(cli); diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 14164321b9..c0deb13570 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -182,7 +182,7 @@ static bool _test_DsBind(struct DsSyncTest *ctx, struct cli_credentials *credent status = dcerpc_pipe_connect_b(ctx, &b->pipe, ctx->drsuapi_binding, &ndr_table_drsuapi, - credentials, event); + credentials, event, global_loadparm); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index 4ae4ac3b34..d4b5fa9c6f 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -220,7 +220,7 @@ bool torture_rpc_mgmt(struct torture_context *torture) printf("\nTesting pipe '%s'\n", l->table->name); - status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL); + status = dcerpc_epm_map_binding(loop_ctx, b, l->table, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to map port for uuid %s\n", GUID_string(loop_ctx, &l->table->syntax_id.uuid)); diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index c0c75ab21a..198c888f17 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx, status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL); + cmdline_credentials, NULL, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { printf("Failed to connect to remote server: %s %s\n", @@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx, binding->assoc_group_id = assoc_group_id; status = dcerpc_pipe_connect_b(tctx, p, binding, table, - cmdline_credentials, NULL); + cmdline_credentials, NULL, tctx->lp_ctx); if (NT_STATUS_IS_ERR(status)) { *p = NULL; @@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL); + tcase_data->credentials, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); @@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx, &(tcase_data->pipe), binding, tcase->table, - tcase_data->credentials, NULL); + tcase_data->credentials, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 184125b493..96ed03fc6f 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -51,20 +51,6 @@ #include "param/param.h" #include "lib/registry/registry.h" -static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx) -{ - struct cli_credentials *result; - - if (!(result = cli_credentials_init(mem_ctx))) { - return NULL; - } - - cli_credentials_set_conf(result, global_loadparm); - cli_credentials_set_anonymous(result); - - return result; -} - /* * This tests a RPC call using an invalid vuid */ @@ -153,7 +139,7 @@ bool torture_bind_authcontext(struct torture_context *torture) goto done; } - if (!(anon_creds = create_anon_creds(mem_ctx))) { + if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) { d_printf("create_anon_creds failed\n"); goto done; } @@ -199,6 +185,7 @@ bool torture_bind_authcontext(struct torture_context *torture) static bool bindtest(struct smbcli_state *cli, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, uint8_t auth_type, uint8_t auth_level) { TALLOC_CTX *mem_ctx; @@ -232,7 +219,7 @@ static bool bindtest(struct smbcli_state *cli, } status = dcerpc_bind_auth(lsa_pipe, &ndr_table_lsarpc, - credentials, auth_type, auth_level, + credentials, lp_ctx, auth_type, auth_level, NULL); if (!NT_STATUS_IS_OK(status)) { d_printf("dcerpc_bind_auth failed: %s\n", nt_errstr(status)); @@ -310,13 +297,13 @@ bool torture_bind_samba3(struct torture_context *torture) ret = true; - ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP, + ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_INTEGRITY); - ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP, + ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_PRIVACY); - ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO, + ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO, DCERPC_AUTH_LEVEL_INTEGRITY); - ret &= bindtest(cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO, + ret &= bindtest(cli, cmdline_credentials, torture->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO, DCERPC_AUTH_LEVEL_PRIVACY); done: @@ -330,6 +317,7 @@ bool torture_bind_samba3(struct torture_context *torture) static NTSTATUS get_usr_handle(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, struct cli_credentials *admin_creds, uint8_t auth_type, uint8_t auth_level, @@ -372,7 +360,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli, if (admin_creds != NULL) { status = dcerpc_bind_auth(samr_pipe, &ndr_table_samr, - admin_creds, auth_type, auth_level, + admin_creds, lp_ctx, auth_type, auth_level, NULL); if (!NT_STATUS_IS_OK(status)) { d_printf("dcerpc_bind_auth failed: %s\n", @@ -504,6 +492,7 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli, */ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, + struct loadparm_context *lp_ctx, struct cli_credentials *admin_creds, const char *username, const char *password, char **domain_name, @@ -520,7 +509,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, return false; } - status = get_usr_handle(cli, tmp_ctx, admin_creds, + status = get_usr_handle(cli, tmp_ctx, lp_ctx, admin_creds, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_INTEGRITY, username, domain_name, &samr_pipe, &wks_handle, @@ -616,6 +605,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, */ static bool delete_user(struct smbcli_state *cli, + struct loadparm_context *lp_ctx, struct cli_credentials *admin_creds, const char *username) { @@ -631,7 +621,7 @@ static bool delete_user(struct smbcli_state *cli, return false; } - status = get_usr_handle(cli, mem_ctx, admin_creds, + status = get_usr_handle(cli, mem_ctx, lp_ctx, admin_creds, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_INTEGRITY, username, &dom_name, &samr_pipe, @@ -667,6 +657,7 @@ static bool delete_user(struct smbcli_state *cli, */ static bool join3(struct smbcli_state *cli, + struct loadparm_context *lp_ctx, bool use_level25, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) @@ -684,7 +675,7 @@ static bool join3(struct smbcli_state *cli, } status = get_usr_handle( - cli, mem_ctx, admin_creds, + cli, mem_ctx, lp_ctx, admin_creds, DCERPC_AUTH_TYPE_NTLMSSP, DCERPC_AUTH_LEVEL_PRIVACY, talloc_asprintf(mem_ctx, "%s$", @@ -908,6 +899,7 @@ static bool auth2(struct smbcli_state *cli, */ static bool schan(struct smbcli_state *cli, + struct loadparm_context *lp_ctx, struct cli_credentials *wks_creds, struct cli_credentials *user_creds) { @@ -944,7 +936,7 @@ static bool schan(struct smbcli_state *cli, #if 1 net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL); status = dcerpc_bind_auth(net_pipe, &ndr_table_netlogon, - wks_creds, DCERPC_AUTH_TYPE_SCHANNEL, + wks_creds, lp_ctx, DCERPC_AUTH_TYPE_SCHANNEL, DCERPC_AUTH_LEVEL_PRIVACY, NULL); #else @@ -1105,6 +1097,7 @@ static bool schan(struct smbcli_state *cli, */ static bool leave(struct smbcli_state *cli, + struct loadparm_context *lp_ctx, struct cli_credentials *admin_creds, struct cli_credentials *wks_creds) { @@ -1112,7 +1105,7 @@ static bool leave(struct smbcli_state *cli, NULL, "%s$", cli_credentials_get_workstation(wks_creds)); bool ret; - ret = delete_user(cli, admin_creds, wks_name); + ret = delete_user(cli, lp_ctx, admin_creds, wks_name); talloc_free(wks_name); return ret; } @@ -1144,7 +1137,7 @@ bool torture_netlogon_samba3(struct torture_context *torture) return false; } - if (!(anon_creds = create_anon_creds(mem_ctx))) { + if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) { d_printf("create_anon_creds failed\n"); goto done; } @@ -1172,7 +1165,7 @@ bool torture_netlogon_samba3(struct torture_context *torture) generate_random_str(wks_creds, 8), CRED_SPECIFIED); - if (!join3(cli, false, cmdline_credentials, wks_creds)) { + if (!join3(cli, torture->lp_ctx, false, cmdline_credentials, wks_creds)) { d_printf("join failed\n"); goto done; } @@ -1195,14 +1188,14 @@ bool torture_netlogon_samba3(struct torture_context *torture) } for (j=0; j<2; j++) { - if (!schan(cli, wks_creds, cmdline_credentials)) { + if (!schan(cli, torture->lp_ctx, wks_creds, cmdline_credentials)) { d_printf("schan failed\n"); goto done; } } } - if (!leave(cli, cmdline_credentials, wks_creds)) { + if (!leave(cli, torture->lp_ctx, cmdline_credentials, wks_creds)) { d_printf("leave failed\n"); goto done; } @@ -1253,7 +1246,7 @@ static bool test_join3(struct torture_context *tctx, generate_random_str(wks_creds, 8), CRED_SPECIFIED); - if (!join3(cli, use_level25, samr_creds, wks_creds)) { + if (!join3(cli, tctx->lp_ctx, use_level25, samr_creds, wks_creds)) { d_printf("join failed\n"); goto done; } @@ -1267,7 +1260,7 @@ static bool test_join3(struct torture_context *tctx, goto done; } - if (!leave(cli, samr_creds, wks_creds)) { + if (!leave(cli, tctx->lp_ctx, samr_creds, wks_creds)) { d_printf("leave failed\n"); goto done; } @@ -1293,7 +1286,7 @@ bool torture_samba3_sessionkey(struct torture_context *torture) wks_name = torture_setting_string(torture, "wksname", get_myname()); - if (!(anon_creds = create_anon_creds(torture))) { + if (!(anon_creds = cli_credentials_init_anon(torture))) { d_printf("create_anon_creds failed\n"); goto done; } @@ -1611,7 +1604,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) talloc_free(cli); - if (!(anon_creds = create_anon_creds(mem_ctx))) { + if (!(anon_creds = cli_credentials_init_anon(mem_ctx))) { d_printf("(%s) create_anon_creds failed\n", __location__); ret = false; goto done; @@ -1655,7 +1648,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) generate_random_str(user_creds, 8), CRED_SPECIFIED); - if (!create_user(mem_ctx, cli, cmdline_credentials, + if (!create_user(mem_ctx, cli, torture->lp_ctx, cmdline_credentials, cli_credentials_get_username(user_creds), cli_credentials_get_password(user_creds), &domain_name, &created_sid)) { @@ -1720,7 +1713,8 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture) } delete: - if (!delete_user(cli, cmdline_credentials, + if (!delete_user(cli, torture->lp_ctx, + cmdline_credentials, cli_credentials_get_username(user_creds))) { d_printf("(%s) delete_user failed\n", __location__); ret = false; diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index e7f14a89e2..b60cef7d53 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1598,7 +1598,7 @@ bool torture_rpc_samlogon(struct torture_context *torture) status = dcerpc_pipe_connect_b(mem_ctx, &p, b, &ndr_table_netlogon, - machine_credentials, NULL); + machine_credentials, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c index e64d6a6bce..97fe16101d 100644 --- a/source4/torture/rpc/samr_accessmask.c +++ b/source4/torture/rpc/samr_accessmask.c @@ -292,7 +292,7 @@ static bool test_samr_connect_user_acl(struct torture_context *tctx, /* Try to connect as the test user */ status = dcerpc_pipe_connect(tctx, &test_p, binding, &ndr_table_samr, - test_credentials, NULL); + test_credentials, NULL, tctx->lp_ctx); /* connect to SAMR as the user */ status = torture_samr_Connect5(tctx, test_p, SEC_FLAG_MAXIMUM_ALLOWED, &uch); if (!NT_STATUS_IS_OK(status)) { @@ -357,7 +357,7 @@ static bool test_samr_connect_user_acl_enforced(struct torture_context *tctx, status = dcerpc_pipe_connect(tctx, &test_p, binding, &ndr_table_samr, - test_credentials, NULL); + test_credentials, NULL, tctx->lp_ctx); /* connect to SAMR as the user */ status = torture_samr_Connect5(tctx, test_p, SAMR_ACCESS_SHUTDOWN_SERVER, &uch); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index d1d95ce8fd..e94f228589 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -1558,7 +1558,7 @@ bool torture_rpc_samsync(struct torture_context *torture) status = dcerpc_pipe_connect_b(samsync_state, &samsync_state->p, b, &ndr_table_netlogon, - credentials, NULL); + credentials, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status)); @@ -1596,7 +1596,7 @@ bool torture_rpc_samsync(struct torture_context *torture) &samsync_state->p_netlogon_wksta, b_netlogon_wksta, &ndr_table_netlogon, - credentials_wksta, NULL); + credentials_wksta, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status)); diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index a47fbdd667..03a2c9fd07 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -120,7 +120,7 @@ bool torture_rpc_scanner(struct torture_context *torture) printf("\nTesting pipe '%s'\n", l->table->name); if (b->transport == NCACN_IP_TCP) { - status = dcerpc_epm_map_binding(torture, b, l->table, NULL); + status = dcerpc_epm_map_binding(torture, b, l->table, NULL, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to map port for uuid %s\n", GUID_string(loop_ctx, &l->table->syntax_id.uuid)); diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 39cffc8e2a..6b0cbbf525 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -255,7 +255,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr, - credentials, NULL); + credentials, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -267,15 +267,16 @@ static bool test_schannel(struct torture_context *tctx, * the second */ /* Swap the binding details from SAMR to NETLOGON */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm map"); status = dcerpc_secondary_connection(p, &p_netlogon, b); torture_assert_ntstatus_ok(tctx, status, "seconday connection"); - status = dcerpc_bind_auth(p_netlogon, &ndr_table_netlogon, - credentials, DCERPC_AUTH_TYPE_SCHANNEL, + status = dcerpc_bind_auth(p_netlogon, &ndr_table_netlogon, + credentials, tctx->lp_ctx, + DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p->conn), NULL); @@ -292,7 +293,7 @@ static bool test_schannel(struct torture_context *tctx, "Failed to process schannel secured NETLOGON EX ops"); /* Swap the binding details from SAMR to LSARPC */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm map"); status = dcerpc_secondary_connection(p, &p_lsa, @@ -301,7 +302,8 @@ static bool test_schannel(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, status, "seconday connection"); status = dcerpc_bind_auth(p_lsa, &ndr_table_lsarpc, - credentials, DCERPC_AUTH_TYPE_SCHANNEL, + credentials, tctx->lp_ctx, + DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p->conn), NULL); @@ -323,7 +325,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags |= dcerpc_flags; status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr, - credentials, NULL); + credentials, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect with schannel"); @@ -332,7 +334,7 @@ static bool test_schannel(struct torture_context *tctx, "Failed to process schannel secured SAMR ops (on fresh connection)"); /* Swap the binding details from SAMR to NETLOGON */ - status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL); + status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "epm"); status = dcerpc_secondary_connection(p_samr2, &p_netlogon2, @@ -341,7 +343,8 @@ static bool test_schannel(struct torture_context *tctx, /* and now setup an SCHANNEL bind on netlogon */ status = dcerpc_bind_auth(p_netlogon2, &ndr_table_netlogon, - credentials, DCERPC_AUTH_TYPE_SCHANNEL, + credentials, tctx->lp_ctx, + DCERPC_AUTH_TYPE_SCHANNEL, dcerpc_auth_level(p_samr2->conn), NULL); @@ -364,7 +367,7 @@ static bool test_schannel(struct torture_context *tctx, b->flags &= ~DCERPC_AUTH_OPTIONS; status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon, - credentials, NULL); + credentials, NULL, tctx->lp_ctx); torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel"); torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds), @@ -447,12 +450,12 @@ bool torture_rpc_schannel2(struct torture_context *torture) printf("Opening first connection\n"); status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon, - credentials1, NULL); + credentials1, NULL, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); torture_comment(torture, "Opening second connection\n"); status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon, - credentials2, NULL); + credentials2, NULL, torture->lp_ctx); torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel"); credentials1->netlogon_creds = NULL; diff --git a/source4/torture/rpc/session_key.c b/source4/torture/rpc/session_key.c index 765458c62a..44c3ae2358 100644 --- a/source4/torture/rpc/session_key.c +++ b/source4/torture/rpc/session_key.c @@ -158,7 +158,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data) binding->flags |= settings->bindoptions; torture_assert_ntstatus_ok(torture, - dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL), + dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx), "connect"); if (!test_lsa_OpenPolicy2(p, torture, &handle)) { diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 23a737c042..02f04946d6 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -142,7 +142,7 @@ struct test_join *torture_create_testuser(struct torture_context *torture, &join->p, dc_binding, &ndr_table_samr, - cmdline_credentials, NULL); + cmdline_credentials, NULL, torture->lp_ctx); } else { status = torture_rpc_connection(torture, @@ -320,7 +320,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx, return NULL; } - libnet_ctx = libnet_context_init(NULL); + libnet_ctx = libnet_context_init(NULL, tctx->lp_ctx); if (!libnet_ctx) { talloc_free(tj); return NULL; diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index 6d833f8e93..08a4fbd4a1 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -57,7 +57,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv) domain_name = tmp; - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c index 4547aac6fd..1fcb772e4c 100644 --- a/source4/utils/net/net_password.c +++ b/source4/utils/net/net_password.c @@ -52,7 +52,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -127,7 +127,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv new_password = getpass(password_prompt); } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index e14b6e5759..1f4bb3ed71 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -42,7 +42,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index a8d13c0315..39d50e7d8b 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -43,7 +43,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL); + lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; @@ -83,7 +83,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv) } /* libnet context init and its params */ - lnet_ctx = libnet_context_init(NULL); + lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx); if (!lnet_ctx) return -1; lnet_ctx->cred = ctx->credentials; diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c index 4e0f1501d9..c798112d7b 100644 --- a/source4/utils/net/net_vampire.c +++ b/source4/utils/net/net_vampire.c @@ -53,7 +53,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar break; } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -99,7 +99,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv) return rc; } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -141,7 +141,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv) struct libnet_context *libnetctx; struct libnet_samsync_ldb r; - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } diff --git a/source4/winbind/wb_connect_sam.c b/source4/winbind/wb_connect_sam.c index 49861b3c33..efd715b164 100644 --- a/source4/winbind/wb_connect_sam.c +++ b/source4/winbind/wb_connect_sam.c @@ -70,7 +70,8 @@ struct composite_context *wb_connect_samr_send(TALLOC_CTX *mem_ctx, ctx = dcerpc_secondary_auth_connection_send(domain->netlogon_pipe, domain->samr_binding, &ndr_table_samr, - domain->libnet_ctx->cred); + domain->libnet_ctx->cred, + domain->libnet_ctx->lp_ctx); composite_continue(state->ctx, ctx, connect_samr_recv_pipe, state); return result; diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index fbc2c0c80a..c3a2ed6a69 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -101,7 +101,8 @@ static struct dcerpc_binding *init_domain_binding(struct init_domain_state *stat binding->host = state->domain->dc_address; /* This shouldn't make a network call, as the mappings for named pipes are well known */ - status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx); + status = dcerpc_epm_map_binding(binding, binding, table, state->service->task->event_ctx, + state->service->task->lp_ctx); if (!NT_STATUS_IS_OK(status)) { return NULL; } @@ -143,7 +144,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx, state->domain->dc_name = dom_info->dcs[0].name; state->domain->dc_address = dom_info->dcs[0].address; - state->domain->libnet_ctx = libnet_context_init(service->task->event_ctx); + state->domain->libnet_ctx = libnet_context_init(service->task->event_ctx, + service->task->lp_ctx); /* Create a credentials structure */ state->domain->libnet_ctx->cred = cli_credentials_init(state->domain); @@ -182,7 +184,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx, ctx = dcerpc_pipe_connect_b_send(state, state->domain->netlogon_binding, &ndr_table_netlogon, state->domain->libnet_ctx->cred, - service->task->event_ctx); + service->task->event_ctx, + service->task->lp_ctx); if (composite_nomem(ctx, state->ctx)) { goto failed; @@ -229,7 +232,8 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx) ctx = dcerpc_secondary_auth_connection_send(state->domain->netlogon_pipe, state->domain->lsa_binding, &ndr_table_lsarpc, - state->domain->libnet_ctx->cred + state->domain->libnet_ctx->cred, + state->domain->libnet_ctx->lp_ctx ); composite_continue(state->ctx, ctx, init_domain_recv_lsa_pipe, state); } @@ -255,7 +259,8 @@ static bool retry_with_schannel(struct init_domain_state *state, ctx = dcerpc_secondary_auth_connection_send(state->domain->netlogon_pipe, binding, table, - state->domain->libnet_ctx->cred); + state->domain->libnet_ctx->cred, + state->domain->libnet_ctx->lp_ctx); composite_continue(state->ctx, ctx, continuation, state); return true; } else { -- cgit