r26327: Explicit loadparm_context for RPC client functions.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 7 Dec 2007 01:37:04 +0000 (02:37 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:48:41 +0000 (05:48 +0100)
52 files changed:
source/client/client.c
source/dsdb/repl/drepl_out_helpers.c
source/lib/registry/registry.h
source/lib/registry/rpc.c
source/lib/registry/tools/regdiff.c
source/libnet/libnet.c
source/libnet/libnet.h
source/libnet/libnet_become_dc.c
source/libnet/libnet_join.c
source/libnet/libnet_rpc.c
source/libnet/libnet_unbecome_dc.c
source/libnet/libnet_vampire.c
source/librpc/rpc/dcerpc.i
source/librpc/rpc/dcerpc_auth.c
source/librpc/rpc/dcerpc_connect.c
source/librpc/rpc/dcerpc_schannel.c
source/librpc/rpc/dcerpc_secondary.c
source/librpc/rpc/dcerpc_util.c
source/librpc/rpc/dcerpc_wrap.c
source/rpc_server/remote/dcesrv_remote.c
source/rpc_server/spoolss/dcesrv_spoolss.c
source/scripting/ejs/ejsnet/net_ctx.c
source/scripting/ejs/smbcalls_rpc.c
source/torture/libnet/domain.c
source/torture/libnet/libnet_BecomeDC.c
source/torture/libnet/libnet_domain.c
source/torture/libnet/libnet_group.c
source/torture/libnet/libnet_lookup.c
source/torture/libnet/libnet_rpc.c
source/torture/libnet/libnet_share.c
source/torture/libnet/libnet_user.c
source/torture/rpc/async_bind.c
source/torture/rpc/bind.c
source/torture/rpc/dfs.c
source/torture/rpc/dssync.c
source/torture/rpc/mgmt.c
source/torture/rpc/rpc.c
source/torture/rpc/samba3rpc.c
source/torture/rpc/samlogon.c
source/torture/rpc/samr_accessmask.c
source/torture/rpc/samsync.c
source/torture/rpc/scanner.c
source/torture/rpc/schannel.c
source/torture/rpc/session_key.c
source/torture/rpc/testjoin.c
source/utils/net/net_join.c
source/utils/net/net_password.c
source/utils/net/net_time.c
source/utils/net/net_user.c
source/utils/net/net_vampire.c
source/winbind/wb_connect_sam.c
source/winbind/wb_init_domain.c

index 6debaac2e90ceb4f4152ba6f9713923e7c7844af..6842e2e91dbcb75bbf790d0c1d05624e6cec5e2d 100644 (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) {
index fce61d1184ef41a39d71bff339cc38339a7c21f4..aede6e659500f513e347f7cb0dca3b165a2266a0 100644 (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;
index c53e3dfbe539bfbe51a964ffb2386081020b5963..edd6c6713f1ed348b72a3ad2750997448190928f 100644 (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);
index c694223909c02c900f33afc5e732d707ae090c80..ac0eecd0acfca3e328ae25812bc184cf41e9d603 100644 (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)) {
index 1996861a2a62afd62dd6dcdd3a36801eef44b526..ea4b754fe748c94fb4120dc9e8bf22b6b7902bd4 100644 (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:
index 86804df1ea40b938d9eca8f5ae4ec95f3194eb90..45025992178c729b27ffc1c4ca3c5afd73ec9437 100644 (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));
index 56a7d0ba2019f83115e722829894c88f81bdddfa..4f3acc601097f2a155464b9c85cf2cf66ea79c89 100644 (file)
@@ -50,6 +50,8 @@ struct libnet_context {
        const char **name_res_methods;
 
        struct event_context *event_ctx;
+
+       struct loadparm_context *lp_ctx;
 };
 
 
index 0f8b86fddf840263a0fb7958f4d05849927c028a..a691fca42088361ba2f418c1c39d257c93494025 100644 (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);
 }
 
index 25ad0ca440244f6027ab13f4cacd01aad57da709..2f14799cedc22cca7d5fdbd3f535241628bcfeb5 100644 (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",
index 85dd6c43e78bf29d7dbb9c1f922fd5038713bb4b..667f54c447444b9b57944af1c6a0551dea40fa21 100644 (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);
index a7b962f2a8ecd780b9aa651b0823a774aeb3b199..a39df4f2544fc8ed318015f107013ca85057ce8b 100644 (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);
 }
 
index fbb7c8b6e5d9e8056fb9bf1f0ab1278b9246dc8a..e4c883315690faecebc76eee7398e0a9053479d6 100644 (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,
index 4a58b4308550d459674022b361e3b725d1c649f7..862ba7d1b2b265ff84bf0850db19b326e7c3bf4e 100644 (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);
index 0012b38f2e17cf18b66a0a6803e3fbf93554dadc..f80ef86413ca55254c00f1ec532663c44a839c66 100644 (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);
 }
index b9913106f0b8c4439505517afc439c108a91c1d1..c39a944fdb5c9c74d5789ef72428381778c49c8c 100644 (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);
 }
 
index c6b3a5fc0f380cf0302ee4b1c1eac3c4f7672d71..fadf0add8cfeade9e0e4a43b71796647c30252b0 100644 (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);
 }
index 4d3547b60c65f12c7701cd41e6eb1a994b98c7b3..1c4de0a2f25a420680a154b4632483ad01b662a5 100644 (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);
        
 }
index 6c23ec20a0db636710770d7b69468460cbec91b4..32cee4308e9bfd4d35dea9833c96b1e528e37c04 100644 (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);
 }
 
index 48dd3b30a87852ce53ed969636a9ca6dc5591d55..c9eb72fb9e29b686724ba73d8975393570ecf5ba 100644 (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
index 613b53519af6cf3e8a4e6f004cab79bdceedd23b..3b5c0a02aec80b64c626e3444b9f7b090342ebef 100644 (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)) {
index bd30f231bf17e707fb5558111750d4ac81be3b66..33a42dddab6aa9a8cf4e6ee353ec1b0486462147 100644 (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));
index 97a05ab88f63a147b104612a7793ccedbcbf3e9b..396718367ac1315106a1d3b1b7fee9a7396a171e 100644 (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 */
index 049494cba636e00e8e84a8b107ac654ed3a6fe30..535c1d2e34aa14a0769733bb4da034220f85dc74 100644 (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 */
index c75050eb55812bf2c6aa07c4acb244a1386a932a..ff1fbcab7885e11b1a66100d82c46044edb1a56d 100644 (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,
index 2b8fef01789604d8d857b13b88b63e2bdd4a1b7a..1eaed12701110d8b7b1fe47b1eaed88024e53768 100644 (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);
index 6ec5302d91d0f1f00648f91470e9631c943ba7af..3c8d574f0ec61fe4926fb0cf9e0b9264c9c3985c 100644 (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;
index 5029d77dd6ec5f17c2ed8e9ee374b71b6ea1dc91..02fc0f7fd5210e94c0dacbf3b31dcfe88e4477f6 100644 (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,
index 6b4c03beb71bd9adff80170c5d96bc875c162277..e4473b0fdd6f910f9aeba3c824b257592b4a7ab2 100644 (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");
index 1e042c77a6453a5522bf3979971e0b50769fa008..282837d3fe9f0779fe4564b0d26d8b61515bc914 100644 (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");
index d18e6ea9db93dfde530a6bfe1dd38cb0ca4855b1..d693430b0560fcfb81074c5266715abeff21460b 100644 (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,
index f4c3bd9918eec98c2296a3cd3d946d438ac0fd62..8671e438b7ad3cbc16035db7072b76cece3320ae 100644 (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);
index 70743bd433992a61932b729d62122771cee035b7..1ca3c62df0af87b881213a78f70ed2c2889f252d 100644 (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 */
index 180090187375457e01e6be0aa105fdd8b578259f..55c9d3686d1e99efba8d4404738c4b6d31e98e3c 100644 (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", 
index e169876b2b382b9b5b06e353aec1d7406aa951e3..dc2601d86e6110d4ce99935bdc73f6fa1f024be2 100644 (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);
index 14164321b9491298160505abd39f18684eeb3eff..c0deb135703c7de9db0d407083d8fcfd27305f18 100644 (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));
index 4ae4ac3b3442a564ab8d32b27e6426d6408faef0..d4b5fa9c6feddc3d5119b3bfcf3369eff5b88ad1 100644 (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));
index c0c75ab21abf07df030fae05fd1f214a49b80805..198c888f170cde084d2ac615eeb57f7738cffe5f 100644 (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");
 
index 184125b493bdc7dc78b76e1c6790312ce52bc8de..96ed03fc6f382c246094490f5ed716c9e276e631 100644 (file)
 #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;
index e7f14a89e25313a93dfc0ca1b5fda6343b9eedfd..b60cef7d53082bf3fbe9adcbeda35e9da15e6818 100644 (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));
index e64d6a6bce7fa93d583880f844a711dfbe6c1e4f..97fe16101d3f36a9dcd7dd58361defe648ef130e 100644 (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);
index d1d95ce8fd10e962f2ba2a61da30c9148fc9ab1b..e94f2285897f511b4919250f25d29ca790511d39 100644 (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));
index a47fbdd667bfd4e8d6ce1bea163d0ae471067cdf..03a2c9fd078e2bde8468a794afec0c8d3ca4ab79 100644 (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));
index 39cffc8e2ae224826024db0ab017e73c3113ebc0..6b0cbbf52543f02340f0ae65b77af196ac9411a8 100644 (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;
index 765458c62a2378df0f61557776bf21e5ec28e3fd..44c3ae2358eaa4392f9c38c626ea8384fd5db7d3 100644 (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)) {
index 23a737c042f9631c952e92f1dfcc3b15d32c3bf0..02f04946d6e2adc2f6f56fee4246258a2eef5335 100644 (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;
index 6d833f8e93c95406cccb5075394cb1327bf21af5..08a4fbd4a16bd578994cc88c03044bec286c17cb 100644 (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;      
        }
index 4547aac6fda48da127ee1f0c7fd7e1d1398c1bad..1fcb772e4c2b016c2037807906f4358ba741fdee 100644 (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;      
        }
index e14b6e57592eaf1a16dbb2cb2a46af985c0cc4d5..1f4bb3ed71ce4435dbd0679cd716a96d8bd55819 100644 (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;      
        }
index a8d13c0315bb70ebe69e9d09c80269273a2ad703..39d50e7d8bfdace8348091ca12b2a7fae5574b6f 100644 (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;
index 4e0f1501d94b63f55ae3350c191e5a498886ab93..c798112d7b0eb5f85c95f657d4ace50a4db6db87 100644 (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;      
        }
index 49861b3c33ab5b760dde44674a158df7ae46eb59..efd715b1648d643be54b413e998139505a524296 100644 (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;
        
index fbc2c0c80a4fa80d6d347d8a7521fc761fe0d3c7..c3a2ed6a691d8bcc379f0f97f8283afb1f313bd4 100644 (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 {