2003-08-13 01:53:07 +00:00
/*
Unix SMB / CIFS implementation .
CIFS - on - CIFS NTVFS filesystem backend
Copyright ( C ) Andrew Tridgell 2003
Copyright ( C ) James J Myers 2003 < myersjj @ samba . org >
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 0213 9 , USA .
*/
/*
this implements a CIFS - > CIFS NTVFS filesystem backend .
*/
# include "includes.h"
/* this is stored in ntvfs_private */
struct cvfs_private {
2004-08-04 13:23:35 +00:00
struct smbcli_tree * tree ;
struct smbcli_transport * transport ;
2004-06-28 08:27:36 +00:00
struct smbsrv_tcon * tcon ;
2004-10-20 11:08:58 +00:00
BOOL map_generic ;
2003-08-13 01:53:07 +00:00
} ;
/* a structure used to pass information to an async handler */
struct async_info {
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req ;
2003-08-13 01:53:07 +00:00
void * parms ;
} ;
2004-10-20 12:08:40 +00:00
# define SETUP_PID private->tree->session->pid = SVAL(req->in.hdr, HDR_PID)
2003-08-13 01:53:07 +00:00
/*
an idle function to cope with messages from the smbd client while
waiting for a reply from the server
this function won ' t be needed once all of the cifs backend
and the core of smbd is converted to use async calls
*/
2004-08-04 13:23:35 +00:00
static void idle_func ( struct smbcli_transport * transport , void * p_private )
2003-08-13 01:53:07 +00:00
{
struct cvfs_private * private = p_private ;
2004-09-20 12:31:07 +00:00
int fd = socket_get_fd ( private - > tcon - > smb_conn - > connection - > socket ) ;
if ( socket_pending ( fd ) ) {
2004-06-29 07:40:14 +00:00
smbd_process_async ( private - > tcon - > smb_conn ) ;
2003-08-13 01:53:07 +00:00
}
}
/*
a handler for oplock break events from the server - these need to be passed
along to the client
*/
2004-08-04 13:23:35 +00:00
static BOOL oplock_handler ( struct smbcli_transport * transport , uint16_t tid , uint16_t fnum , uint8_t level , void * p_private )
2003-08-13 01:53:07 +00:00
{
struct cvfs_private * private = p_private ;
DEBUG ( 5 , ( " vfs_cifs: sending oplock break level %d for fnum %d \n " , level , fnum ) ) ;
2004-06-28 08:27:36 +00:00
return req_send_oplock_break ( private - > tcon , fnum , level ) ;
2003-08-13 01:53:07 +00:00
}
2004-07-23 06:40:49 +00:00
/*
2003-08-13 01:53:07 +00:00
a handler for read events on a connection to a backend server
*/
2004-05-25 17:24:24 +00:00
static void cifs_socket_handler ( struct event_context * ev , struct fd_event * fde , time_t t , uint16_t flags )
2003-08-13 01:53:07 +00:00
{
2004-03-08 07:13:11 +00:00
struct cvfs_private * private = fde - > private ;
2004-06-28 08:27:36 +00:00
struct smbsrv_tcon * tcon = private - > tcon ;
2004-07-23 06:40:49 +00:00
2003-08-13 01:53:07 +00:00
DEBUG ( 5 , ( " cifs_socket_handler event on fd %d \n " , fde - > fd ) ) ;
2004-07-23 06:40:49 +00:00
2004-08-04 13:23:35 +00:00
if ( ! smbcli_transport_process ( private - > transport ) ) {
2003-08-13 01:53:07 +00:00
/* the connection to our server is dead */
2004-06-28 08:27:36 +00:00
close_cnum ( tcon ) ;
2003-08-13 01:53:07 +00:00
}
}
/*
connect to a share - used when a tree_connect operation comes in .
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_connect ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , const char * sharename )
2003-08-13 01:53:07 +00:00
{
2004-06-28 08:27:36 +00:00
struct smbsrv_tcon * tcon = req - > tcon ;
2003-08-13 01:53:07 +00:00
NTSTATUS status ;
struct cvfs_private * private ;
const char * host , * user , * pass , * domain , * remote_share ;
/* Here we need to determine which server to connect to.
* For now we use parametric options , type cifs .
* Later we will use security = server and auth_server . c .
*/
2004-06-28 08:27:36 +00:00
host = lp_parm_string ( req - > tcon - > service , " cifs " , " server " ) ;
user = lp_parm_string ( req - > tcon - > service , " cifs " , " user " ) ;
pass = lp_parm_string ( req - > tcon - > service , " cifs " , " password " ) ;
domain = lp_parm_string ( req - > tcon - > service , " cifs " , " domain " ) ;
remote_share = lp_parm_string ( req - > tcon - > service , " cifs " , " share " ) ;
2003-08-13 01:53:07 +00:00
if ( ! remote_share ) {
remote_share = sharename ;
}
if ( ! host | | ! user | | ! pass | | ! domain ) {
DEBUG ( 1 , ( " CIFS backend: You must supply server, user, password and domain \n " ) ) ;
return NT_STATUS_INVALID_PARAMETER ;
}
2004-09-08 05:39:06 +00:00
private = talloc ( req - > tcon , sizeof ( struct cvfs_private ) ) ;
2003-08-13 01:53:07 +00:00
if ( ! private ) {
return NT_STATUS_NO_MEMORY ;
}
ZERO_STRUCTP ( private ) ;
2004-09-29 13:17:09 +00:00
ntvfs - > private_data = private ;
2003-08-13 01:53:07 +00:00
2004-09-28 05:44:59 +00:00
status = smbcli_tree_full_connection ( private ,
& private - > tree ,
" vfs_cifs " ,
host ,
0 ,
remote_share , " ????? " ,
user , domain ,
pass ) ;
2003-08-13 01:53:07 +00:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
private - > transport = private - > tree - > session - > transport ;
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-06-28 08:27:36 +00:00
private - > tcon = req - > tcon ;
2003-08-13 01:53:07 +00:00
2004-09-08 05:39:06 +00:00
tcon - > fs_type = talloc_strdup ( tcon , " NTFS " ) ;
tcon - > dev_type = talloc_strdup ( tcon , " A: " ) ;
2003-08-13 01:53:07 +00:00
/* we need to receive oplock break requests from the server */
2004-08-04 13:23:35 +00:00
smbcli_oplock_handler ( private - > transport , oplock_handler , private ) ;
smbcli_transport_idle_handler ( private - > transport , idle_func , 1 , private ) ;
2004-07-23 06:40:49 +00:00
private - > transport - > event . fde - > handler = cifs_socket_handler ;
private - > transport - > event . fde - > private = private ;
2004-09-13 10:15:55 +00:00
private - > transport - > event . ctx = event_context_merge ( tcon - > smb_conn - > connection - > event . ctx ,
2004-10-17 11:37:22 +00:00
private - > transport - > event . ctx ) ;
talloc_reference ( private , private - > transport - > event . ctx ) ;
2004-10-20 11:08:58 +00:00
private - > map_generic = lp_parm_bool ( req - > tcon - > service ,
" cifs " , " mapgeneric " , False ) ;
2003-08-13 01:53:07 +00:00
return NT_STATUS_OK ;
}
/*
disconnect from a share
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_disconnect ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_tcon * tcon )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2003-08-13 01:53:07 +00:00
2004-10-21 06:34:17 +00:00
talloc_free ( private ) ;
2003-08-13 01:53:07 +00:00
return NT_STATUS_OK ;
}
/*
a handler for simple async replies
this handler can only be used for functions that don ' t return any
parameters ( those that just return a status code )
*/
2004-08-04 13:23:35 +00:00
static void async_simple ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-08-04 13:23:35 +00:00
req - > async . status = smbcli_request_simple_recv ( c_req ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/* save some typing for the simple functions */
# define ASYNC_RECV_TAIL(io, async_fn) do { \
if ( ! c_req ) return NT_STATUS_UNSUCCESSFUL ; \
{ \
2004-01-08 06:48:54 +00:00
struct async_info * async ; \
2004-09-08 05:39:06 +00:00
async = talloc_p ( req , struct async_info ) ; \
2003-08-13 01:53:07 +00:00
if ( ! async ) return NT_STATUS_NO_MEMORY ; \
async - > parms = io ; \
async - > req = req ; \
c_req - > async . private = async ; \
} \
c_req - > async . fn = async_fn ; \
req - > control_flags | = REQ_CONTROL_ASYNC ; \
return NT_STATUS_OK ; \
} while ( 0 )
# define SIMPLE_ASYNC_TAIL ASYNC_RECV_TAIL(NULL, async_simple)
/*
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 )
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_unlink ( struct ntvfs_module_context * ntvfs ,
2004-10-20 12:08:40 +00:00
struct smbsrv_request * req , struct smb_unlink * unl )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2003-08-13 01:53:07 +00:00
/* see if the front end will allow us to perform this
function asynchronously . */
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_unlink ( private - > tree , unl ) ;
}
c_req = smb_raw_unlink_send ( private - > tree , unl ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
a handler for async ioctl replies
*/
2004-08-04 13:23:35 +00:00
static void async_ioctl ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_ioctl_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/*
ioctl interface
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_ioctl ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_ioctl * io )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2003-08-13 01:53:07 +00:00
/* see if the front end will allow us to perform this
function asynchronously . */
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_ioctl ( private - > tree , req , io ) ;
2003-08-13 01:53:07 +00:00
}
c_req = smb_raw_ioctl_send ( private - > tree , io ) ;
ASYNC_RECV_TAIL ( io , async_ioctl ) ;
}
/*
check if a directory exists
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_chkpath ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_chkpath * cp )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_chkpath ( private - > tree , cp ) ;
}
c_req = smb_raw_chkpath_send ( private - > tree , cp ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
a handler for async qpathinfo replies
*/
2004-08-04 13:23:35 +00:00
static void async_qpathinfo ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_pathinfo_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/*
return info on a pathname
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_qpathinfo ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fileinfo * info )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_pathinfo ( private - > tree , req , info ) ;
2003-08-13 01:53:07 +00:00
}
c_req = smb_raw_pathinfo_send ( private - > tree , info ) ;
ASYNC_RECV_TAIL ( info , async_qpathinfo ) ;
}
/*
a handler for async qfileinfo replies
*/
2004-08-04 13:23:35 +00:00
static void async_qfileinfo ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_fileinfo_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/*
query info on a open file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_qfileinfo ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fileinfo * info )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_fileinfo ( private - > tree , req , info ) ;
2003-08-13 01:53:07 +00:00
}
c_req = smb_raw_fileinfo_send ( private - > tree , info ) ;
ASYNC_RECV_TAIL ( info , async_qfileinfo ) ;
}
/*
set info on a pathname
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_setpathinfo ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_setfileinfo * st )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_setpathinfo ( private - > tree , st ) ;
}
c_req = smb_raw_setpathinfo_send ( private - > tree , st ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
a handler for async open replies
*/
2004-08-04 13:23:35 +00:00
static void async_open ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_open_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/*
open a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_open ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_open * io )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( io - > generic . level ! = RAW_OPEN_GENERIC & &
private - > map_generic ) {
return ntvfs_map_open ( req , io , ntvfs ) ;
}
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_open ( private - > tree , req , io ) ;
2003-08-13 01:53:07 +00:00
}
c_req = smb_raw_open_send ( private - > tree , io ) ;
ASYNC_RECV_TAIL ( io , async_open ) ;
}
/*
create a directory
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_mkdir ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_mkdir * md )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_mkdir ( private - > tree , md ) ;
}
c_req = smb_raw_mkdir_send ( private - > tree , md ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
remove a directory
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_rmdir ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_rmdir * rd )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_rmdir ( private - > tree , rd ) ;
}
c_req = smb_raw_rmdir_send ( private - > tree , rd ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
rename a set of files
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_rename ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_rename * ren )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_rename ( private - > tree , ren ) ;
}
c_req = smb_raw_rename_send ( private - > tree , ren ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
copy a set of files
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_copy ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_copy * cp )
2003-08-13 01:53:07 +00:00
{
return NT_STATUS_NOT_SUPPORTED ;
}
/*
a handler for async read replies
*/
2004-08-04 13:23:35 +00:00
static void async_read ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2003-08-13 01:53:07 +00:00
req - > async . status = smb_raw_read_recv ( c_req , async - > parms ) ;
req - > async . send_fn ( req ) ;
}
/*
read from a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_read ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_read * rd )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( rd - > generic . level ! = RAW_READ_GENERIC & &
private - > map_generic ) {
return ntvfs_map_read ( req , rd , ntvfs ) ;
}
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_read ( private - > tree , rd ) ;
}
c_req = smb_raw_read_send ( private - > tree , rd ) ;
ASYNC_RECV_TAIL ( rd , async_read ) ;
}
/*
a handler for async write replies
*/
2004-08-04 13:23:35 +00:00
static void async_write ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2003-08-13 01:53:07 +00:00
req - > async . status = smb_raw_write_recv ( c_req , async - > parms ) ;
req - > async . send_fn ( req ) ;
}
/*
write to a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_write ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_write * wr )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( wr - > generic . level ! = RAW_WRITE_GENERIC & &
private - > map_generic ) {
return ntvfs_map_write ( req , wr , ntvfs ) ;
}
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_write ( private - > tree , wr ) ;
}
c_req = smb_raw_write_send ( private - > tree , wr ) ;
ASYNC_RECV_TAIL ( wr , async_write ) ;
}
/*
seek in a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_seek ( struct ntvfs_module_context * ntvfs ,
2004-10-20 11:08:58 +00:00
struct smbsrv_request * req , struct smb_seek * io )
2003-08-13 01:53:07 +00:00
{
2004-10-20 11:08:58 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
struct smbcli_request * c_req ;
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
return smb_raw_seek ( private - > tree , io ) ;
}
c_req = smb_raw_seek_send ( private - > tree , io ) ;
SIMPLE_ASYNC_TAIL ;
2003-08-13 01:53:07 +00:00
}
/*
flush a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_flush ( struct ntvfs_module_context * ntvfs ,
2004-10-20 11:08:58 +00:00
struct smbsrv_request * req , struct smb_flush * io )
2003-08-13 01:53:07 +00:00
{
2004-10-20 11:08:58 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
struct smbcli_request * c_req ;
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
return smb_raw_flush ( private - > tree , io ) ;
}
c_req = smb_raw_flush_send ( private - > tree , io ) ;
SIMPLE_ASYNC_TAIL ;
2003-08-13 01:53:07 +00:00
}
/*
close a file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_close ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_close * io )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( io - > generic . level ! = RAW_CLOSE_GENERIC & &
private - > map_generic ) {
return ntvfs_map_close ( req , io , ntvfs ) ;
}
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_close ( private - > tree , io ) ;
}
c_req = smb_raw_close_send ( private - > tree , io ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
2004-09-26 11:30:20 +00:00
exit - closing files open by the pid
2003-08-13 01:53:07 +00:00
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_exit ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-09-26 11:30:20 +00:00
struct smbcli_request * c_req ;
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-26 11:30:20 +00:00
return smb_raw_exit ( private - > tree - > session ) ;
}
c_req = smb_raw_exit_send ( private - > tree - > session ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
logoff - closing files open by the user
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_logoff ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req )
2004-09-26 11:30:20 +00:00
{
/* we can't do this right in the cifs backend .... */
return NT_STATUS_OK ;
2003-08-13 01:53:07 +00:00
}
2004-10-18 13:27:22 +00:00
/*
setup for an async call - nothing to do yet
*/
static NTSTATUS cvfs_async_setup ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req ,
void * private )
{
return NT_STATUS_OK ;
}
2003-08-13 01:53:07 +00:00
/*
lock a byte range
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_lock ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_lock * lck )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-10-20 11:08:58 +00:00
if ( lck - > generic . level ! = RAW_LOCK_GENERIC & &
private - > map_generic ) {
return ntvfs_map_lock ( req , lck , ntvfs ) ;
}
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_lock ( private - > tree , lck ) ;
}
c_req = smb_raw_lock_send ( private - > tree , lck ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
set info on a open file
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_setfileinfo ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req ,
2003-08-13 01:53:07 +00:00
union smb_setfileinfo * info )
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2003-08-13 01:53:07 +00:00
return smb_raw_setfileinfo ( private - > tree , info ) ;
}
c_req = smb_raw_setfileinfo_send ( private - > tree , info ) ;
SIMPLE_ASYNC_TAIL ;
}
/*
a handler for async fsinfo replies
*/
2004-08-04 13:23:35 +00:00
static void async_fsinfo ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_fsinfo_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/*
return filesystem space info
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_fsinfo ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_fsinfo * fs )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_fsinfo ( private - > tree , req , fs ) ;
2003-08-13 01:53:07 +00:00
}
2004-09-08 05:39:06 +00:00
c_req = smb_raw_fsinfo_send ( private - > tree , req , fs ) ;
2003-08-13 01:53:07 +00:00
ASYNC_RECV_TAIL ( fs , async_fsinfo ) ;
}
/*
return print queue info
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_lpq ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_lpq * lpq )
2003-08-13 01:53:07 +00:00
{
return NT_STATUS_NOT_SUPPORTED ;
}
/*
list files in a directory matching a wildcard pattern
*/
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_search_first ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_first * io ,
2003-08-13 01:53:07 +00:00
void * search_private ,
BOOL ( * callback ) ( void * , union smb_search_data * ) )
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-09-08 05:39:06 +00:00
return smb_raw_search_first ( private - > tree , req , io , search_private , callback ) ;
2003-08-13 01:53:07 +00:00
}
/* continue a search */
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_search_next ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_next * io ,
2003-08-13 01:53:07 +00:00
void * search_private ,
BOOL ( * callback ) ( void * , union smb_search_data * ) )
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2004-09-08 05:39:06 +00:00
return smb_raw_search_next ( private - > tree , req , io , search_private , callback ) ;
2003-08-13 01:53:07 +00:00
}
/* close a search */
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_search_close ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , union smb_search_close * io )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
2003-08-13 01:53:07 +00:00
return smb_raw_search_close ( private - > tree , io ) ;
}
/*
a handler for async trans2 replies
*/
2004-08-04 13:23:35 +00:00
static void async_trans2 ( struct smbcli_request * c_req )
2003-08-13 01:53:07 +00:00
{
struct async_info * async = c_req - > async . private ;
2004-06-28 08:39:00 +00:00
struct smbsrv_request * req = async - > req ;
2004-09-08 05:39:06 +00:00
req - > async . status = smb_raw_trans2_recv ( c_req , req , async - > parms ) ;
2003-08-13 01:53:07 +00:00
req - > async . send_fn ( req ) ;
}
/* raw trans2 */
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_trans2 ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_trans2 * trans2 )
2003-08-13 01:53:07 +00:00
{
2004-09-29 13:17:09 +00:00
struct cvfs_private * private = ntvfs - > private_data ;
2004-08-04 13:23:35 +00:00
struct smbcli_request * c_req ;
2003-08-13 01:53:07 +00:00
2004-10-20 12:08:40 +00:00
SETUP_PID ;
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.
highlights include:
- changed the way a backend determines if it is allowed to process a
request asynchronously. The previous method of looking at the
send_fn caused problems when an intermediate ntvfs module disabled
it, and the caller then wanted to finished processing using this
function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
req->control_flags, which is also a bit easier to read
- fixed 2 bugs in the readbraw server code. One related to trying to
answer a readbraw with smb signing (which can't work, and crashed
our signing code), the second related to error handling, which
attempted to send a normal SMB error packet, when readbraw must
send a 0 read reply (as it has no header)
- added several more ntvfs_generic.c generic mapping functions. This
means that backends no longer need to implement such esoteric
functions as SMBwriteunlock() if they don't want to. The backend
can just request the mapping layer turn it into a write followed by
an unlock. This makes the backends considerably simpler as they
only need to implement one style of each function for lock, read,
write, open etc, rather than the full host of functions that SMB
provides. A backend can still choose to implement them
individually, of course, and the CIFS backend does that.
- simplified the generic structures to make them identical to the
principal call for several common SMB calls (such as
RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).
- started rewriting the pvfs_open() code in preparation for the full
ntcreatex semantics.
- in pvfs_open and ipc_open, initially allocate the open file
structure as a child of the request, so on error we don't need to
clean up. Then when we are going to succeed the open steal the
pointer into the long term backend context. This makes for much
simpler error handling (and fixes some bugs)
- use a destructor in the ipc backend to make sure that everthing is
cleaned up on receive error conditions.
- switched the ipc backend to using idtree for fnum allocation
- in the ntvfs_generic mapping routines, use a allocated secondary
structure not a stack structure to ensure the request pointer
remains valid even if the backend replies async.
(This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2004-10-20 08:28:31 +00:00
if ( ! ( req - > control_flags & REQ_CONTROL_MAY_ASYNC ) ) {
2004-09-08 05:39:06 +00:00
return smb_raw_trans2 ( private - > tree , req , trans2 ) ;
2003-08-13 01:53:07 +00:00
}
c_req = smb_raw_trans2_send ( private - > tree , trans2 ) ;
ASYNC_RECV_TAIL ( trans2 , async_trans2 ) ;
}
2003-12-11 09:07:45 +00:00
/* SMBtrans - not used on file shares */
2004-09-29 13:17:09 +00:00
static NTSTATUS cvfs_trans ( struct ntvfs_module_context * ntvfs ,
struct smbsrv_request * req , struct smb_trans2 * trans2 )
2003-12-11 09:07:45 +00:00
{
return NT_STATUS_ACCESS_DENIED ;
}
2003-08-13 01:53:07 +00:00
/*
initialise the CIFS - > CIFS backend , registering ourselves with the ntvfs subsystem
*/
2003-11-25 03:15:26 +00:00
NTSTATUS ntvfs_cifs_init ( void )
2003-08-13 01:53:07 +00:00
{
2003-11-25 03:15:26 +00:00
NTSTATUS ret ;
2003-08-13 01:53:07 +00:00
struct ntvfs_ops ops ;
ZERO_STRUCT ( ops ) ;
2003-11-25 03:15:26 +00:00
2004-02-02 13:28:29 +00:00
/* fill in the name and type */
2003-11-25 03:15:26 +00:00
ops . name = " cifs " ;
ops . type = NTVFS_DISK ;
2003-08-13 01:53:07 +00:00
/* fill in all the operations */
ops . connect = cvfs_connect ;
ops . disconnect = cvfs_disconnect ;
ops . unlink = cvfs_unlink ;
ops . chkpath = cvfs_chkpath ;
ops . qpathinfo = cvfs_qpathinfo ;
ops . setpathinfo = cvfs_setpathinfo ;
ops . open = cvfs_open ;
ops . mkdir = cvfs_mkdir ;
ops . rmdir = cvfs_rmdir ;
ops . rename = cvfs_rename ;
ops . copy = cvfs_copy ;
ops . ioctl = cvfs_ioctl ;
ops . read = cvfs_read ;
ops . write = cvfs_write ;
ops . seek = cvfs_seek ;
ops . flush = cvfs_flush ;
ops . close = cvfs_close ;
ops . exit = cvfs_exit ;
ops . lock = cvfs_lock ;
ops . setfileinfo = cvfs_setfileinfo ;
ops . qfileinfo = cvfs_qfileinfo ;
ops . fsinfo = cvfs_fsinfo ;
ops . lpq = cvfs_lpq ;
ops . search_first = cvfs_search_first ;
ops . search_next = cvfs_search_next ;
ops . search_close = cvfs_search_close ;
2003-12-11 09:07:45 +00:00
ops . trans = cvfs_trans ;
2004-09-26 11:30:20 +00:00
ops . logoff = cvfs_logoff ;
2004-10-18 13:27:22 +00:00
ops . async_setup = cvfs_async_setup ;
2003-08-13 01:53:07 +00:00
2004-09-23 07:44:42 +00:00
if ( lp_parm_bool ( - 1 , " cifs " , " maptrans2 " , False ) ) {
2004-09-29 13:17:09 +00:00
ops . trans2 = cvfs_trans2 ;
2004-09-23 07:44:42 +00:00
}
2003-08-13 01:53:07 +00:00
2004-04-10 20:18:22 +00:00
/* register ourselves with the NTVFS subsystem. We register
under the name ' cifs ' . */
2003-11-25 03:15:26 +00:00
ret = register_backend ( " ntvfs " , & ops ) ;
2003-08-13 01:53:07 +00:00
2003-11-25 03:15:26 +00:00
if ( ! NT_STATUS_IS_OK ( ret ) ) {
2003-08-13 01:53:07 +00:00
DEBUG ( 0 , ( " Failed to register CIFS backend! \n " ) ) ;
}
2003-11-25 03:15:26 +00:00
return ret ;
2003-08-13 01:53:07 +00:00
}