summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-07-23 18:43:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:18 -0500
commit9c66f601f1520a99b9236c32bc9f03a33bd4b2aa (patch)
treebba8797304b7db98aa205c3cb04344072be00030 /source4/ntvfs
parent2dc38416b65177aca94b4de3c9cfcb5c8edb0df2 (diff)
downloadsamba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.tar.gz
samba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.tar.bz2
samba-9c66f601f1520a99b9236c32bc9f03a33bd4b2aa.zip
r17206: Add a modular API for share configuration.
Commit the classic backwards compatible module which is the default one (This used to be commit a89cc346b9296cb49929898d257a064a6c2bae86)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c33
-rw-r--r--source4/ntvfs/cifs_posix_cli/vfs_simple.c9
-rw-r--r--source4/ntvfs/common/config.mk2
-rw-r--r--source4/ntvfs/common/notify.c10
-rw-r--r--source4/ntvfs/ipc/rap_server.c41
-rw-r--r--source4/ntvfs/ntvfs.h5
-rw-r--r--source4/ntvfs/ntvfs_base.c7
-rw-r--r--source4/ntvfs/posix/vfs_posix.c51
-rw-r--r--source4/ntvfs/posix/vfs_posix.h13
-rw-r--r--source4/ntvfs/print/vfs_print.c3
-rw-r--r--source4/ntvfs/simple/vfs_simple.c10
-rw-r--r--source4/ntvfs/sysdep/sys_notify.c6
-rw-r--r--source4/ntvfs/sysdep/sys_notify.h3
13 files changed, 128 insertions, 65 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 1e34e953a5..edb5f7b791 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -74,6 +74,19 @@ struct async_info {
SETUP_FILE; \
} while (0)
+#define CIFS_SERVER "cifs:server"
+#define CIFS_USER "cifs:user"
+#define CIFS_PASSWORD "cifs:password"
+#define CIFS_DOMAIN "cifs:domain"
+#define CIFS_SHARE "cifs:share"
+#define CIFS_USE_MACHINE_ACCT "cifs:use-machine-account"
+#define CIFS_MAP_GENERIC "cifs:map-generic"
+#define CIFS_MAP_TRANS2 "cifs:map-trans2"
+
+#define CIFS_USE_MACHINE_ACCT_DEFAULT False
+#define CIFS_MAP_GENERIC_DEFAULT False
+#define CIFS_MAP_TRANS2_DEFAULT True
+
/*
a handler for oplock break events from the server - these need to be passed
along to the client
@@ -113,7 +126,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
const char *host, *user, *pass, *domain, *remote_share;
struct smb_composite_connect io;
struct composite_context *creq;
- int snum = ntvfs->ctx->config.snum;
+ struct share_config *scfg = ntvfs->ctx->config;
struct cli_credentials *credentials;
BOOL machine_account;
@@ -122,16 +135,16 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
* For now we use parametric options, type cifs.
* Later we will use security=server and auth_server.c.
*/
- host = lp_parm_string(snum, "cifs", "server");
- user = lp_parm_string(snum, "cifs", "user");
- pass = lp_parm_string(snum, "cifs", "password");
- domain = lp_parm_string(snum, "cifs", "domain");
- remote_share = lp_parm_string(snum, "cifs", "share");
+ host = share_string_option(scfg, CIFS_SERVER, NULL);
+ user = share_string_option(scfg, CIFS_USER, NULL);
+ pass = share_string_option(scfg, CIFS_PASSWORD, NULL);
+ domain = share_string_option(scfg, CIFS_DOMAIN, NULL);
+ remote_share = share_string_option(scfg, CIFS_SHARE, NULL);
if (!remote_share) {
remote_share = sharename;
}
- machine_account = lp_parm_bool(snum, "cifs", "use_machine_account", False);
+ machine_account = share_bool_option(scfg, CIFS_USE_MACHINE_ACCT, CIFS_USE_MACHINE_ACCT_DEFAULT);
private = talloc_zero(ntvfs, struct cvfs_private);
if (!private) {
@@ -204,11 +217,9 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
/* we need to receive oplock break requests from the server */
smbcli_oplock_handler(private->transport, oplock_handler, private);
- private->map_generic = lp_parm_bool(ntvfs->ctx->config.snum,
- "cifs", "mapgeneric", False);
+ private->map_generic = share_bool_option(scfg, CIFS_MAP_GENERIC, CIFS_MAP_GENERIC_DEFAULT);
- private->map_trans2 = lp_parm_bool(ntvfs->ctx->config.snum,
- "cifs", "maptrans2", True);
+ private->map_trans2 = share_bool_option(scfg, CIFS_MAP_TRANS2, CIFS_MAP_TRANS2_DEFAULT);
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/cifs_posix_cli/vfs_simple.c b/source4/ntvfs/cifs_posix_cli/vfs_simple.c
index cf28a02806..eb62336d13 100644
--- a/source4/ntvfs/cifs_posix_cli/vfs_simple.c
+++ b/source4/ntvfs/cifs_posix_cli/vfs_simple.c
@@ -43,7 +43,7 @@
#define O_DIRECTORY 0
#endif
-#define CHECK_READ_ONLY(req) do { if (lp_readonly(ntvfs->ctx->config.snum)) return NT_STATUS_ACCESS_DENIED; } while (0)
+#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True)) return NT_STATUS_ACCESS_DENIED; } while (0)
/*
connect to a share - used when a tree_connect operation comes
@@ -56,12 +56,11 @@ static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
{
struct stat st;
struct svfs_private *private;
- int snum = ntvfs->ctx->config.snum;
private = talloc(ntvfs, struct svfs_private);
private->next_search_handle = 0;
- private->connectpath = talloc_strdup(private, lp_pathname(snum));
+ private->connectpath = talloc_strdup(private, share_string_option(ntvfs->ctx->config, SHARE_PATH, ""));
private->open_files = NULL;
private->search = NULL;
@@ -317,7 +316,7 @@ static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs,
return ntvfs_map_open(ntvfs, req, io);
}
- readonly = lp_readonly(ntvfs->ctx->config.snum);
+ readonly = share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True);
if (readonly) {
create_flags = 0;
rdwr_flags = O_RDONLY;
@@ -728,7 +727,7 @@ static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
fs->generic.out.quota_soft = 0;
fs->generic.out.quota_hard = 0;
fs->generic.out.quota_flags = 0;
- fs->generic.out.volume_name = talloc_strdup(req, lp_servicename(ntvfs->ctx->config.snum));
+ fs->generic.out.volume_name = talloc_strdup(req, ntvfs->ctx->config->name);
fs->generic.out.fs_type = ntvfs->ctx->fs_type;
return NT_STATUS_OK;
diff --git a/source4/ntvfs/common/config.mk b/source4/ntvfs/common/config.mk
index feb3613f78..c16cc09dfe 100644
--- a/source4/ntvfs/common/config.mk
+++ b/source4/ntvfs/common/config.mk
@@ -7,6 +7,6 @@ OBJ_FILES = \
brlock.o \
opendb.o \
notify.o
-PUBLIC_DEPENDENCIES = NDR_OPENDB NDR_NOTIFY sys_notify
+PUBLIC_DEPENDENCIES = NDR_OPENDB NDR_NOTIFY sys_notify share
# End LIBRARY ntvfs_common
################################################
diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c
index 222bd7a927..dbf404d9e6 100644
--- a/source4/ntvfs/common/notify.c
+++ b/source4/ntvfs/common/notify.c
@@ -56,6 +56,9 @@ struct notify_list {
#define NOTIFY_KEY "notify array"
+#define NOTIFY_ENABLE "notify:enable"
+#define NOTIFY_ENABLE_DEFAULT True
+
static NTSTATUS notify_remove_all(struct notify_context *notify);
static void notify_handler(struct messaging_context *msg_ctx, void *private,
uint32_t msg_type, uint32_t server_id, DATA_BLOB *data);
@@ -77,12 +80,13 @@ static int notify_destructor(struct notify_context *notify)
*/
struct notify_context *notify_init(TALLOC_CTX *mem_ctx, uint32_t server,
struct messaging_context *messaging_ctx,
- struct event_context *ev, int snum)
+ struct event_context *ev,
+ struct share_config *scfg)
{
char *path;
struct notify_context *notify;
- if (lp_parm_bool(snum, "notify", "enable", True) != True) {
+ if (share_bool_option(scfg, NOTIFY_ENABLE, NOTIFY_ENABLE_DEFAULT) != True) {
return NULL;
}
@@ -114,7 +118,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, uint32_t server,
messaging_register(notify->messaging_ctx, notify,
MSG_PVFS_NOTIFY, notify_handler);
- notify->sys_notify_ctx = sys_notify_context_create(snum, notify, ev);
+ notify->sys_notify_ctx = sys_notify_context_create(scfg, notify, ev);
return notify;
}
diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c
index 8ec62dff8b..f92b02c20a 100644
--- a/source4/ntvfs/ipc/rap_server.c
+++ b/source4/ntvfs/ipc/rap_server.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "param/share.h"
#include "libcli/rap/rap.h"
#include "librpc/gen_ndr/srvsvc.h"
#include "rpc_server/common/common.h"
@@ -30,21 +31,45 @@
NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
struct rap_NetShareEnum *r)
{
- int i;
+ NTSTATUS nterr;
+ const char **snames;
+ struct share_context *sctx;
+ struct share_config *scfg;
+ int i, j, count;
+
r->out.status = 0;
- r->out.available = dcesrv_common_get_count_of_shares(mem_ctx, NULL);
+ r->out.available = 0;
+ r->out.info = NULL;
+
+ nterr = share_get_context(mem_ctx, &sctx);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return nterr;
+ }
+
+ nterr = share_list_all(mem_ctx, sctx, &count, &snames);
+ if (!NT_STATUS_IS_OK(nterr)) {
+ return nterr;
+ }
+
+ r->out.available = count;
r->out.info = talloc_array(mem_ctx,
union rap_shareenum_info, r->out.available);
- for (i=0;i<r->out.available;i++) {
- strncpy(r->out.info[i].info1.name,
- dcesrv_common_get_share_name(mem_ctx, NULL, i),
+ for (i = 0, j = 0; i < r->out.available; i++) {
+ if (!NT_STATUS_IS_OK(share_get_config(mem_ctx, sctx, snames[i], &scfg))) {
+ DEBUG(3, ("WARNING: Service [%s] disappeared after enumeration!\n", snames[i]));
+ continue;
+ }
+ strncpy(r->out.info[j].info1.name,
+ snames[i],
sizeof(r->out.info[0].info1.name));
r->out.info[i].info1.pad = 0;
- r->out.info[i].info1.type = dcesrv_common_get_share_type(mem_ctx, NULL, i);
- r->out.info[i].info1.comment = talloc_strdup(mem_ctx,
- dcesrv_common_get_share_comment(mem_ctx, NULL, i));
+ r->out.info[i].info1.type = dcesrv_common_get_share_type(mem_ctx, NULL, scfg);
+ r->out.info[i].info1.comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
+ talloc_free(scfg);
+ j++;
}
+ r->out.available = j;
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h
index 6916ea10fc..b48a5dac00 100644
--- a/source4/ntvfs/ntvfs.h
+++ b/source4/ntvfs/ntvfs.h
@@ -20,6 +20,7 @@
*/
#include "libcli/raw/interfaces.h"
+#include "param/share.h"
/* modules can use the following to determine if the interface has changed */
/* version 1 -> 0 - make module stacking easier -- metze */
@@ -181,9 +182,7 @@ struct ntvfs_context {
*/
struct ntvfs_module_context *modules;
- struct {
- int snum;
- } config;
+ struct share_config *config;
uint32_t server_id;
struct event_context *event_ctx;
diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c
index 316a9e9c68..e6c4089e47 100644
--- a/source4/ntvfs/ntvfs_base.c
+++ b/source4/ntvfs/ntvfs_base.c
@@ -148,16 +148,15 @@ _PUBLIC_ BOOL ntvfs_interface_differs(const struct ntvfs_critical_sizes *const i
#undef FIELD_DIFFERS
}
-
/*
initialise a connection structure to point at a NTVFS backend
*/
-NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, int snum, enum ntvfs_type type,
+NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, struct share_config *scfg, enum ntvfs_type type,
enum protocol_types protocol,
struct event_context *ev, struct messaging_context *msg,
uint32_t server_id, struct ntvfs_context **_ctx)
{
- const char **handlers = lp_ntvfs_handler(snum);
+ const char **handlers = share_string_list_option(mem_ctx, scfg, SHARE_NTVFS_HANDLER);
int i;
struct ntvfs_context *ctx;
@@ -169,7 +168,7 @@ NTSTATUS ntvfs_init_connection(TALLOC_CTX *mem_ctx, int snum, enum ntvfs_type ty
NT_STATUS_HAVE_NO_MEMORY(ctx);
ctx->protocol = protocol;
ctx->type = type;
- ctx->config.snum = snum;
+ ctx->config = talloc_steal(ctx, scfg);
ctx->event_ctx = ev;
ctx->msg_ctx = msg;
ctx->server_id = server_id;
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index e7ef9bafd8..975649eeb5 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -38,35 +38,46 @@
*/
static void pvfs_setup_options(struct pvfs_state *pvfs)
{
- int snum = pvfs->ntvfs->ctx->config.snum;
+ struct share_config *scfg = pvfs->ntvfs->ctx->config;
const char *eadb;
- if (lp_map_hidden(snum)) pvfs->flags |= PVFS_FLAG_MAP_HIDDEN;
- if (lp_map_archive(snum)) pvfs->flags |= PVFS_FLAG_MAP_ARCHIVE;
- if (lp_map_system(snum)) pvfs->flags |= PVFS_FLAG_MAP_SYSTEM;
- if (lp_readonly(snum)) pvfs->flags |= PVFS_FLAG_READONLY;
- if (lp_strict_sync(snum)) pvfs->flags |= PVFS_FLAG_STRICT_SYNC;
- if (lp_strict_locking(snum)) pvfs->flags |= PVFS_FLAG_STRICT_LOCKING;
- if (lp_ci_filesystem(snum)) pvfs->flags |= PVFS_FLAG_CI_FILESYSTEM;
-
- if (lp_parm_bool(snum, "posix", "fakeoplocks", False)) {
+ if (share_bool_option(scfg, SHARE_MAP_HIDDEN, SHARE_MAP_HIDDEN_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_MAP_HIDDEN;
+ if (share_bool_option(scfg, SHARE_MAP_ARCHIVE, SHARE_MAP_ARCHIVE_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_MAP_ARCHIVE;
+ if (share_bool_option(scfg, SHARE_MAP_SYSTEM, SHARE_MAP_SYSTEM_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_MAP_SYSTEM;
+ if (share_bool_option(scfg, SHARE_READONLY, SHARE_READONLY_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_READONLY;
+ if (share_bool_option(scfg, SHARE_STRICT_SYNC, SHARE_STRICT_SYNC_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_STRICT_SYNC;
+ if (share_bool_option(scfg, SHARE_STRICT_LOCKING, SHARE_STRICT_LOCKING_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_STRICT_LOCKING;
+ if (share_bool_option(scfg, SHARE_CI_FILESYSTEM, SHARE_CI_FILESYSTEM_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_CI_FILESYSTEM;
+ if (share_bool_option(scfg, PVFS_FAKE_OPLOCKS, PVFS_FAKE_OPLOCKS_DEFAULT)) {
pvfs->flags |= PVFS_FLAG_FAKE_OPLOCKS;
}
/* this must be a power of 2 */
- pvfs->alloc_size_rounding = lp_parm_int(snum,
- "posix", "allocationrounding", 512);
+ pvfs->alloc_size_rounding = share_int_option(scfg,
+ PVFS_ALLOCATION_ROUNDING,
+ PVFS_ALLOCATION_ROUNDING_DEFAULT);
- pvfs->search.inactivity_time = lp_parm_int(snum,
- "posix", "searchinactivity", 300);
+ pvfs->search.inactivity_time = share_int_option(scfg,
+ PVFS_SEARCH_INACTIVITY,
+ PVFS_SEARCH_INACTIVITY_DEFAULT);
#if HAVE_XATTR_SUPPORT
- if (lp_parm_bool(snum, "posix", "xattr", True)) pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
+ if (share_bool_option(scfg, PVFS_XATTR, PVFS_XATTR_DEFAULT))
+ pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
#endif
- pvfs->sharing_violation_delay = lp_parm_int(snum, "posix", "sharedelay", 1000000);
+ pvfs->sharing_violation_delay = share_int_option(scfg,
+ PVFS_SHARE_DELAY,
+ PVFS_SHARE_DELAY_DEFAULT);
- pvfs->share_name = talloc_strdup(pvfs, lp_servicename(snum));
+ pvfs->share_name = talloc_strdup(pvfs, scfg->name);
pvfs->fs_attribs =
FS_ATTR_CASE_SENSITIVE_SEARCH |
@@ -75,7 +86,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
FS_ATTR_SPARSE_FILES;
/* allow xattrs to be stored in a external tdb */
- eadb = lp_parm_string(snum, "posix", "eadb");
+ eadb = share_string_option(scfg, PVFS_EADB, NULL);
if (eadb != NULL) {
pvfs->ea_db = tdb_wrap_open(pvfs, eadb, 50000,
TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
@@ -144,7 +155,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
NT_STATUS_HAVE_NO_MEMORY(pvfs);
/* for simplicity of path construction, remove any trailing slash now */
- base_directory = talloc_strdup(pvfs, lp_pathname(ntvfs->ctx->config.snum));
+ base_directory = talloc_strdup(pvfs, share_string_option(ntvfs->ctx->config, SHARE_PATH, ""));
NT_STATUS_HAVE_NO_MEMORY(base_directory);
if (strcmp(base_directory, "/") != 0) {
trim_string(base_directory, NULL, "/");
@@ -186,7 +197,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
pvfs->ntvfs->ctx->server_id,
pvfs->ntvfs->ctx->msg_ctx,
event_context_find(pvfs),
- pvfs->ntvfs->ctx->config.snum);
+ pvfs->ntvfs->ctx->config);
pvfs->sidmap = sidmap_open(pvfs);
if (pvfs->sidmap == NULL) {
diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h
index eb738920f4..8d3e86fff1 100644
--- a/source4/ntvfs/posix/vfs_posix.h
+++ b/source4/ntvfs/posix/vfs_posix.h
@@ -222,6 +222,19 @@ struct pvfs_dir;
/* types of notification for pvfs wait events */
enum pvfs_wait_notice {PVFS_WAIT_EVENT, PVFS_WAIT_TIMEOUT, PVFS_WAIT_CANCEL};
+#define PVFS_EADB "posix:eadb"
+#define PVFS_XATTR "posix:xattr"
+#define PVFS_FAKE_OPLOCKS "posix:fakeoplocks"
+#define PVFS_SHARE_DELAY "posix:sharedelay"
+#define PVFS_ALLOCATION_ROUNDING "posix:allocationrounding"
+#define PVFS_SEARCH_INACTIVITY "posix:searchinactivity"
+
+#define PVFS_XATTR_DEFAULT True
+#define PVFS_FAKE_OPLOCKS_DEFAULT False
+#define PVFS_SHARE_DELAY_DEFAULT 1000000
+#define PVFS_ALLOCATION_ROUNDING_DEFAULT 512
+#define PVFS_SEARCH_INACTIVITY_DEFAULT 300
+
#include "ntvfs/posix/vfs_posix_proto.h"
#endif /* _VFS_POSIX_H_ */
diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c
index 31cfcc9303..dfe76b846e 100644
--- a/source4/ntvfs/print/vfs_print.c
+++ b/source4/ntvfs/print/vfs_print.c
@@ -75,7 +75,6 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
}
if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
- int snum = ntvfs->ctx->config.snum;
/* a request for the print job id of an open print job */
io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);
@@ -85,7 +84,7 @@ 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(p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII);
- push_string(p+18, lp_servicename(snum), 13, STR_TERMINATE|STR_ASCII);
+ push_string(p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index beffe2b546..ccb8b1b97c 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -39,7 +39,7 @@
#define O_DIRECTORY 0
#endif
-#define CHECK_READ_ONLY(req) do { if (lp_readonly(ntvfs->ctx->config.snum)) return NT_STATUS_ACCESS_DENIED; } while (0)
+#define CHECK_READ_ONLY(req) do { if (share_bool_option(ntvfs->ctx->config, SHARE_READONLY, True)) return NT_STATUS_ACCESS_DENIED; } while (0)
/*
connect to a share - used when a tree_connect operation comes
@@ -52,13 +52,13 @@ static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
{
struct stat st;
struct svfs_private *private;
- int snum = ntvfs->ctx->config.snum;
+ struct share_config *scfg = ntvfs->ctx->config;
private = talloc(ntvfs, struct svfs_private);
NT_STATUS_HAVE_NO_MEMORY(private);
private->ntvfs = ntvfs;
private->next_search_handle = 0;
- private->connectpath = talloc_strdup(private, lp_pathname(snum));
+ private->connectpath = talloc_strdup(private, share_string_option(scfg, SHARE_PATH, ""));
private->open_files = NULL;
private->search = NULL;
@@ -319,7 +319,7 @@ static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs,
return ntvfs_map_open(ntvfs, req, io);
}
- readonly = lp_readonly(ntvfs->ctx->config.snum);
+ readonly = share_bool_option(ntvfs->ctx->config, SHARE_READONLY, SHARE_READONLY_DEFAULT);
if (readonly) {
create_flags = 0;
rdwr_flags = O_RDONLY;
@@ -775,7 +775,7 @@ static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
fs->generic.out.quota_soft = 0;
fs->generic.out.quota_hard = 0;
fs->generic.out.quota_flags = 0;
- fs->generic.out.volume_name = talloc_strdup(req, lp_servicename(ntvfs->ctx->config.snum));
+ fs->generic.out.volume_name = talloc_strdup(req, ntvfs->ctx->config->name);
fs->generic.out.fs_type = ntvfs->ctx->fs_type;
return NT_STATUS_OK;
diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c
index c4fa4647d1..3f4f08203e 100644
--- a/source4/ntvfs/sysdep/sys_notify.c
+++ b/source4/ntvfs/sysdep/sys_notify.c
@@ -34,10 +34,12 @@
static struct sys_notify_backend *backends;
static uint32_t num_backends;
+#define NOTIFY_BACKEND "notify-backend"
+
/*
initialise a system change notify backend
*/
-_PUBLIC_ struct sys_notify_context *sys_notify_context_create(int snum,
+_PUBLIC_ struct sys_notify_context *sys_notify_context_create(struct share_config *scfg,
TALLOC_CTX *mem_ctx,
struct event_context *ev)
{
@@ -60,7 +62,7 @@ _PUBLIC_ struct sys_notify_context *sys_notify_context_create(int snum,
ctx->ev = ev;
- bname = lp_parm_string(snum, "notify", "backend");
+ bname = share_string_option(scfg, NOTIFY_BACKEND, NULL);
if (!bname) {
if (num_backends) {
bname = backends[0].name;
diff --git a/source4/ntvfs/sysdep/sys_notify.h b/source4/ntvfs/sysdep/sys_notify.h
index 6f8e91efec..6db10fe02c 100644
--- a/source4/ntvfs/sysdep/sys_notify.h
+++ b/source4/ntvfs/sysdep/sys_notify.h
@@ -19,6 +19,7 @@
*/
#include "librpc/gen_ndr/notify.h"
+#include "param/share.h"
struct sys_notify_context;
@@ -43,7 +44,7 @@ struct sys_notify_backend {
};
NTSTATUS sys_notify_register(struct sys_notify_backend *backend);
-struct sys_notify_context *sys_notify_context_create(int snum,
+struct sys_notify_context *sys_notify_context_create(struct share_config *scfg,
TALLOC_CTX *mem_ctx,
struct event_context *ev);
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx, struct notify_entry *e,