summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c4
-rw-r--r--source4/ntvfs/common/notify.c4
-rw-r--r--source4/ntvfs/common/opendb_tdb.c2
-rw-r--r--source4/ntvfs/ipc/ipc_rap.c13
-rw-r--r--source4/ntvfs/ipc/rap_server.c3
-rw-r--r--source4/ntvfs/ntvfs_base.c8
-rw-r--r--source4/ntvfs/posix/pvfs_rename.c9
-rw-r--r--source4/ntvfs/posix/pvfs_resolve.c9
-rw-r--r--source4/ntvfs/posix/pvfs_shortname.c2
-rw-r--r--source4/ntvfs/posix/pvfs_util.c3
-rw-r--r--source4/ntvfs/posix/vfs_posix.c1
-rw-r--r--source4/ntvfs/print/vfs_print.c4
12 files changed, 38 insertions, 24 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 152a4056c5..9426355ecb 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -180,7 +180,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
if (domain) {
cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
}
- status = cli_credentials_set_machine_account(credentials);
+ status = cli_credentials_set_machine_account(credentials, ntvfs->ctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -194,7 +194,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
/* connect to the server, using the smbd event context */
io.in.dest_host = host;
- io.in.port = 0;
+ io.in.dest_ports = lp_smb_ports(ntvfs->ctx->lp_ctx);
io.in.called_name = host;
io.in.credentials = credentials;
io.in.fallback_to_anonymous = false;
diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c
index 16cf4e4b54..8bbf2d04b3 100644
--- a/source4/ntvfs/common/notify.c
+++ b/source4/ntvfs/common/notify.c
@@ -35,6 +35,7 @@
#include "ntvfs/common/ntvfs_common.h"
#include "ntvfs/sysdep/sys_notify.h"
#include "cluster/cluster.h"
+#include "param/param.h"
struct notify_context {
struct tdb_wrap *w;
@@ -81,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)
{
@@ -95,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, "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;
diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c
index b8b8a5cb33..41b5ad2ebe 100644
--- a/source4/ntvfs/common/opendb_tdb.c
+++ b/source4/ntvfs/common/opendb_tdb.c
@@ -79,7 +79,7 @@ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx,
return NULL;
}
- odb->w = cluster_tdb_tmp_open(odb, "openfiles.tdb", TDB_DEFAULT);
+ odb->w = cluster_tdb_tmp_open(odb, ntvfs_ctx->lp_ctx, "openfiles.tdb", TDB_DEFAULT);
if (odb->w == NULL) {
talloc_free(odb);
return NULL;
diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c
index d8e9812dd8..85bc5c212f 100644
--- a/source4/ntvfs/ipc/ipc_rap.c
+++ b/source4/ntvfs/ipc/ipc_rap.c
@@ -23,6 +23,7 @@
#include "libcli/rap/rap.h"
#include "ntvfs/ipc/proto.h"
#include "librpc/ndr/libndr.h"
+#include "param/param.h"
#define NDR_RETURN(call) do { \
enum ndr_err_code _ndr_err; \
@@ -115,10 +116,10 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
call->mem_ctx = mem_ctx;
- call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx);
+ call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(global_loadparm));
call->ndr_pull_param->flags = RAPNDR_FLAGS;
- call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx);
+ call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(global_loadparm));
call->ndr_pull_data->flags = RAPNDR_FLAGS;
call->heap = talloc(mem_ctx, struct rap_string_heap);
@@ -444,8 +445,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
&call->datadesc));
- call->ndr_push_param = ndr_push_init_ctx(call);
- call->ndr_push_data = ndr_push_init_ctx(call);
+ call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+ call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL))
return NT_STATUS_NO_MEMORY;
@@ -470,8 +471,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
result_param = ndr_push_blob(call->ndr_push_param);
result_data = ndr_push_blob(call->ndr_push_data);
- final_param = ndr_push_init_ctx(call);
- final_data = ndr_push_init_ctx(call);
+ final_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+ final_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
if ((final_param == NULL) || (final_data == NULL))
return NT_STATUS_NO_MEMORY;
diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c
index d1a4dd9edc..7d3020a259 100644
--- a/source4/ntvfs/ipc/rap_server.c
+++ b/source4/ntvfs/ipc/rap_server.c
@@ -23,6 +23,7 @@
#include "libcli/rap/rap.h"
#include "librpc/gen_ndr/srvsvc.h"
#include "rpc_server/common/common.h"
+#include "param/param.h"
/* At this moment these are just dummy functions, but you might get the
* idea. */
@@ -40,7 +41,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
r->out.available = 0;
r->out.info = NULL;
- nterr = share_get_context(mem_ctx, &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;
}
diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c
index 3873afbdfa..28f43eabe8 100644
--- a/source4/ntvfs/ntvfs_base.c
+++ b/source4/ntvfs/ntvfs_base.c
@@ -201,8 +201,14 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, e
NTSTATUS ntvfs_init(struct loadparm_context *lp_ctx)
{
+ static bool initialized = false;
init_module_fn static_init[] = STATIC_ntvfs_MODULES;
- init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntvfs");
+ init_module_fn *shared_init;
+
+ if (initialized) return NT_STATUS_OK;
+ initialized = true;
+
+ shared_init = load_samba_modules(NULL, lp_ctx, "ntvfs");
run_init_functions(static_init);
run_init_functions(shared_init);
diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c
index 5c351b2df2..3b9842db7f 100644
--- a/source4/ntvfs/posix/pvfs_rename.c
+++ b/source4/ntvfs/posix/pvfs_rename.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "vfs_posix.h"
#include "librpc/gen_ndr/security.h"
+#include "param/param.h"
/*
@@ -107,16 +108,16 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
while (*p2) {
codepoint_t c1, c2;
size_t c_size1, c_size2;
- c1 = next_codepoint(global_smb_iconv_convenience, p1, &c_size1);
- c2 = next_codepoint(global_smb_iconv_convenience, p2, &c_size2);
+ c1 = next_codepoint(lp_iconv_convenience(global_loadparm), p1, &c_size1);
+ c2 = next_codepoint(lp_iconv_convenience(global_loadparm), p2, &c_size2);
if (c2 == '?') {
- d += push_codepoint(global_smb_iconv_convenience, d, c1);
+ d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c1);
} else if (c2 == '*') {
memcpy(d, p1, strlen(p1));
d += strlen(p1);
break;
} else {
- d += push_codepoint(global_smb_iconv_convenience, d, c2);
+ d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c2);
}
p1 += c_size1;
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c
index f1d701b343..949fa131a4 100644
--- a/source4/ntvfs/posix/pvfs_resolve.c
+++ b/source4/ntvfs/posix/pvfs_resolve.c
@@ -29,8 +29,9 @@
#include "includes.h"
#include "vfs_posix.h"
#include "system/dir.h"
+#include "param/param.h"
-/*
+/**
compare two filename components. This is where the name mangling hook will go
*/
static int component_compare(struct pvfs_state *pvfs, const char *comp, const char *name)
@@ -256,7 +257,7 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
while (*p) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, &c_size);
switch (c) {
case '\\':
if (name->has_wildcard) {
@@ -340,7 +341,7 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t
if (s == NULL) return NT_STATUS_NO_MEMORY;
for (num_components=1, p=s; *p; p += c_size) {
- c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
if (c == '\\') num_components++;
}
@@ -352,7 +353,7 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t
components[0] = s;
for (i=0, p=s; *p; p += c_size) {
- c = next_codepoint(global_smb_iconv_convenience, p, &c_size);
+ c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
if (c == '\\') {
*p = 0;
components[++i] = p+1;
diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c
index 68e415000e..083a281819 100644
--- a/source4/ntvfs/posix/pvfs_shortname.c
+++ b/source4/ntvfs/posix/pvfs_shortname.c
@@ -388,7 +388,7 @@ static bool is_legal_name(struct pvfs_mangle_context *ctx, const char *name)
{
while (*name) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, name, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), name, &c_size);
if (c == INVALID_CODEPOINT) {
return false;
}
diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c
index b7cba00d9b..b52c3e387b 100644
--- a/source4/ntvfs/posix/pvfs_util.c
+++ b/source4/ntvfs/posix/pvfs_util.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "vfs_posix.h"
+#include "param/param.h"
/*
return true if a string contains one of the CIFS wildcard characters
@@ -181,7 +182,7 @@ uint32_t pvfs_name_hash(const char *key, size_t length)
while (*key && length--) {
size_t c_size;
- codepoint_t c = next_codepoint(global_smb_iconv_convenience, key, &c_size);
+ codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), key, &c_size);
c = toupper_w(c);
value *= fnv1_prime;
value ^= (uint32_t)c;
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 8e5e5a6942..e058e6f546 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -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);
diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c
index 5fdb7aada6..aa9b11a973 100644
--- a/source4/ntvfs/print/vfs_print.c
+++ b/source4/ntvfs/print/vfs_print.c
@@ -83,8 +83,8 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
p = (char *)io->ioctl.out.blob.data;
SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
- push_string(global_smb_iconv_convenience, p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
- push_string(global_smb_iconv_convenience, p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
+ push_string(lp_iconv_convenience(ntvfs->ctx->lp_ctx), p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
+ push_string(lp_iconv_convenience(ntvfs->ctx->lp_ctx), p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
return NT_STATUS_OK;
}