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

r26327: Explicit loadparm_context for RPC client functions.

(This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07)
This commit is contained in:
Jelmer Vernooij 2007-12-07 02:37:04 +01:00 committed by Stefan Metzmacher
parent 485b24fc11
commit 4c4323009f
52 changed files with 218 additions and 164 deletions

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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)) {

View File

@ -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:

View File

@ -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));

View File

@ -50,6 +50,8 @@ struct libnet_context {
const char **name_res_methods;
struct event_context *event_ctx;
struct loadparm_context *lp_ctx;
};

View File

@ -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);
}

View File

@ -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",

View File

@ -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);

View File

@ -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);
}

View File

@ -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,

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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)) {

View File

@ -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));

View File

@ -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 */

View File

@ -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 */

View File

@ -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,

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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");

View File

@ -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");

View File

@ -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,

View File

@ -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);

View File

@ -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 */

View File

@ -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",

View File

@ -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);

View File

@ -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));

View File

@ -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));

View File

@ -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");

View File

@ -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;

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -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));

View File

@ -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;

View File

@ -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)) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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 {