r26440: Remove more uses of global_loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 13 Dec 2007 21:46:55 +0000 (22:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:50:08 +0000 (05:50 +0100)
14 files changed:
source/librpc/rpc/dcerpc_util.c
source/ntvfs/common/notify.c
source/ntvfs/ipc/rap_server.c
source/ntvfs/posix/vfs_posix.c
source/param/share.c
source/param/share.h
source/param/share_classic.c
source/param/share_ldb.c
source/param/tests/share.c
source/rpc_server/dcerpc_server.c
source/rpc_server/dcesrv_auth.c
source/rpc_server/srvsvc/dcesrv_srvsvc.c
source/rpc_server/srvsvc/srvsvc_ntvfs.c
source/smb_server/smb_server.c

index b8fcfb904aa68332dc32b036036a1f03b326430d..ecc6f19e8c0a94a104cd74919e0e1b909b5af8ac 100644 (file)
@@ -439,7 +439,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
 NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
 {
        TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
-       struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, lp_iconv_convenience(global_loadparm));
+       struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
        enum ndr_err_code ndr_err;
        uint16_t if_version=0;
 
@@ -466,7 +466,7 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_synta
 
 static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
 {
-       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
 
        ndr->flags |= LIBNDR_FLAG_NOALIGN;
 
index 187a349b4bf111ac8d7576a9b6c42efb9245a0fc..8bbf2d04b3fd2c8957ce77f133d46d8f1b1e9454 100644 (file)
@@ -82,6 +82,7 @@ static int notify_destructor(struct notify_context *notify)
 */
 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, 
                                   struct messaging_context *messaging_ctx,
+                                  struct loadparm_context *lp_ctx,
                                   struct event_context *ev,
                                   struct share_config *scfg)
 {
@@ -96,7 +97,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
                return NULL;
        }
 
-       notify->w = cluster_tdb_tmp_open(notify, global_loadparm, "notify.tdb", TDB_SEQNUM);
+       notify->w = cluster_tdb_tmp_open(notify, lp_ctx, "notify.tdb", TDB_SEQNUM);
        if (notify->w == NULL) {
                talloc_free(notify);
                return NULL;
index 9113bef894d1c515941d8cc8991ad22daa4b8986..7d3020a2590c86c61bcd4904a042230c1f712aa8 100644 (file)
@@ -41,7 +41,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
        r->out.available = 0;
        r->out.info = NULL;
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), global_loadparm, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return nterr;
        }
index 8e5e5a6942b1ff6ec577c19c56dcf45842de0eb2..e058e6f546d64167e6fd81e1cefb436f7d5f8966 100644 (file)
@@ -214,6 +214,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
        pvfs->notify_context = notify_init(pvfs, 
                                           pvfs->ntvfs->ctx->server_id,  
                                           pvfs->ntvfs->ctx->msg_ctx, 
+                                          pvfs->ntvfs->ctx->lp_ctx, 
                                           event_context_find(pvfs),
                                           pvfs->ntvfs->ctx->config);
 
index 4b747f85aef9bb381ee4b7da3c319d5744f6641f..2ada9999ea834ef0c67f8ba486af597f332cfdfb 100644 (file)
@@ -127,6 +127,7 @@ NTSTATUS share_register(const struct share_ops *ops)
 }
 
 NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+                                  struct loadparm_context *lp_ctx,
                                   struct share_context **ctx)
 {
        const struct share_ops *ops;
@@ -137,7 +138,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       return ops->init(mem_ctx, ops, ctx);
+       return ops->init(mem_ctx, ops, lp_ctx, ctx);
 }
 
 /*
index fae1c31c135846e84f2bbc0f13ca1f1e34cbae96..51f45781c150f72774c2f2c3f42ced38348c33e5 100644 (file)
@@ -49,7 +49,8 @@ struct share_info {
 
 struct share_ops {
        const char *name;
-       NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct share_context **);
+       NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct loadparm_context *lp_ctx,
+                        struct share_context **);
        const char *(*string_option)(struct share_config *, const char *, const char *);
        int (*int_option)(struct share_config *, const char *, int);
        bool (*bool_option)(struct share_config *, const char *, bool);
index 4a7fbcb263a1bce05dcfaf8764de8bd8f12c9be9..b517c9c4c25165d5d15a0bc39ef198ad4e014acb 100644 (file)
@@ -25,6 +25,7 @@
 
 static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, 
                              const struct share_ops *ops, 
+                             struct loadparm_context *lp_ctx,
                              struct share_context **ctx)
 {
        *ctx = talloc(mem_ctx, struct share_context);
@@ -34,7 +35,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx,
        }
 
        (*ctx)->ops = ops;
-       (*ctx)->priv_data = global_loadparm;
+       (*ctx)->priv_data = lp_ctx;
 
        return NT_STATUS_OK;
 }
index 487359eff6ba7a8ac09ad9c7cacbdc4f28492f00..bdea94a5cd46d3a04d1ffdafce9113066a2d76cc 100644 (file)
@@ -27,7 +27,8 @@
 #include "param/share.h"
 #include "param/param.h"
 
-static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx)
+static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct loadparm_context *lp_ctx,
+                         struct share_context **ctx)
 {
        struct ldb_context *sdb;
 
@@ -37,9 +38,9 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru
                return NT_STATUS_NO_MEMORY;
        }
        
-       sdb = ldb_wrap_connect(*ctx, global_loadparm
-                              private_path(*ctx, global_loadparm, "share.ldb"),
-                              system_session(*ctx, global_loadparm),
+       sdb = ldb_wrap_connect(*ctx, lp_ctx
+                              private_path(*ctx, lp_ctx, "share.ldb"),
+                              system_session(*ctx, lp_ctx),
                               NULL, 0, NULL);
 
        if (!sdb) {
index 1f8ecb2d8442a0ce31905a36b42f0bac7253a3ac..390da9dededd3fba6a425605155b1fd6401b2da5 100644 (file)
@@ -178,12 +178,12 @@ static void tcase_add_share_tests(struct torture_tcase *tcase)
 
 static bool setup_ldb(struct torture_context *tctx, void **data)
 {
-       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", (struct share_context **)data));
+       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->lp_ctx, (struct share_context **)data));
 }
 
 static bool setup_classic(struct torture_context *tctx, void **data)
 {
-       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", (struct share_context **)data));
+       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->lp_ctx, (struct share_context **)data));
 }
 
 static bool teardown(struct torture_context *tctx, void *data)
index cf89143b34f60e38e3b391d8e5a1c629d792d1ac..b043424faabe64afc40ca0be29934780262484f7 100644 (file)
@@ -822,7 +822,7 @@ static NTSTATUS dcesrv_request(struct dcesrv_call_state *call)
        }
 
        pull = ndr_pull_init_blob(&call->pkt.u.request.stub_and_verifier, call,
-                                 lp_iconv_convenience(global_loadparm));
+                                 lp_iconv_convenience(call->conn->dce_ctx->lp_ctx));
        NT_STATUS_HAVE_NO_MEMORY(pull);
 
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
@@ -885,7 +885,7 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
        }
 
        /* form the reply NDR */
-       push = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       push = ndr_push_init_ctx(call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx));
        NT_STATUS_HAVE_NO_MEMORY(push);
 
        /* carry over the pointer count to the reply in case we are
index b32481a1b7325acbc4fe1cbbf25a83fc33e45a7b..aa37de28265a2f2b823bbb64316c6beb0ff6256f 100644 (file)
@@ -406,7 +406,7 @@ bool dcesrv_auth_response(struct dcesrv_call_state *call,
                return NT_STATUS_IS_OK(status);
        }
 
-       ndr = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       ndr = ndr_push_init_ctx(call, lp_iconv_convenience(dce_conn->dce_ctx->lp_ctx));
        if (!ndr) {
                return false;
        }
index b9e097356af2726c12d9361c7e1ddcc7a40383eb..ebbeb2d0df8b89b6cbae4ca8ff2107af3a325c68 100644 (file)
@@ -444,7 +444,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                int count = 8;
                int i;
 
-               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
@@ -542,7 +542,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                int count = 10;
                int i;
 
-               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
@@ -734,7 +734,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call,
        /* TODO: - paging of results 
         */
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -983,7 +983,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
                return WERR_INVALID_PARAM;
        }
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1237,7 +1237,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call,
                return WERR_INVALID_PARAM;
        }
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1414,7 +1414,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA
        }
        all_string_sub(device, "\\", "/", 0);
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1828,7 +1828,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL
        /* TODO: - paging of results 
         */
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -2291,7 +2291,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL
        NTSTATUS nterr;
        struct share_context *sctx;
                
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
index c9c8e2e820707e1226417b42308dff558e4a9747..ccd6c4f74ebe094bfba2d35b8c6401c6bd91c693 100644 (file)
@@ -62,7 +62,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
        struct share_config *scfg;
        const char *sharetype;
 
-       status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
+       status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index bc17d100c5511c96383c11e3aedf1533b0c8952c..082de6540b28bf0f08364ed3c3e0341946878501 100644 (file)
@@ -157,7 +157,7 @@ static void smbsrv_accept(struct stream_connection *conn)
        smbsrv_management_init(smb_conn);
 
        if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx), 
-                                                      &(smb_conn->share_context)))) {
+                                                      smb_conn->lp_ctx, &(smb_conn->share_context)))) {
                smbsrv_terminate_connection(smb_conn, "share_init failed!");
                return;
        }