struct smbcli_tree *tree;
struct smbcli_transport *transport;
struct smbsrv_tcon *tcon;
- const struct ntvfs_ops *ops;
+ /*const struct ntvfs_ops *ops;*/
};
/*
connect to a share - used when a tree_connect operation comes in.
*/
-static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
NTSTATUS status;
}
ZERO_STRUCTP(private);
- ntvfs_set_private(req->tcon, depth, private);
+ ntvfs->private_data = private;
status = smbcli_tree_full_connection(private,
&private->tree,
private->transport = private->tree->session->transport;
private->tree->session->pid = SVAL(req->in.hdr, HDR_PID);
private->tcon = req->tcon;
- private->ops = ntvfs_backend_byname("cifs", NTVFS_DISK);
+ /*private->ops = ntvfs_backend_byname("cifs", NTVFS_DISK);*/
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
/*
disconnect from a share
*/
-static NTSTATUS cvfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS cvfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct cvfs_private *private = tcon->ntvfs_private_list[depth];
+ struct cvfs_private *private = ntvfs->private_data;
smb_tree_disconnect(private->tree);
talloc_free(private->tree);
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS cvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS cvfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
/* see if the front end will allow us to perform this
/*
ioctl interface
*/
-static NTSTATUS cvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS cvfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
/* see if the front end will allow us to perform this
/*
check if a directory exists
*/
-static NTSTATUS cvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS cvfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
return info on a pathname
*/
-static NTSTATUS cvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS cvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
query info on a open file
*/
-static NTSTATUS cvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS cvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
set info on a pathname
*/
-static NTSTATUS cvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS cvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
open a file
*/
-static NTSTATUS cvfs_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
create a directory
*/
-static NTSTATUS cvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS cvfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
remove a directory
*/
-static NTSTATUS cvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS cvfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
rename a set of files
*/
-static NTSTATUS cvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS cvfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
copy a set of files
*/
-static NTSTATUS cvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS cvfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
read from a file
*/
-static NTSTATUS cvfs_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS cvfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
write to a file
*/
-static NTSTATUS cvfs_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
seek in a file
*/
-static NTSTATUS cvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS cvfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
flush a file
*/
-static NTSTATUS cvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS cvfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
return NT_STATUS_OK;
}
/*
close a file
*/
-static NTSTATUS cvfs_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS cvfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
exit - closing files open by the pid
*/
-static NTSTATUS cvfs_exit(struct smbsrv_request *req)
+static NTSTATUS cvfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
logoff - closing files open by the user
*/
-static NTSTATUS cvfs_logoff(struct smbsrv_request *req)
+static NTSTATUS cvfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
/* we can't do this right in the cifs backend .... */
return NT_STATUS_OK;
/*
lock a byte range
*/
-static NTSTATUS cvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS cvfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
set info on a open file
*/
-static NTSTATUS cvfs_setfileinfo(struct smbsrv_request *req,
+static NTSTATUS cvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
return filesystem space info
*/
-static NTSTATUS cvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS cvfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/*
return print queue info
*/
-static NTSTATUS cvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS cvfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_first(private->tree, req, io, search_private, callback);
}
/* continue a search */
-static NTSTATUS cvfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_next(private->tree, req, io, search_private, callback);
}
/* close a search */
-static NTSTATUS cvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS cvfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
return smb_raw_search_close(private->tree, io);
}
}
/* raw trans2 */
-static NTSTATUS cvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS cvfs_trans2(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
- NTVFS_GET_PRIVATE(cvfs_private, private, req);
+ struct cvfs_private *private = ntvfs->private_data;
struct smbcli_request *c_req;
if (!req->async.send_fn) {
/* SMBtrans - not used on file shares */
-static NTSTATUS cvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS cvfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}
ops.logoff = cvfs_logoff;
if (lp_parm_bool(-1, "cifs", "maptrans2", False)) {
- ops.trans2 = cvfs_trans2;
+ ops.trans2 = cvfs_trans2;
}
/* register ourselves with the NTVFS subsystem. We register
ntvfs/ntvfs_base.o
ADD_OBJ_FILES = \
ntvfs/ntvfs_generic.o \
+ ntvfs/ntvfs_interface.o \
ntvfs/ntvfs_util.o
#
# End SUBSYSTEM NTVFS
/*
connect to a share - always works
*/
-static NTSTATUS ipc_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
struct ipc_private *private;
if (!private) {
return NT_STATUS_NO_MEMORY;
}
- ntvfs_set_private(tcon, depth, private);
+ ntvfs->private_data = private;
private->pipe_list = NULL;
private->next_fnum = 1;
/*
disconnect from a share
*/
-static NTSTATUS ipc_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS ipc_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct ipc_private *private = tcon->ntvfs_private_list[depth];
+ struct ipc_private *private = ntvfs->private_data;
/* close any pipes that are open. Discard any unread data */
while (private->pipe_list) {
/*
delete a file
*/
-static NTSTATUS ipc_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS ipc_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
ioctl interface - we don't do any
*/
-static NTSTATUS ipc_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS ipc_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
check if a directory exists
*/
-static NTSTATUS ipc_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS ipc_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
return info on a pathname
*/
-static NTSTATUS ipc_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS ipc_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
set info on a pathname
*/
-static NTSTATUS ipc_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS ipc_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
open a file backend - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname,
+static NTSTATUS ipc_open_generic(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *fname,
struct pipe_state **ps)
{
struct pipe_state *p;
NTSTATUS status;
struct dcesrv_ep_description ep_description;
struct auth_session_info *session_info = NULL;
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
p = talloc_p(private, struct pipe_state);
if (!p) {
/*
open a file with ntcreatex - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_ntcreatex(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open_ntcreatex(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
struct pipe_state *p;
NTSTATUS status;
- status = ipc_open_generic(req, oi->ntcreatex.in.fname, &p);
+ status = ipc_open_generic(ntvfs, req, oi->ntcreatex.in.fname, &p);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
/*
open a file with openx - used for MSRPC pipes
*/
-static NTSTATUS ipc_open_openx(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open_openx(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
struct pipe_state *p;
NTSTATUS status;
fname += 4;
- status = ipc_open_generic(req, fname, &p);
+ status = ipc_open_generic(ntvfs, req, fname, &p);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
/*
open a file - used for MSRPC pipes
*/
-static NTSTATUS ipc_open(struct smbsrv_request *req, union smb_open *oi)
+static NTSTATUS ipc_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
{
NTSTATUS status;
switch (oi->generic.level) {
case RAW_OPEN_NTCREATEX:
- status = ipc_open_ntcreatex(req, oi);
+ status = ipc_open_ntcreatex(ntvfs, req, oi);
break;
case RAW_OPEN_OPENX:
- status = ipc_open_openx(req, oi);
+ status = ipc_open_openx(ntvfs, req, oi);
break;
default:
status = NT_STATUS_NOT_SUPPORTED;
/*
create a directory
*/
-static NTSTATUS ipc_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS ipc_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
remove a directory
*/
-static NTSTATUS ipc_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS ipc_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
rename a set of files
*/
-static NTSTATUS ipc_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS ipc_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
copy a set of files
*/
-static NTSTATUS ipc_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS ipc_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
read from a file
*/
-static NTSTATUS ipc_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS ipc_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
DATA_BLOB data;
uint16_t fnum;
struct pipe_state *p;
/*
write to a file
*/
-static NTSTATUS ipc_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS ipc_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
DATA_BLOB data;
uint16_t fnum;
struct pipe_state *p;
/*
seek in a file
*/
-static NTSTATUS ipc_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS ipc_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
flush a file
*/
-static NTSTATUS ipc_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS ipc_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
close a file
*/
-static NTSTATUS ipc_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS ipc_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p;
if (io->generic.level != RAW_CLOSE_CLOSE) {
/*
exit - closing files
*/
-static NTSTATUS ipc_exit(struct smbsrv_request *req)
+static NTSTATUS ipc_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p, *next;
for (p=private->pipe_list; p; p=next) {
/*
logoff - closing files open by the user
*/
-static NTSTATUS ipc_logoff(struct smbsrv_request *req)
+static NTSTATUS ipc_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p, *next;
for (p=private->pipe_list; p; p=next) {
/*
lock a byte range
*/
-static NTSTATUS ipc_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS ipc_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
set info on a open file
*/
-static NTSTATUS ipc_setfileinfo(struct smbsrv_request *req, union smb_setfileinfo *info)
+static NTSTATUS ipc_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
query info on a open file
*/
-static NTSTATUS ipc_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS ipc_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
return filesystem info
*/
-static NTSTATUS ipc_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS ipc_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
return print queue info
*/
-static NTSTATUS ipc_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS ipc_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
list files in a directory matching a wildcard pattern
*/
-NTSTATUS ipc_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS ipc_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
/*
continue listing files in a directory
*/
-NTSTATUS ipc_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS ipc_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
/*
end listing files in a directory
*/
-NTSTATUS ipc_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS ipc_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
return NT_STATUS_ACCESS_DENIED;
}
/* SMBtrans - handle a DCERPC command */
-static NTSTATUS ipc_dcerpc_cmd(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_dcerpc_cmd(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
struct pipe_state *p;
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
NTSTATUS status;
/* the fnum is in setup[1] */
/* SMBtrans - set named pipe state */
-static NTSTATUS ipc_set_nm_pipe_state(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_set_nm_pipe_state(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
- NTVFS_GET_PRIVATE(ipc_private, private, req);
+ struct ipc_private *private = ntvfs->private_data;
struct pipe_state *p;
/* the fnum is in setup[1] */
/* SMBtrans - used to provide access to SMB pipes */
-static NTSTATUS ipc_trans(struct smbsrv_request *req, struct smb_trans2 *trans)
+static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
{
NTSTATUS status;
switch (trans->in.setup[0]) {
case TRANSACT_SETNAMEDPIPEHANDLESTATE:
- status = ipc_set_nm_pipe_state(req, trans);
+ status = ipc_set_nm_pipe_state(ntvfs, req, trans);
break;
case TRANSACT_DCERPCCMD:
- status = ipc_dcerpc_cmd(req, trans);
+ status = ipc_dcerpc_cmd(ntvfs, req, trans);
break;
default:
status = NT_STATUS_INVALID_PARAMETER;
/* this is stored in ntvfs_private */
struct nbench_private {
- const struct ntvfs_ops *passthru_ops;
int log_fd;
};
-
/*
log one request to the nbench log
*/
free(s);
}
-
-/*
- this is used to call the next module in the ntvfs chain
-*/
-#define PASS_THRU(tcon, op, args) private->passthru_ops->op args;
-
/*
this pass through macro operates on request contexts, and disables
async calls.
async calls are a pain for the nbench module as it makes pulling the
status code and any result parameters much harder.
*/
-#define PASS_THRU_REQ(req, op, args) do { \
+#define PASS_THRU_REQ(ntvfs, req, op, args) do { \
void *send_fn_saved = req->async.send_fn; \
req->async.send_fn = NULL; \
- req->ntvfs_depth++; \
- status = PASS_THRU(req->tcon, op, args); \
- req->ntvfs_depth--; \
+ status = ntvfs_next_##op args; \
req->async.send_fn = send_fn_saved; \
} while (0)
/*
connect to a share - used when a tree_connect operation comes in.
*/
-static NTSTATUS nbench_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct nbench_private *private;
- const char *passthru;
NTSTATUS status;
char *logname = NULL;
- const char **handlers = lp_ntvfs_handler(req->tcon->service);
private = talloc_p(req->tcon, struct nbench_private);
if (!private) {
return NT_STATUS_NO_MEMORY;
}
- asprintf(&logname, "/tmp/nbenchlog%d.%u", depth, getpid());
- private->log_fd = open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
+ asprintf(&logname, "/tmp/nbenchlog%d.%u", ntvfs->depth, getpid());
+ private->log_fd = sys_open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
free(logname);
if (private->log_fd == -1) {
return NT_STATUS_UNSUCCESSFUL;
}
- private->passthru_ops = ntvfs_backend_byname(handlers[depth+1], NTVFS_DISK);
+ ntvfs->private_data = private;
- if (!private->passthru_ops) {
- DEBUG(0,("Unable to connect to '%s' pass through backend\n", passthru));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- ntvfs_set_private(req->tcon, depth, private);
-
- status = PASS_THRU(req->tcon, connect, (req, sharename, depth+1));
+ status = ntvfs_next_connect(ntvfs, req, sharename);
return status;
}
/*
disconnect from a share
*/
-static NTSTATUS nbench_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
- struct nbench_private *private = tcon->ntvfs_private_list[depth];
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
close(private->log_fd);
- status = PASS_THRU(tcon, disconnect, (tcon, depth+1));
-
+ status = ntvfs_next_disconnect(ntvfs, tcon);
+
return status;
}
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS nbench_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS nbench_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, unlink, (req, unl));
+ PASS_THRU_REQ(ntvfs, req, unlink, (ntvfs, req, unl));
nbench_log(private, "Unlink \"%s\" 0x%x %s\n",
unl->in.pattern, unl->in.attrib,
/*
ioctl interface
*/
-static NTSTATUS nbench_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS nbench_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, ioctl, (req, io));
+ PASS_THRU_REQ(ntvfs, req, ioctl, (ntvfs, req, io));
nbench_log(private, "Ioctl - NOT HANDLED\n");
/*
check if a directory exists
*/
-static NTSTATUS nbench_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS nbench_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, chkpath, (req, cp));
+ PASS_THRU_REQ(ntvfs, req, chkpath, (ntvfs, req, cp));
nbench_log(private, "Chkpath \"%s\" %s\n",
cp->in.path,
/*
return info on a pathname
*/
-static NTSTATUS nbench_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS nbench_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, qpathinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, qpathinfo, (ntvfs, req, info));
nbench_log(private, "QUERY_PATH_INFORMATION \"%s\" %d %s\n",
info->generic.in.fname,
/*
query info on a open file
*/
-static NTSTATUS nbench_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS nbench_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, qfileinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, qfileinfo, (ntvfs, req, info));
nbench_log(private, "QUERY_FILE_INFORMATION %d %d %s\n",
info->generic.in.fnum,
/*
set info on a pathname
*/
-static NTSTATUS nbench_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS nbench_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, setpathinfo, (req, st));
+ PASS_THRU_REQ(ntvfs, req, setpathinfo, (ntvfs, req, st));
nbench_log(private, "SET_PATH_INFORMATION \"%s\" %d %s\n",
st->generic.file.fname,
/*
open a file
*/
-static NTSTATUS nbench_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS nbench_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, open, (req, io));
+ PASS_THRU_REQ(ntvfs, req, open, (ntvfs, req, io));
+
+ DEBUG(0,("%d: %s\n", ntvfs->depth, get_nt_error_c_code(status)));
switch (io->generic.level) {
case RAW_OPEN_NTCREATEX:
/*
create a directory
*/
-static NTSTATUS nbench_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS nbench_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, mkdir, (req, md));
+ PASS_THRU_REQ(ntvfs, req, mkdir, (ntvfs, req, md));
nbench_log(private, "Mkdir - NOT HANDLED\n");
/*
remove a directory
*/
-static NTSTATUS nbench_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS nbench_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, rmdir, (req, rd));
+ PASS_THRU_REQ(ntvfs, req, rmdir, (ntvfs, req, rd));
nbench_log(private, "Rmdir \"%s\" %s\n",
rd->in.path,
/*
rename a set of files
*/
-static NTSTATUS nbench_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS nbench_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, rename, (req, ren));
+ PASS_THRU_REQ(ntvfs, req, rename, (ntvfs, req, ren));
switch (ren->generic.level) {
case RAW_RENAME_RENAME:
/*
copy a set of files
*/
-static NTSTATUS nbench_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS nbench_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, copy, (req, cp));
+ PASS_THRU_REQ(ntvfs, req, copy, (ntvfs, req, cp));
nbench_log(private, "Copy - NOT HANDLED\n");
/*
read from a file
*/
-static NTSTATUS nbench_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS nbench_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, read, (req, rd));
+ PASS_THRU_REQ(ntvfs, req, read, (ntvfs, req, rd));
switch (rd->generic.level) {
case RAW_READ_READX:
/*
write to a file
*/
-static NTSTATUS nbench_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS nbench_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, write, (req, wr));
+ PASS_THRU_REQ(ntvfs, req, write, (ntvfs, req, wr));
switch (wr->generic.level) {
case RAW_WRITE_WRITEX:
/*
seek in a file
*/
-static NTSTATUS nbench_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS nbench_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, seek, (req, io));
+ PASS_THRU_REQ(ntvfs, req, seek, (ntvfs, req, io));
nbench_log(private, "Seek - NOT HANDLED\n");
/*
flush a file
*/
-static NTSTATUS nbench_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS nbench_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, flush, (req, io));
+ PASS_THRU_REQ(ntvfs, req, flush, (ntvfs, req, io));
nbench_log(private, "Flush %d %s\n",
io->in.fnum,
/*
close a file
*/
-static NTSTATUS nbench_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS nbench_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, close, (req, io));
+ PASS_THRU_REQ(ntvfs, req, close, (ntvfs, req, io));
switch (io->generic.level) {
case RAW_CLOSE_CLOSE:
/*
exit - closing files
*/
-static NTSTATUS nbench_exit(struct smbsrv_request *req)
+static NTSTATUS nbench_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
NTSTATUS status;
- PASS_THRU_REQ(req, exit, (req));
+ PASS_THRU_REQ(ntvfs, req, exit, (ntvfs, req));
return status;
}
/*
logoff - closing files
*/
-static NTSTATUS nbench_logoff(struct smbsrv_request *req)
+static NTSTATUS nbench_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
NTSTATUS status;
- PASS_THRU_REQ(req, logoff, (req));
+ PASS_THRU_REQ(ntvfs, req, logoff, (ntvfs, req));
return status;
}
/*
lock a byte range
*/
-static NTSTATUS nbench_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS nbench_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, lock, (req, lck));
+ PASS_THRU_REQ(ntvfs, req, lock, (ntvfs, req, lck));
if (lck->generic.level == RAW_LOCK_LOCKX &&
lck->lockx.in.lock_cnt == 1 &&
/*
set info on a open file
*/
-static NTSTATUS nbench_setfileinfo(struct smbsrv_request *req,
- union smb_setfileinfo *info)
+static NTSTATUS nbench_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
+ union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, setfileinfo, (req, info));
+ PASS_THRU_REQ(ntvfs, req, setfileinfo, (ntvfs, req, info));
nbench_log(private, "SET_FILE_INFORMATION %d %d %s\n",
info->generic.file.fnum,
/*
return filesystem space info
*/
-static NTSTATUS nbench_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS nbench_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, fsinfo, (req, fs));
+ PASS_THRU_REQ(ntvfs, req, fsinfo, (ntvfs, req, fs));
nbench_log(private, "QUERY_FS_INFORMATION %d %s\n",
fs->generic.level,
/*
return print queue info
*/
-static NTSTATUS nbench_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS nbench_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, lpq, (req, lpq));
+ PASS_THRU_REQ(ntvfs, req, lpq, (ntvfs, req, lpq));
nbench_log(private, "Lpq-%d - NOT HANDLED\n", lpq->generic.level);
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS nbench_search_first(struct smbsrv_request *req, union smb_search_first *io,
- void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+static NTSTATUS nbench_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
+ void *search_private,
+ BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_first, (req, io, search_private, callback));
+ PASS_THRU_REQ(ntvfs, req, search_first, (ntvfs, req, io, search_private, callback));
switch (io->generic.level) {
case RAW_SEARCH_BOTH_DIRECTORY_INFO:
}
/* continue a search */
-static NTSTATUS nbench_search_next(struct smbsrv_request *req, union smb_search_next *io,
- void *search_private,
- BOOL (*callback)(void *, union smb_search_data *))
+static NTSTATUS nbench_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
+ void *search_private,
+ BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_next, (req, io, search_private, callback));
+ PASS_THRU_REQ(ntvfs, req, search_next, (ntvfs, req, io, search_private, callback));
nbench_log(private, "Searchnext-%d - NOT HANDLED\n", io->generic.level);
}
/* close a search */
-static NTSTATUS nbench_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS nbench_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, search_close, (req, io));
+ PASS_THRU_REQ(ntvfs, req, search_close, (ntvfs, req, io));
nbench_log(private, "Searchclose-%d - NOT HANDLED\n", io->generic.level);
}
/* SMBtrans - not used on file shares */
-static NTSTATUS nbench_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS nbench_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
- NTVFS_GET_PRIVATE(nbench_private, private, req);
+ struct nbench_private *private = ntvfs->private_data;
NTSTATUS status;
- PASS_THRU_REQ(req, trans, (req,trans2));
+ PASS_THRU_REQ(ntvfs, req, trans, (ntvfs, req, trans2));
nbench_log(private, "Trans - NOT HANDLED\n");
Unix SMB/CIFS implementation.
NTVFS structures and defines
Copyright (C) Andrew Tridgell 2003
+ Copyright (C) Stefan Metzmacher 2004
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
/* modules can use the following to determine if the interface has changed */
-#define NTVFS_INTERFACE_VERSION 1
+/* version 1 -> 0 - make module stacking easier -- metze */
+#define NTVFS_INTERFACE_VERSION 0
+struct ntvfs_module_context;
+/* each backend has to be one one of the following 3 basic types. In
+ * earlier versions of Samba backends needed to handle all types, now
+ * we implement them separately. */
+enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC};
/* the ntvfs operations structure - contains function pointers to
the backend implementations of each operation */
enum ntvfs_type type;
/* initial setup */
- NTSTATUS (*connect)(struct smbsrv_request *req, const char *sharename, int depth);
- NTSTATUS (*disconnect)(struct smbsrv_tcon *tcon, int depth);
+ NTSTATUS (*connect)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename);
+ NTSTATUS (*disconnect)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon);
/* path operations */
- NTSTATUS (*unlink)(struct smbsrv_request *req, struct smb_unlink *unl);
- NTSTATUS (*chkpath)(struct smbsrv_request *req, struct smb_chkpath *cp);
- NTSTATUS (*qpathinfo)(struct smbsrv_request *req, union smb_fileinfo *st);
- NTSTATUS (*setpathinfo)(struct smbsrv_request *req, union smb_setfileinfo *st);
- NTSTATUS (*open)(struct smbsrv_request *req, union smb_open *oi);
- NTSTATUS (*mkdir)(struct smbsrv_request *req, union smb_mkdir *md);
- NTSTATUS (*rmdir)(struct smbsrv_request *req, struct smb_rmdir *rd);
- NTSTATUS (*rename)(struct smbsrv_request *req, union smb_rename *ren);
- NTSTATUS (*copy)(struct smbsrv_request *req, struct smb_copy *cp);
+ NTSTATUS (*unlink)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl);
+ NTSTATUS (*chkpath)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp);
+ NTSTATUS (*qpathinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *st);
+ NTSTATUS (*setpathinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st);
+ NTSTATUS (*open)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi);
+ NTSTATUS (*mkdir)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md);
+ NTSTATUS (*rmdir)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd);
+ NTSTATUS (*rename)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren);
+ NTSTATUS (*copy)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp);
/* directory search */
- NTSTATUS (*search_first)(struct smbsrv_request *req, union smb_search_first *io, void *private,
+ NTSTATUS (*search_first)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io, void *private,
BOOL (*callback)(void *private, union smb_search_data *file));
- NTSTATUS (*search_next)(struct smbsrv_request *req, union smb_search_next *io, void *private,
+ NTSTATUS (*search_next)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io, void *private,
BOOL (*callback)(void *private, union smb_search_data *file));
- NTSTATUS (*search_close)(struct smbsrv_request *req, union smb_search_close *io);
+ NTSTATUS (*search_close)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io);
/* operations on open files */
- NTSTATUS (*ioctl)(struct smbsrv_request *req, union smb_ioctl *io);
- NTSTATUS (*read)(struct smbsrv_request *req, union smb_read *io);
- NTSTATUS (*write)(struct smbsrv_request *req, union smb_write *io);
- NTSTATUS (*seek)(struct smbsrv_request *req, struct smb_seek *io);
- NTSTATUS (*flush)(struct smbsrv_request *req, struct smb_flush *flush);
- NTSTATUS (*close)(struct smbsrv_request *req, union smb_close *io);
- NTSTATUS (*exit)(struct smbsrv_request *req);
- NTSTATUS (*lock)(struct smbsrv_request *req, union smb_lock *lck);
- NTSTATUS (*setfileinfo)(struct smbsrv_request *req, union smb_setfileinfo *info);
- NTSTATUS (*qfileinfo)(struct smbsrv_request *req, union smb_fileinfo *info);
+ NTSTATUS (*ioctl)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io);
+ NTSTATUS (*read)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *io);
+ NTSTATUS (*write)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *io);
+ NTSTATUS (*seek)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io);
+ NTSTATUS (*flush)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *flush);
+ NTSTATUS (*close)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io);
+ NTSTATUS (*exit)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req);
+ NTSTATUS (*lock)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck);
+ NTSTATUS (*setfileinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info);
+ NTSTATUS (*qfileinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info);
/* filesystem operations */
- NTSTATUS (*fsinfo)(struct smbsrv_request *req, union smb_fsinfo *fs);
+ NTSTATUS (*fsinfo)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs);
/* printing specific operations */
- NTSTATUS (*lpq)(struct smbsrv_request *req, union smb_lpq *lpq);
+ NTSTATUS (*lpq)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq);
/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
- NTSTATUS (*trans2)(struct smbsrv_request *req, struct smb_trans2 *trans2);
+ NTSTATUS (*trans2)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2);
/* trans interface - used by IPC backend for pipes and RAP calls */
- NTSTATUS (*trans)(struct smbsrv_request *req, struct smb_trans2 *trans);
+ NTSTATUS (*trans)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans);
/* logoff - called when a vuid is closed */
- NTSTATUS (*logoff)(struct smbsrv_request *req);
+ NTSTATUS (*logoff)(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req);
};
+struct ntvfs_module_context {
+ struct ntvfs_module_context *prev, *next;
+ void *private_data;
+ const struct ntvfs_ops *ops;
+ int depth;
+};
+
+struct ntvfs_context {
+ enum ntvfs_type type;
+ /*
+ * linked list of module contexts
+ */
+ struct ntvfs_module_context *modules;
+};
/* this structure is used by backends to determine the size of some critical types */
struct ntvfs_critical_sizes {
int interface_version;
+ int sizeof_ntvfs_context;
+ int sizeof_ntvfs_module_context;
int sizeof_ntvfs_ops;
- int sizeof_SMB_OFF_T;
int sizeof_smbsrv_tcon;
int sizeof_smbsrv_request;
};
-
-/* useful macro for backends */
-#define NTVFS_GET_PRIVATE(struct_name, name, req) \
- struct struct_name *name = req->tcon->ntvfs_private_list[req->ntvfs_depth]
{
static const struct ntvfs_critical_sizes critical_sizes = {
NTVFS_INTERFACE_VERSION,
+ sizeof(struct ntvfs_context),
+ sizeof(struct ntvfs_module_context),
sizeof(struct ntvfs_ops),
- sizeof(SMB_OFF_T),
sizeof(struct smbsrv_tcon),
sizeof(struct smbsrv_request),
};
/*
initialise a connection structure to point at a NTVFS backend
*/
-NTSTATUS ntvfs_init_connection(struct smbsrv_request *req)
+NTSTATUS ntvfs_init_connection(struct smbsrv_request *req, enum ntvfs_type type)
{
const char **handlers = lp_ntvfs_handler(req->tcon->service);
+ int i;
+ struct ntvfs_context *ctx;
- req->tcon->ntvfs_ops = ntvfs_backend_byname(handlers[0], req->tcon->type);
+ if (!handlers) {
+ return NT_STATUS_FOOBAR;
+ }
- if (!req->tcon->ntvfs_ops) {
- DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handlers[0], req->tcon->type));
- return NT_STATUS_UNSUCCESSFUL;
+ ctx = talloc_p(req->tcon, struct ntvfs_context);
+ if (!ctx) {
+ return NT_STATUS_NO_MEMORY;
}
+ ctx->type = type;
+ ctx->modules = NULL;
- return NT_STATUS_OK;
-}
+ for (i=0; handlers[i]; i++) {
+ struct ntvfs_module_context *ntvfs;
+ ntvfs = talloc_p(ctx, struct ntvfs_module_context);
+ if (!ntvfs) {
+ return NT_STATUS_NO_MEMORY;
+ }
-/*
- set the private pointer for a backend
-*/
-void ntvfs_set_private(struct smbsrv_tcon *tcon, int depth, void *value)
-{
- tcon->ntvfs_private_list = talloc_realloc_p(tcon,
- tcon->ntvfs_private_list,
- void *, depth+1);
- tcon->ntvfs_private_list[depth] = value;
+ ntvfs->ops = ntvfs_backend_byname(handlers[i], ctx->type);
+ if (!ntvfs->ops) {
+ DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n",
+ handlers[i], ctx->type));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ ntvfs->depth = i;
+ DLIST_ADD_END(ctx->modules, ntvfs, struct ntvfs_module_context *);
+ }
+
+ if (!ctx->modules) {
+ talloc_free(ctx);
+ return NT_STATUS_FOOBAR;
+ }
+
+ req->tcon->ntvfs_ctx = ctx;
+
+ return NT_STATUS_OK;
}
NTVFS open generic to any mapper
*/
NTSTATUS ntvfs_map_open(struct smbsrv_request *req, union smb_open *io,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_open io2;
io2.generic.in.file_attr = io->openx.in.file_attrs;
io2.generic.in.fname = io->openx.in.fname;
- status = ops->open(req, &io2);
+ status = ntvfs->ops->open(ntvfs, req, &io2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
DEBUG(9,("ntvfs_map_open(OPEN): mapped flags=0x%x to access_mask=0x%x and share_access=0x%x\n",
io->open.in.flags, io2.generic.in.access_mask, io2.generic.in.share_access));
- status = ops->open(req, &io2);
+ status = ntvfs->ops->open(ntvfs, req, &io2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
NTVFS fsinfo generic to any mapper
*/
NTSTATUS ntvfs_map_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fsinfo fs2;
/* ask the backend for the generic info */
fs2.generic.level = RAW_QFS_GENERIC;
- status = ops->fsinfo(req, &fs2);
+ status = ntvfs->ops->fsinfo(ntvfs, req, &fs2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
NTVFS fileinfo generic to any mapper
*/
NTSTATUS ntvfs_map_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fileinfo info2;
info2.generic.level = RAW_FILEINFO_GENERIC;
info2.generic.in.fnum = info->generic.in.fnum;
- status = ops->qfileinfo(req, &info2);
+ status = ntvfs->ops->qfileinfo(ntvfs, req, &info2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
NTVFS pathinfo generic to any mapper
*/
NTSTATUS ntvfs_map_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info,
- const struct ntvfs_ops *ops)
+ struct ntvfs_module_context *ntvfs)
{
NTSTATUS status;
union smb_fileinfo info2;
info2.generic.level = RAW_FILEINFO_GENERIC;
info2.generic.in.fname = info->generic.in.fname;
- status = ops->qpathinfo(req, &info2);
+ status = ntvfs->ops->qpathinfo(ntvfs, req, &info2);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
--- /dev/null
+/*
+ Unix SMB/CIFS implementation.
+ NTVFS interface functions
+
+ Copyright (C) Stefan (metze) Metzmacher 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+/* connect/disconnect */
+NTSTATUS ntvfs_connect(struct smbsrv_request *req, const char *sharename)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->connect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->connect(ntvfs, req, sharename);
+}
+
+NTSTATUS ntvfs_disconnect(struct smbsrv_tcon *tcon)
+{
+ struct ntvfs_module_context *ntvfs = tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->disconnect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->disconnect(ntvfs, tcon);
+}
+
+/* path operations */
+NTSTATUS ntvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->unlink) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->unlink(ntvfs, req, unl);
+}
+
+NTSTATUS ntvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->chkpath) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->chkpath(ntvfs, req, cp);
+}
+
+NTSTATUS ntvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *st)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->qpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->qpathinfo(ntvfs, req, st);
+}
+
+NTSTATUS ntvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->setpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->setpathinfo(ntvfs, req, st);
+}
+
+NTSTATUS ntvfs_open(struct smbsrv_request *req, union smb_open *oi)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->open) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->open(ntvfs, req, oi);
+}
+
+NTSTATUS ntvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->mkdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->mkdir(ntvfs, req, md);
+}
+
+NTSTATUS ntvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->rmdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->rmdir(ntvfs, req, rd);
+}
+
+NTSTATUS ntvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->rename) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->rename(ntvfs, req, ren);
+}
+
+NTSTATUS ntvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->copy) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->copy(ntvfs, req, cp);
+}
+
+/* directory search */
+NTSTATUS ntvfs_search_first(struct smbsrv_request *req, union smb_search_first *io, void *private,
+ BOOL ntvfs_callback(void *private, union smb_search_data *file))
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_first) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_first(ntvfs, req, io, private, ntvfs_callback);
+}
+
+NTSTATUS ntvfs_search_next(struct smbsrv_request *req, union smb_search_next *io, void *private,
+ BOOL ntvfs_callback(void *private, union smb_search_data *file))
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_next) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_next(ntvfs, req, io, private, ntvfs_callback);
+}
+
+NTSTATUS ntvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->search_close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->search_close(ntvfs, req, io);
+}
+
+/* operations on open files */
+NTSTATUS ntvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->ioctl) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->ioctl(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_read(struct smbsrv_request *req, union smb_read *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->read) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->read(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_write(struct smbsrv_request *req, union smb_write *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->write) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->write(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->seek) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->seek(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_flush(struct smbsrv_request *req, struct smb_flush *flush)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->flush) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->flush(ntvfs, req, flush);
+}
+
+NTSTATUS ntvfs_close(struct smbsrv_request *req, union smb_close *io)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->close(ntvfs, req, io);
+}
+
+NTSTATUS ntvfs_exit(struct smbsrv_request *req)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->exit) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->exit(ntvfs, req);
+}
+
+NTSTATUS ntvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->lock) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->lock(ntvfs, req, lck);
+}
+
+NTSTATUS ntvfs_setfileinfo(struct smbsrv_request *req, union smb_setfileinfo *info)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->setfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->setfileinfo(ntvfs, req, info);
+}
+
+NTSTATUS ntvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->qfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->qfileinfo(ntvfs, req, info);
+}
+
+/* filesystem operations */
+NTSTATUS ntvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->fsinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->fsinfo(ntvfs, req, fs);
+}
+
+/* printing specific operations */
+NTSTATUS ntvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->lpq) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->lpq(ntvfs, req, lpq);
+}
+
+/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
+NTSTATUS ntvfs_trans2(struct smbsrv_request *req, struct smb_trans2 *trans2)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->trans2) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->trans2(ntvfs, req, trans2);
+}
+
+/* trans interface - used by IPC backend for pipes and RAP calls */
+NTSTATUS ntvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->trans) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->trans(ntvfs, req, trans);
+}
+
+/* logoff - called when a vuid is closed */
+NTSTATUS ntvfs_logoff(struct smbsrv_request *req)
+{
+ struct ntvfs_module_context *ntvfs = req->tcon->ntvfs_ctx->modules;
+ if (!ntvfs->ops->logoff) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->ops->logoff(ntvfs, req);
+}
+
+/* initial setup */
+NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->connect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->connect(ntvfs->next, req, sharename);
+}
+
+NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->disconnect) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->disconnect(ntvfs->next, tcon);
+}
+
+/* path operations */
+NTSTATUS ntvfs_next_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->unlink) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->unlink(ntvfs->next, req, unl);
+}
+
+NTSTATUS ntvfs_next_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->chkpath) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->chkpath(ntvfs->next, req, cp);
+}
+
+NTSTATUS ntvfs_next_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *st)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->qpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->qpathinfo(ntvfs->next, req, st);
+}
+
+NTSTATUS ntvfs_next_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->setpathinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->setpathinfo(ntvfs->next, req, st);
+}
+
+NTSTATUS ntvfs_next_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *oi)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->open) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->open(ntvfs->next, req, oi);
+}
+
+NTSTATUS ntvfs_next_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->mkdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->mkdir(ntvfs->next, req, md);
+}
+
+NTSTATUS ntvfs_next_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->rmdir) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->rmdir(ntvfs->next, req, rd);
+}
+
+NTSTATUS ntvfs_next_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->rename) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->rename(ntvfs->next, req, ren);
+}
+
+NTSTATUS ntvfs_next_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->copy) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->copy(ntvfs->next, req, cp);
+}
+
+/* directory search */
+NTSTATUS ntvfs_next_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io, void *private,
+ BOOL (*callback)(void *private, union smb_search_data *file))
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_first) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_first(ntvfs->next, req, io, private, callback);
+}
+
+NTSTATUS ntvfs_next_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io, void *private,
+ BOOL (*callback)(void *private, union smb_search_data *file))
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_next) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_next(ntvfs->next, req, io, private, callback);
+}
+
+NTSTATUS ntvfs_next_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->search_close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->search_close(ntvfs->next, req, io);
+}
+
+/* operations on open files */
+NTSTATUS ntvfs_next_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->ioctl) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->ioctl(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->read) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->read(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->write) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->write(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->seek) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->seek(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *flush)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->flush) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->flush(ntvfs->next, req, flush);
+}
+
+NTSTATUS ntvfs_next_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->close) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->close(ntvfs->next, req, io);
+}
+
+NTSTATUS ntvfs_next_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->exit) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->exit(ntvfs->next, req);
+}
+
+NTSTATUS ntvfs_next_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->lock) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->lock(ntvfs->next, req, lck);
+}
+
+NTSTATUS ntvfs_next_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *info)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->setfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->setfileinfo(ntvfs->next, req, info);
+}
+
+NTSTATUS ntvfs_next_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->qfileinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->qfileinfo(ntvfs->next, req, info);
+}
+
+/* filesystem operations */
+NTSTATUS ntvfs_next_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->fsinfo) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->fsinfo(ntvfs->next, req, fs);
+}
+
+/* printing specific operations */
+NTSTATUS ntvfs_next_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->lpq) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->lpq(ntvfs->next, req, lpq);
+}
+
+/* trans2 interface - only used by CIFS backend to prover complete passthru for testing */
+NTSTATUS ntvfs_next_trans2(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->trans2) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->trans2(ntvfs->next, req, trans2);
+}
+
+/* trans interface - used by IPC backend for pipes and RAP calls */
+NTSTATUS ntvfs_next_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->trans) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->trans(ntvfs->next, req, trans);
+}
+
+/* logoff - called when a vuid is closed */
+NTSTATUS ntvfs_next_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
+{
+ if (!ntvfs->next || !ntvfs->next->ops->logoff) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+ return ntvfs->next->ops->logoff(ntvfs->next, req);
+}
/*
return filesystem space info
*/
-NTSTATUS pvfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+NTSTATUS pvfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
- return ntvfs_map_fsinfo(req, fs, pvfs->ops);
+ return ntvfs_map_fsinfo(req, fs, ntvfs);
}
if (sys_fsusage(pvfs->base_directory,
/*
create a directory
*/
-NTSTATUS pvfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name;
/*
remove a directory
*/
-NTSTATUS pvfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+NTSTATUS pvfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name;
/*
find open file handle given fnum
*/
-struct pvfs_file *pvfs_find_fd(struct smbsrv_request *req, uint16_t fnum)
+struct pvfs_file *pvfs_find_fd(struct pvfs_state *pvfs,
+ struct smbsrv_request *req, uint16_t fnum)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
struct pvfs_file *f;
for (f=pvfs->open_files;f;f=f->next) {
if (f->fnum == fnum) {
TODO: this is a temporary implementation derived from the simple backend
its purpose is to allow other tests to run
*/
-NTSTATUS pvfs_open(struct smbsrv_request *req, union smb_open *io)
+NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
int fd, flags;
struct pvfs_filename *name;
struct pvfs_file *f;
NTSTATUS status;
if (io->generic.level != RAW_OPEN_GENERIC) {
- return ntvfs_map_open(req, io, pvfs->ops);
+ return ntvfs_map_open(req, io, ntvfs);
}
/* resolve the cifs name to a posix name */
/*
close a file
*/
-NTSTATUS pvfs_close(struct smbsrv_request *req, union smb_close *io)
+NTSTATUS pvfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f;
NTSTATUS status;
return NT_STATUS_INVALID_LEVEL;
}
- f = pvfs_find_fd(req, io->close.in.fnum);
+ f = pvfs_find_fd(pvfs, req, io->close.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
/*
logoff - close all file descriptors open by a vuid
*/
-NTSTATUS pvfs_logoff(struct smbsrv_request *req)
+NTSTATUS pvfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f, *next;
for (f=pvfs->open_files;f;f=next) {
/*
exit - close files for the current pid
*/
-NTSTATUS pvfs_exit(struct smbsrv_request *req)
+NTSTATUS pvfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f, *next;
for (f=pvfs->open_files;f;f=next) {
return NT_STATUS_OK;
}
-
/*
return info on a pathname
*/
-NTSTATUS pvfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+NTSTATUS pvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_filename *name;
NTSTATUS status;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qpathinfo(req, info, pvfs->ops);
+ return ntvfs_map_qpathinfo(req, info, ntvfs);
}
/* resolve the cifs name to a posix name */
/*
query info on a open file
*/
-NTSTATUS pvfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+NTSTATUS pvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_file *f;
NTSTATUS status;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qfileinfo(req, info, pvfs->ops);
+ return ntvfs_map_qfileinfo(req, info, ntvfs);
}
- f = pvfs_find_fd(req, info->generic.in.fnum);
+ f = pvfs_find_fd(pvfs, req, info->generic.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
/*
read from a file
*/
-NTSTATUS pvfs_read(struct smbsrv_request *req, union smb_read *rd)
+NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
ssize_t ret;
struct pvfs_file *f;
}
- f = pvfs_find_fd(req, rd->readx.in.fnum);
+ f = pvfs_find_fd(pvfs, req, rd->readx.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
/*
rename a set of files
*/
-NTSTATUS pvfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+NTSTATUS pvfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
NTSTATUS status;
struct pvfs_filename *name1, *name2;
/*
list files in a directory matching a wildcard pattern - old SMBsearch interface
*/
-static NTSTATUS pvfs_search_first_old(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS pvfs_search_first_old(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct pvfs_dir *dir;
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib;
}
/* continue a old style search */
-static NTSTATUS pvfs_search_next_old(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS pvfs_search_next_old(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count, max_count;
/*
list files in a directory matching a wildcard pattern
*/
-NTSTATUS pvfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+NTSTATUS pvfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct pvfs_dir *dir;
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint_t reply_count;
uint16_t search_attrib, max_count;
struct pvfs_filename *name;
if (io->generic.level >= RAW_SEARCH_SEARCH) {
- return pvfs_search_first_old(req, io, search_private, callback);
+ return pvfs_search_first_old(ntvfs, req, io, search_private, callback);
}
search_attrib = io->t2ffirst.in.search_attrib;
}
/* continue a search */
-NTSTATUS pvfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+NTSTATUS pvfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
struct pvfs_dir *dir;
uint_t reply_count;
int i;
if (io->generic.level >= RAW_SEARCH_SEARCH) {
- return pvfs_search_next_old(req, io, search_private, callback);
+ return pvfs_search_next_old(ntvfs, req, io, search_private, callback);
}
handle = io->t2fnext.in.handle;
}
/* close a search */
-NTSTATUS pvfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_search_state *search;
uint16_t handle;
/*
set info on a open file
*/
-NTSTATUS pvfs_setfileinfo(struct smbsrv_request *req,
+NTSTATUS pvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
- NTVFS_GET_PRIVATE(pvfs_private, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct utimbuf unix_times;
struct pvfs_file *f;
- f = pvfs_find_fd(req, info->generic.file.fnum);
+ f = pvfs_find_fd(pvfs, req, info->generic.file.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-NTSTATUS pvfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_dir *dir;
NTSTATUS status;
uint32_t i, total_deleted=0;
/*
write to a file
*/
-NTSTATUS pvfs_write(struct smbsrv_request *req, union smb_write *wr)
+NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
ssize_t ret;
struct pvfs_file *f;
switch (wr->generic.level) {
case RAW_WRITE_WRITEX:
- f = pvfs_find_fd(req, wr->writex.in.fnum);
+ f = pvfs_find_fd(pvfs, req, wr->writex.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
return NT_STATUS_OK;
case RAW_WRITE_WRITE:
- f = pvfs_find_fd(req, wr->write.in.fnum);
+ f = pvfs_find_fd(pvfs, req, wr->write.in.fnum);
if (!f) {
return NT_STATUS_INVALID_HANDLE;
}
directory exists (tho it doesn't need to be accessible by the user,
that comes later)
*/
-static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct smbsrv_tcon *tcon = req->tcon;
struct pvfs_state *pvfs;
pvfs->tcon = tcon;
pvfs->base_directory = base_directory;
- pvfs->ops = ntvfs_backend_byname("posix", NTVFS_DISK);
/* the directory must exist. Note that we deliberately don't
check that it is readable */
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
- ntvfs_set_private(tcon, depth, pvfs);
+ ntvfs->private_data = pvfs;
pvfs_setup_options(pvfs);
/*
disconnect from a share
*/
-static NTSTATUS pvfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS pvfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
/*
ioctl interface - we don't do any
*/
-static NTSTATUS pvfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS pvfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_INVALID_PARAMETER;
}
/*
check if a directory exists
*/
-static NTSTATUS pvfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS pvfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
- NTVFS_GET_PRIVATE(pvfs_state, pvfs, req);
+ struct pvfs_state *pvfs = ntvfs->private_data;
struct pvfs_filename *name;
NTSTATUS status;
/*
copy a set of files
*/
-static NTSTATUS pvfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS pvfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
DEBUG(0,("pvfs_copy not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
/*
seek in a file
*/
-static NTSTATUS pvfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS pvfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
DEBUG(0,("pvfs_seek not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
/*
flush a file
*/
-static NTSTATUS pvfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS pvfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
DEBUG(0,("pvfs_flush not implemented\n"));
return NT_STATUS_NOT_IMPLEMENTED;
/*
lock a byte range
*/
-static NTSTATUS pvfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
DEBUG(0,("pvfs_lock not implemented\n"));
return NT_STATUS_NOT_IMPLEMENTED;
/*
set info on a pathname
*/
-static NTSTATUS pvfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS pvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
DEBUG(0,("pvfs_setpathinfo not implemented\n"));
return NT_STATUS_NOT_SUPPORTED;
/*
return print queue info
*/
-static NTSTATUS pvfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS pvfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
/* SMBtrans - not used on file shares */
-static NTSTATUS pvfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS pvfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}
} search;
struct pvfs_file *open_files;
-
- const struct ntvfs_ops *ops;
};
in. For printing shares this should check that the spool directory
is available
*/
-static NTSTATUS print_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
return NT_STATUS_OK;
}
/*
disconnect from a share
*/
-static NTSTATUS print_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS print_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
/*
lots of operations are not allowed on printing shares - mostly return NT_STATUS_ACCESS_DENIED
*/
-static NTSTATUS print_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS print_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
return NT_STATUS_ACCESS_DENIED;
}
/*
ioctl - used for job query
*/
-static NTSTATUS print_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
char *p;
uint16_t next_search_handle;
struct svfs_file *open_files;
-
- const struct ntvfs_ops *ops;
};
struct svfs_dir {
/*
convert a windows path to a unix path - don't do any manging or case sensitive handling
*/
-char *svfs_unix_path(struct smbsrv_request *req, const char *name)
+char *svfs_unix_path(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *name)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
char *ret;
if (*name != '\\') {
returned names are separate unix and DOS names. The returned names
are relative to the directory
*/
-struct svfs_dir *svfs_list(TALLOC_CTX *mem_ctx, struct smbsrv_request *req, const char *pattern)
+struct svfs_dir *svfs_list(struct ntvfs_module_context *ntvfs, struct smbsrv_request *req, const char *pattern)
{
+ struct svfs_private *private = ntvfs->private_data;
char *unix_path;
- unix_path = svfs_unix_path(req, pattern);
+ unix_path = svfs_unix_path(ntvfs, req, pattern);
if (!unix_path) { return NULL; }
- return svfs_list_unix(mem_ctx, req, unix_path);
+ return svfs_list_unix(private, req, unix_path);
}
directory exists (tho it doesn't need to be accessible by the user,
that comes later)
*/
-static NTSTATUS svfs_connect(struct smbsrv_request *req, const char *sharename, int depth)
+static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, const char *sharename)
{
struct stat st;
struct smbsrv_tcon *tcon = req->tcon;
private->next_search_handle = 0;
private->connectpath = talloc_strdup(tcon, lp_pathname(tcon->service));
private->open_files = NULL;
- private->ops = ntvfs_backend_byname("simple", NTVFS_DISK);
private->search = NULL;
/* the directory must exist */
tcon->fs_type = talloc_strdup(tcon, "NTFS");
tcon->dev_type = talloc_strdup(tcon, "A:");
- ntvfs_set_private(tcon, depth, private);
+ ntvfs->private_data = private;
DEBUG(0,("WARNING: ntvfs simple: connect to share [%s] with ROOT privileges!!!\n",sharename));
/*
disconnect from a share
*/
-static NTSTATUS svfs_disconnect(struct smbsrv_tcon *tcon, int depth)
+static NTSTATUS svfs_disconnect(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_tcon *tcon)
{
return NT_STATUS_OK;
}
delete a file - the dirtype specifies the file types to include in the search.
The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
*/
-static NTSTATUS svfs_unlink(struct smbsrv_request *req, struct smb_unlink *unl)
+static NTSTATUS svfs_unlink(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_unlink *unl)
{
char *unix_path;
CHECK_READ_ONLY(req);
- unix_path = svfs_unix_path(req, unl->in.pattern);
+ unix_path = svfs_unix_path(ntvfs, req, unl->in.pattern);
/* ignoring wildcards ... */
if (unlink(unix_path) == -1) {
/*
ioctl interface - we don't do any
*/
-static NTSTATUS svfs_ioctl(struct smbsrv_request *req, union smb_ioctl *io)
+static NTSTATUS svfs_ioctl(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_ioctl *io)
{
return NT_STATUS_INVALID_PARAMETER;
}
/*
check if a directory exists
*/
-static NTSTATUS svfs_chkpath(struct smbsrv_request *req, struct smb_chkpath *cp)
+static NTSTATUS svfs_chkpath(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_chkpath *cp)
{
char *unix_path;
struct stat st;
- unix_path = svfs_unix_path(req, cp->in.path);
+ unix_path = svfs_unix_path(ntvfs, req, cp->in.path);
if (stat(unix_path, &st) == -1) {
return map_nt_error_from_unix(errno);
/*
approximately map a struct stat to a generic fileinfo struct
*/
-static NTSTATUS svfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo *info,
+static NTSTATUS svfs_map_fileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info,
struct stat *st, const char *unix_path)
{
struct svfs_dir *dir = NULL;
/*
return info on a pathname
*/
-static NTSTATUS svfs_qpathinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS svfs_qpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
char *unix_path;
struct stat st;
DEBUG(19,("svfs_qpathinfo: file %s level 0x%x\n", info->generic.in.fname, info->generic.level));
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qpathinfo(req, info, private->ops);
+ return ntvfs_map_qpathinfo(req, info, ntvfs);
}
- unix_path = svfs_unix_path(req, info->generic.in.fname);
+ unix_path = svfs_unix_path(ntvfs, req, info->generic.in.fname);
DEBUG(19,("svfs_qpathinfo: file %s\n", unix_path));
if (stat(unix_path, &st) == -1) {
DEBUG(19,("svfs_qpathinfo: file %s errno=%d\n", unix_path, errno));
return map_nt_error_from_unix(errno);
}
DEBUG(19,("svfs_qpathinfo: file %s, stat done\n", unix_path));
- return svfs_map_fileinfo(req, info, &st, unix_path);
+ return svfs_map_fileinfo(ntvfs, req, info, &st, unix_path);
}
/*
query info on a open file
*/
-static NTSTATUS svfs_qfileinfo(struct smbsrv_request *req, union smb_fileinfo *info)
+static NTSTATUS svfs_qfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fileinfo *info)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct svfs_file *f;
struct stat st;
if (info->generic.level != RAW_FILEINFO_GENERIC) {
- return ntvfs_map_qfileinfo(req, info, private->ops);
+ return ntvfs_map_qfileinfo(req, info, ntvfs);
}
f = find_fd(private, info->generic.in.fnum);
return map_nt_error_from_unix(errno);
}
- return svfs_map_fileinfo(req, info, &st, f->name);
+ return svfs_map_fileinfo(ntvfs, req,info, &st, f->name);
}
/*
open a file
*/
-static NTSTATUS svfs_open(struct smbsrv_request *req, union smb_open *io)
+static NTSTATUS svfs_open(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_open *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
char *unix_path;
struct stat st;
int fd, flags;
int create_flags, rdwr_flags;
if (io->generic.level != RAW_OPEN_GENERIC) {
- return ntvfs_map_open(req, io, private->ops);
+ return ntvfs_map_open(req, io, ntvfs);
}
if (lp_readonly(req->tcon->service)) {
rdwr_flags = O_RDWR;
}
- unix_path = svfs_unix_path(req, io->ntcreatex.in.fname);
+ unix_path = svfs_unix_path(ntvfs, req, io->ntcreatex.in.fname);
switch (io->generic.in.open_disposition) {
case NTCREATEX_DISP_SUPERSEDE:
/*
create a directory
*/
-static NTSTATUS svfs_mkdir(struct smbsrv_request *req, union smb_mkdir *md)
+static NTSTATUS svfs_mkdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_mkdir *md)
{
char *unix_path;
return NT_STATUS_INVALID_LEVEL;
}
- unix_path = svfs_unix_path(req, md->mkdir.in.path);
+ unix_path = svfs_unix_path(ntvfs, req, md->mkdir.in.path);
if (mkdir(unix_path, 0777) == -1) {
return map_nt_error_from_unix(errno);
/*
remove a directory
*/
-static NTSTATUS svfs_rmdir(struct smbsrv_request *req, struct smb_rmdir *rd)
+static NTSTATUS svfs_rmdir(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_rmdir *rd)
{
char *unix_path;
CHECK_READ_ONLY(req);
- unix_path = svfs_unix_path(req, rd->in.path);
+ unix_path = svfs_unix_path(ntvfs, req, rd->in.path);
if (rmdir(unix_path) == -1) {
return map_nt_error_from_unix(errno);
/*
rename a set of files
*/
-static NTSTATUS svfs_rename(struct smbsrv_request *req, union smb_rename *ren)
+static NTSTATUS svfs_rename(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_rename *ren)
{
char *unix_path1, *unix_path2;
return NT_STATUS_INVALID_LEVEL;
}
- unix_path1 = svfs_unix_path(req, ren->rename.in.pattern1);
- unix_path2 = svfs_unix_path(req, ren->rename.in.pattern2);
+ unix_path1 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern1);
+ unix_path2 = svfs_unix_path(ntvfs, req, ren->rename.in.pattern2);
if (rename(unix_path1, unix_path2) != 0) {
return map_nt_error_from_unix(errno);
/*
copy a set of files
*/
-static NTSTATUS svfs_copy(struct smbsrv_request *req, struct smb_copy *cp)
+static NTSTATUS svfs_copy(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_copy *cp)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
read from a file
*/
-static NTSTATUS svfs_read(struct smbsrv_request *req, union smb_read *rd)
+static NTSTATUS svfs_read(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_read *rd)
{
ssize_t ret;
/*
write to a file
*/
-static NTSTATUS svfs_write(struct smbsrv_request *req, union smb_write *wr)
+static NTSTATUS svfs_write(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_write *wr)
{
ssize_t ret;
/*
seek in a file
*/
-static NTSTATUS svfs_seek(struct smbsrv_request *req, struct smb_seek *io)
+static NTSTATUS svfs_seek(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_seek *io)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
flush a file
*/
-static NTSTATUS svfs_flush(struct smbsrv_request *req, struct smb_flush *io)
+static NTSTATUS svfs_flush(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_flush *io)
{
fsync(io->in.fnum);
return NT_STATUS_OK;
/*
close a file
*/
-static NTSTATUS svfs_close(struct smbsrv_request *req, union smb_close *io)
+static NTSTATUS svfs_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_close *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct svfs_file *f;
if (io->generic.level != RAW_CLOSE_CLOSE) {
/*
exit - closing files
*/
-static NTSTATUS svfs_exit(struct smbsrv_request *req)
+static NTSTATUS svfs_exit(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
logoff - closing files
*/
-static NTSTATUS svfs_logoff(struct smbsrv_request *req)
+static NTSTATUS svfs_logoff(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
lock a byte range
*/
-static NTSTATUS svfs_lock(struct smbsrv_request *req, union smb_lock *lck)
+static NTSTATUS svfs_lock(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lock *lck)
{
DEBUG(0,("REWRITE: not doing byte range locking!\n"));
return NT_STATUS_OK;
/*
set info on a pathname
*/
-static NTSTATUS svfs_setpathinfo(struct smbsrv_request *req, union smb_setfileinfo *st)
+static NTSTATUS svfs_setpathinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_setfileinfo *st)
{
CHECK_READ_ONLY(req);
/*
set info on a open file
*/
-static NTSTATUS svfs_setfileinfo(struct smbsrv_request *req,
+static NTSTATUS svfs_setfileinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req,
union smb_setfileinfo *info)
{
struct utimbuf unix_times;
/*
return filesystem space info
*/
-static NTSTATUS svfs_fsinfo(struct smbsrv_request *req, union smb_fsinfo *fs)
+static NTSTATUS svfs_fsinfo(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsinfo *fs)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct stat st;
if (fs->generic.level != RAW_QFS_GENERIC) {
- return ntvfs_map_fsinfo(req, fs, private->ops);
+ return ntvfs_map_fsinfo(req, fs, ntvfs);
}
if (sys_fsusage(private->connectpath,
/*
return filesystem attribute info
*/
-static NTSTATUS svfs_fsattr(struct smbsrv_request *req, union smb_fsattr *fs)
+static NTSTATUS svfs_fsattr(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_fsattr *fs)
{
struct stat st;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
if (fs->generic.level != RAW_FSATTR_GENERIC) {
- return ntvfs_map_fsattr(req, fs);
+ return ntvfs_map_fsattr(req, fs, ntvfs);
}
if (stat(private->connectpath, &st) != 0) {
/*
return print queue info
*/
-static NTSTATUS svfs_lpq(struct smbsrv_request *req, union smb_lpq *lpq)
+static NTSTATUS svfs_lpq(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_lpq *lpq)
{
return NT_STATUS_NOT_SUPPORTED;
}
/*
list files in a directory matching a wildcard pattern
*/
-static NTSTATUS svfs_search_first(struct smbsrv_request *req, union smb_search_first *io,
+static NTSTATUS svfs_search_first(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_first *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct svfs_dir *dir;
int i;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
max_count = io->t2ffirst.in.max_count;
- dir = svfs_list(private, req, io->t2ffirst.in.pattern);
+ dir = svfs_list(ntvfs, req, io->t2ffirst.in.pattern);
if (!dir) {
return NT_STATUS_FOOBAR;
}
}
/* continue a search */
-static NTSTATUS svfs_search_next(struct smbsrv_request *req, union smb_search_next *io,
+static NTSTATUS svfs_search_next(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_next *io,
void *search_private,
BOOL (*callback)(void *, union smb_search_data *))
{
struct svfs_dir *dir;
int i;
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
union smb_search_data file;
uint_t max_count;
}
/* close a search */
-static NTSTATUS svfs_search_close(struct smbsrv_request *req, union smb_search_close *io)
+static NTSTATUS svfs_search_close(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, union smb_search_close *io)
{
- NTVFS_GET_PRIVATE(svfs_private, private, req);
+ struct svfs_private *private = ntvfs->private_data;
struct search_state *search;
for (search=private->search; search; search = search->next) {
}
/* SMBtrans - not used on file shares */
-static NTSTATUS svfs_trans(struct smbsrv_request *req, struct smb_trans2 *trans2)
+static NTSTATUS svfs_trans(struct ntvfs_module_context *ntvfs,
+ struct smbsrv_request *req, struct smb_trans2 *trans2)
{
return NT_STATUS_ACCESS_DENIED;
}
nttrans_setup_reply(req, trans, 0, 0, 1);
trans->out.setup[0] = 0;
- return req->tcon->ntvfs_ops->ioctl(req, &nt);
+ return ntvfs_ioctl(req, &nt);
}
/*
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->ioctl(req, io);
+ req->async.status = ntvfs_ioctl(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
- req->async.status = req->tcon->ntvfs_ops->chkpath(req, io);
+ req->async.status = ntvfs_chkpath(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = st;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->qpathinfo(req, st);
+ req->async.status = ntvfs_qpathinfo(req, st);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->setpathinfo(req, st);
+ req->async.status = ntvfs_setpathinfo(req, st);
REQ_ASYNC_TAIL;
}
req->async.private = fs;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->fsinfo(req, fs);
+ req->async.status = ntvfs_fsinfo(req, fs);
REQ_ASYNC_TAIL;
}
req->async.private = oi;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, oi);
+ req->async.status = ntvfs_open(req, oi);
REQ_ASYNC_TAIL;
}
req->async.private = oi;
/* call the backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, oi);
+ req->async.status = ntvfs_open(req, oi);
REQ_ASYNC_TAIL;
}
req->async.private = oi;
/* call the backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, oi);
+ req->async.status = ntvfs_open(req, oi);
REQ_ASYNC_TAIL;
}
req->async.private = oi;
/* call the backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, oi);
+ req->async.status = ntvfs_open(req, oi);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->unlink(req, unl);
+ req->async.status = ntvfs_unlink(req, unl);
REQ_ASYNC_TAIL;
}
io.readbraw.out.data = req->out.buffer + NBT_HDR_SIZE;
/* call the backend */
- status = req->tcon->ntvfs_ops->read(req, &io);
+ status = ntvfs_read(req, &io);
if (!NT_STATUS_IS_OK(status)) {
goto failed;
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->read(req, io);
+ req->async.status = ntvfs_read(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->read(req, io);
+ req->async.status = ntvfs_read(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->read(req, io);
+ req->async.status = ntvfs_read(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->write(req, io);
+ req->async.status = ntvfs_write(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->write(req, io);
+ req->async.status = ntvfs_write(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->write(req, io);
+ req->async.status = ntvfs_write(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->seek(req, io);
+ req->async.status = ntvfs_seek(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->flush(req, io);
+ req->async.status = ntvfs_flush(req, io);
REQ_ASYNC_TAIL;
}
for (tcon=req->smb_conn->tree.tcons;tcon;tcon=tcon->next) {
req->tcon = tcon;
- status = tcon->ntvfs_ops->exit(req);
+ status = ntvfs_exit(req);
req->tcon = NULL;
if (!NT_STATUS_IS_OK(status)) {
req_reply_error(req, status);
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->close(req, io);
+ req->async.status = ntvfs_close(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = io;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->write(req, io);
+ req->async.status = ntvfs_write(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->lock(req, lck);
+ req->async.status = ntvfs_lock(req, lck);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->lock(req, lck);
+ req->async.status = ntvfs_lock(req, lck);
REQ_ASYNC_TAIL;
}
req->async.private = oi;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, oi);
+ req->async.status = ntvfs_open(req, oi);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->close(req, io);
+ req->async.status = ntvfs_close(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = lpq;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->lpq(req, lpq);
+ req->async.status = ntvfs_lpq(req, lpq);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->write(req, io);
+ req->async.status = ntvfs_write(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->mkdir(req, io);
+ req->async.status = ntvfs_mkdir(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->rmdir(req, io);
+ req->async.status = ntvfs_rmdir(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->rename(req, io);
+ req->async.status = ntvfs_rename(req, io);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->rename(req, io);
+ req->async.status = ntvfs_rename(req, io);
REQ_ASYNC_TAIL;
}
req->async.private = cp;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->copy(req, cp);
+ req->async.status = ntvfs_copy(req, cp);
REQ_ASYNC_TAIL;
}
req->async.private = lck;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->lock(req, lck);
+ req->async.status = ntvfs_lock(req, lck);
REQ_ASYNC_TAIL;
}
req->async.send_fn = reply_simple_send;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->setfileinfo(req, info);
+ req->async.status = ntvfs_setfileinfo(req, info);
REQ_ASYNC_TAIL;
}
req->async.private = info;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->qfileinfo(req, info);
+ req->async.status = ntvfs_qfileinfo(req, info);
REQ_ASYNC_TAIL;
}
if ((vuid != 0) && (lp_security() != SEC_SHARE)) {
for (tcon=req->smb_conn->tree.tcons;tcon;tcon=tcon->next) {
req->tcon = tcon;
- status = tcon->ntvfs_ops->logoff(req);
+ status = ntvfs_logoff(req);
req->tcon = NULL;
if (!NT_STATUS_IS_OK(status)) {
req_reply_error(req, status);
io.findclose.in.handle = SVAL(req->in.vwv, VWV(0));
/* call backend */
- status = req->tcon->ntvfs_ops->search_close(req, &io);
+ status = ntvfs_search_close(req, &io);
if (!NT_STATUS_IS_OK(status)) {
req_reply_error(req, status);
req->async.private = io;
/* call the backend */
- req->async.status = req->tcon->ntvfs_ops->open(req, io);
+ req->async.status = ntvfs_open(req, io);
REQ_ASYNC_TAIL;
}
sn->search_next.in.search_attrib = SVAL(req->in.vwv, VWV(1));
/* call backend */
- status = req->tcon->ntvfs_ops->search_next(req, sn, &state, find_callback);
+ status = ntvfs_search_next(req, sn, &state, find_callback);
SSVAL(req->out.vwv, VWV(0), sn->search_next.out.count);
} else {
/* do a search first operation */
sf->search_first.in.max_count = SVAL(req->in.vwv, VWV(0));
/* call backend */
- status = req->tcon->ntvfs_ops->search_first(req, sf, &state, find_callback);
+ status = ntvfs_search_first(req, sf, &state, find_callback);
SSVAL(req->out.vwv, VWV(0), sf->search_first.out.count);
}
req->async.private = sc;
/* call backend */
- req->async.status = req->tcon->ntvfs_ops->search_close(req, sc);
+ req->async.status = ntvfs_search_close(req, sc);
REQ_ASYNC_TAIL;
}
req->tcon = tcon;
tcon->service = snum;
- tcon->type = type;
/*
* New code to check if there's a share security descripter
}
/* init ntvfs function pointers */
- status = ntvfs_init_connection(req);
+ status = ntvfs_init_connection(req, type);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("ntvfs_init_connection failed for service %s\n", lp_servicename(SNUM(tcon))));
conn_free(req->smb_conn, tcon);
}
/* Invoke NTVFS connection hook */
- if (tcon->ntvfs_ops->connect) {
- status = tcon->ntvfs_ops->connect(req, lp_servicename(snum), 0);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("make_connection: NTVFS make connection failed!\n"));
- conn_free(req->smb_conn, tcon);
- return status;
- }
+ status = ntvfs_connect(req, lp_servicename(snum));
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("make_connection: NTVFS make connection failed!\n"));
+ conn_free(req->smb_conn, tcon);
+ return status;
}
return NT_STATUS_OK;
lp_servicename(SNUM(tcon))));
/* tell the ntvfs backend that we are disconnecting */
- tcon->ntvfs_ops->disconnect(tcon, 0);
+ ntvfs_disconnect(tcon);
conn_free(tcon->smb_conn, tcon);
}
}
/* ipc services are limited */
- if (req->tcon && req->tcon->type == NTVFS_IPC && (flags & AS_USER) && !(flags & CAN_IPC)) {
+ if (req->tcon && req->tcon->ntvfs_ctx->type == NTVFS_IPC && (flags & AS_USER) && !(flags & CAN_IPC)) {
req_reply_error(req, NT_STATUS_ACCESS_DENIED);
return;
}
struct auth_session_info *session_info;
};
-
-/* each backend has to be one one of the following 3 basic types. In
- * earlier versions of Samba backends needed to handle all types, now
- * we implement them separately. */
-enum ntvfs_type {NTVFS_DISK, NTVFS_PRINT, NTVFS_IPC};
-
/* we need a forward declaration of the ntvfs_ops strucutre to prevent
include recursion */
-struct ntvfs_ops;
+struct ntvfs_context;
struct smbsrv_tcon {
struct smbsrv_tcon *next, *prev;
/* the server context that this was created on */
struct smbsrv_connection *smb_conn;
- /* an array of private structures used by the active NTVFS backends */
- void **ntvfs_private_list;
-
uint16_t cnum; /* an index passed over the wire (the TID) */
int service;
- enum ntvfs_type type;
BOOL read_only;
BOOL admin_user;
- /* the NTVFS operations - see source/ntvfs/ and include/ntvfs.h for details */
- const struct ntvfs_ops *ntvfs_ops;
+ /* the NTVFS context - see source/ntvfs/ for details */
+ struct ntvfs_context *ntvfs_ctx;
/* the reported filesystem type */
char *fs_type;
/* the session context is derived from the vuid */
struct smbsrv_session *session;
- /* the ntvfs chaining depth */
- int ntvfs_depth;
-
/* a set of flags to control usage of the request. See REQ_CONTROL_* */
unsigned control_flags;
case SMB_QFS_ALLOCATION:
fsinfo.allocation.level = RAW_QFS_ALLOCATION;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_VOLUME:
fsinfo.volume.level = RAW_QFS_VOLUME;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_VOLUME_INFORMATION:
fsinfo.volume_info.level = RAW_QFS_VOLUME_INFO;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_SIZE_INFORMATION:
fsinfo.size_info.level = RAW_QFS_SIZE_INFO;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_DEVICE_INFORMATION:
fsinfo.device_info.level = RAW_QFS_DEVICE_INFO;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_ATTRIBUTE_INFORMATION:
fsinfo.attribute_info.level = RAW_QFS_ATTRIBUTE_INFO;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_QUOTA_INFORMATION:
fsinfo.quota_information.level = RAW_QFS_QUOTA_INFORMATION;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_FULL_SIZE_INFORMATION:
fsinfo.full_size_information.level = RAW_QFS_FULL_SIZE_INFORMATION;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
case SMB_QFS_OBJECTID_INFORMATION:
fsinfo.objectid_information.level = RAW_QFS_OBJECTID_INFORMATION;
- status = req->tcon->ntvfs_ops->fsinfo(req, &fsinfo);
+ status = ntvfs_fsinfo(req, &fsinfo);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
}
/* call the backend */
- status = req->tcon->ntvfs_ops->qpathinfo(req, &st);
+ status = ntvfs_qpathinfo(req, &st);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
}
/* call the backend */
- status = req->tcon->ntvfs_ops->qfileinfo(req, &st);
+ status = ntvfs_qfileinfo(req, &st);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
return status;
}
- status = req->tcon->ntvfs_ops->setfileinfo(req, &st);
+ status = ntvfs_setfileinfo(req, &st);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
return status;
}
- status = req->tcon->ntvfs_ops->setpathinfo(req, &st);
+ status = ntvfs_setpathinfo(req, &st);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
trans2_setup_reply(req, trans, 10, 0, 0);
/* call the backend */
- status = req->tcon->ntvfs_ops->search_first(req, &search, &state, find_callback);
+ status = ntvfs_search_first(req, &search, &state, find_callback);
if (!NT_STATUS_IS_OK(status)) {
trans2_setup_reply(req, trans, 0, 0, 0);
return status;
trans2_setup_reply(req, trans, 8, 0, 0);
/* call the backend */
- status = req->tcon->ntvfs_ops->search_next(req, &search, &state, find_callback);
+ status = ntvfs_search_next(req, &search, &state, find_callback);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
*/
static NTSTATUS trans2_backend(struct smbsrv_request *req, struct smb_trans2 *trans)
{
- if (req->tcon->ntvfs_ops->trans2 != NULL) {
- /* direct trans2 pass thru */
- return req->tcon->ntvfs_ops->trans2(req, trans);
+ NTSTATUS status;
+
+ /* direct trans2 pass thru */
+ status = ntvfs_trans2(req, trans);
+ if (!NT_STATUS_EQUAL(NT_STATUS_NOT_IMPLEMENTED, status)) {
+ return status;
}
/* must have at least one setup word */
return NT_STATUS_FOOBAR;
}
-
-/*
- backend for trans requests
-*/
-static NTSTATUS trans_backend(struct smbsrv_request *req, struct smb_trans2 *trans)
-{
- if (!req->tcon->ntvfs_ops->trans) {
- return NT_STATUS_NOT_IMPLEMENTED;
- }
- return req->tcon->ntvfs_ops->trans(req, trans);
-}
-
-
/****************************************************************************
Reply to an SMBtrans or SMBtrans2 request
****************************************************************************/
/* its a full request, give it to the backend */
if (command == SMBtrans) {
- status = trans_backend(req, &trans);
+ status = ntvfs_trans(req, &trans);
} else {
status = trans2_backend(req, &trans);
}