2003-08-13 05:53:07 +04:00
/*
Unix SMB / CIFS implementation .
NTVFS generic level mapping code
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 12:28:31 +04:00
Copyright ( C ) Andrew Tridgell 2003 - 2004
2003-08-13 05:53:07 +04:00
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2003-08-13 05:53:07 +04:00
( 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
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-08-13 05:53:07 +04:00
*/
/*
this implements mappings between info levels for NTVFS backend calls
the idea is that each of these functions implements one of the NTVFS
backend calls in terms of the ' generic ' call . All backends that use
these functions must supply the generic call , but can if it wants to
also implement other levels if the need arises
2004-06-27 15:06:10 +04:00
this allows backend writers to only implement one variant of each
2003-08-13 05:53:07 +04:00
call unless they need fine grained control of the calls .
*/
# include "includes.h"
2005-12-28 01:51:30 +03:00
# include "ntvfs/ntvfs.h"
2007-05-14 17:47:03 +04:00
# include "libcli/smb2/smb2.h"
# include "libcli/smb2/smb2_calls.h"
2004-11-02 10:18:24 +03:00
2004-11-04 10:36:53 +03:00
/* a second stage function converts from the out parameters of the generic
call onto the out parameters of the specific call made */
2006-03-10 17:31:17 +03:00
typedef NTSTATUS ( * second_stage_t ) ( struct ntvfs_module_context * ,
struct ntvfs_request * ,
2004-11-04 10:36:53 +03:00
void * , void * , NTSTATUS ) ;
/*
this structure holds the async state for pending mapped async calls
*/
struct ntvfs_map_async {
struct ntvfs_module_context * ntvfs ;
void * io , * io2 ;
second_stage_t fn ;
} ;
/*
this is a async wrapper , called from the backend when it has completed
a function that it has decided to reply to in an async fashion
*/
2006-03-10 17:31:17 +03:00
static void ntvfs_map_async_send ( struct ntvfs_request * req )
2004-11-04 10:36:53 +03:00
{
2009-02-13 13:35:17 +03:00
struct ntvfs_map_async * m = talloc_get_type ( req - > async_states - > private_data ,
struct ntvfs_map_async ) ;
2004-11-04 10:36:53 +03:00
ntvfs_async_state_pop ( req ) ;
/* call the _finish function setup in ntvfs_map_async_setup() */
2006-03-10 17:31:17 +03:00
req - > async_states - > status = m - > fn ( m - > ntvfs , req , m - > io , m - > io2 , req - > async_states - > status ) ;
2004-11-04 10:36:53 +03:00
/* call the send function from the next module up */
req - > async_states - > send_fn ( req ) ;
}
/*
prepare for calling a ntvfs backend with async support
io is the original call structure
io2 is the new call structure for the mapped call
fn is a second stage function for processing the out arguments
*/
2006-03-10 17:31:17 +03:00
static NTSTATUS ntvfs_map_async_setup ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
2004-11-04 10:36:53 +03:00
void * io , void * io2 ,
second_stage_t fn )
{
struct ntvfs_map_async * m ;
2005-01-27 10:08:20 +03:00
m = talloc ( req , struct ntvfs_map_async ) ;
2004-11-04 10:36:53 +03:00
if ( m = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
m - > ntvfs = ntvfs ;
m - > io = io ;
m - > io2 = io2 ;
m - > fn = fn ;
2006-03-10 17:31:17 +03:00
return ntvfs_async_state_push ( ntvfs , req , m , ntvfs_map_async_send ) ;
2004-11-04 10:36:53 +03:00
}
/*
called when first stage processing is complete .
*/
2006-03-10 17:31:17 +03:00
static NTSTATUS ntvfs_map_async_finish ( struct ntvfs_request * req , NTSTATUS status )
2004-11-04 10:36:53 +03:00
{
struct ntvfs_map_async * m ;
/* if the backend has decided to reply in an async fashion then
we don ' t need to do any work here */
if ( req - > async_states - > state & NTVFS_ASYNC_STATE_ASYNC ) {
return status ;
}
/* the backend is replying immediately. call the 2nd stage function after popping our local
async state */
2009-02-13 13:35:17 +03:00
m = talloc_get_type ( req - > async_states - > private_data ,
struct ntvfs_map_async ) ;
2004-11-04 10:36:53 +03:00
ntvfs_async_state_pop ( req ) ;
2006-03-10 17:31:17 +03:00
return m - > fn ( m - > ntvfs , req , m - > io , m - > io2 , status ) ;
2004-11-04 10:36:53 +03:00
}
2003-08-13 05:53:07 +04:00
/*
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 12:28:31 +04:00
see if a filename ends in EXE COM DLL or SYM . This is needed for the
DENY_DOS mapping for OpenX
2003-08-13 05:53:07 +04:00
*/
2007-10-07 02:28:14 +04:00
bool is_exe_filename ( const char * fname )
2003-08-13 05:53:07 +04:00
{
char * p ;
p = strrchr ( fname , ' . ' ) ;
if ( ! p ) {
2007-10-07 02:28:14 +04:00
return false ;
2003-08-13 05:53:07 +04:00
}
p + + ;
if ( strcasecmp ( p , " EXE " ) = = 0 | |
strcasecmp ( p , " COM " ) = = 0 | |
strcasecmp ( p , " DLL " ) = = 0 | |
strcasecmp ( p , " SYM " ) = = 0 ) {
2007-10-07 02:28:14 +04:00
return true ;
2003-08-13 05:53:07 +04:00
}
2007-10-07 02:28:14 +04:00
return false ;
2003-08-13 05:53:07 +04:00
}
2004-11-01 13:02:24 +03:00
/*
NTVFS openx to ntcreatex mapper
*/
2006-03-10 17:31:17 +03:00
static NTSTATUS ntvfs_map_open_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
2004-11-04 10:36:53 +03:00
union smb_open * io ,
union smb_open * io2 ,
NTSTATUS status )
2004-11-01 13:02:24 +03:00
{
2004-11-04 16:15:22 +03:00
time_t write_time = 0 ;
uint32_t set_size = 0 ;
union smb_setfileinfo * sf ;
2010-01-05 20:42:54 +03:00
unsigned int state ;
2004-11-04 16:15:22 +03:00
2004-11-01 13:02:24 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
2004-11-04 10:36:53 +03:00
switch ( io - > generic . level ) {
case RAW_OPEN_OPEN :
2006-05-20 12:15:22 +04:00
io - > openold . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2004-11-04 10:36:53 +03:00
io - > openold . out . attrib = io2 - > generic . out . attrib ;
io - > openold . out . write_time = nt_time_to_unix ( io2 - > generic . out . write_time ) ;
io - > openold . out . size = io2 - > generic . out . size ;
2004-12-13 13:48:21 +03:00
io - > openold . out . rmode = io - > openold . in . open_mode ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_OPEN_OPENX :
2006-05-20 12:15:22 +04:00
io - > openx . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2004-11-04 10:36:53 +03:00
io - > openx . out . attrib = io2 - > generic . out . attrib ;
io - > openx . out . write_time = nt_time_to_unix ( io2 - > generic . out . write_time ) ;
io - > openx . out . size = io2 - > generic . out . size ;
2004-12-13 13:48:21 +03:00
io - > openx . out . access = ( io - > openx . in . open_mode & OPENX_MODE_ACCESS_MASK ) ;
2004-11-04 10:36:53 +03:00
io - > openx . out . ftype = 0 ;
io - > openx . out . devstate = 0 ;
io - > openx . out . action = io2 - > generic . out . create_action ;
io - > openx . out . unique_fid = 0 ;
2004-11-30 07:33:27 +03:00
io - > openx . out . access_mask = SEC_STD_ALL ;
2004-11-04 10:36:53 +03:00
io - > openx . out . unknown = 0 ;
/* we need to extend the file to the requested size if
it was newly created */
2004-11-04 16:15:22 +03:00
if ( io2 - > generic . out . create_action = = NTCREATEX_ACTION_CREATED ) {
set_size = io - > openx . in . size ;
2004-11-01 13:02:24 +03:00
}
2004-11-04 10:36:53 +03:00
break ;
2004-11-06 10:58:45 +03:00
case RAW_OPEN_T2OPEN :
2006-05-20 12:15:22 +04:00
io - > t2open . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2004-12-13 13:48:21 +03:00
io - > t2open . out . attrib = io2 - > generic . out . attrib ;
io - > t2open . out . write_time = nt_time_to_unix ( io2 - > generic . out . write_time ) ;
io - > t2open . out . size = io2 - > generic . out . size ;
io - > t2open . out . access = io - > t2open . in . open_mode ;
io - > t2open . out . ftype = 0 ;
io - > t2open . out . devstate = 0 ;
io - > t2open . out . action = io2 - > generic . out . create_action ;
io - > t2open . out . file_id = 0 ;
2004-11-06 10:58:45 +03:00
break ;
2004-11-04 16:15:22 +03:00
case RAW_OPEN_MKNEW :
case RAW_OPEN_CREATE :
2006-05-20 12:15:22 +04:00
io - > mknew . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2006-03-13 01:48:25 +03:00
write_time = io - > mknew . in . write_time ;
2004-11-04 16:15:22 +03:00
break ;
case RAW_OPEN_CTEMP :
2006-05-20 12:15:22 +04:00
io - > ctemp . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2006-03-13 01:48:25 +03:00
io - > ctemp . out . name = talloc_strdup ( req , io2 - > generic . in . fname +
strlen ( io - > ctemp . in . directory ) + 1 ) ;
2006-03-10 17:31:17 +03:00
NT_STATUS_HAVE_NO_MEMORY ( io - > ctemp . out . name ) ;
2004-11-04 16:15:22 +03:00
break ;
2006-05-20 20:53:44 +04:00
case RAW_OPEN_SMB2 :
2008-05-28 10:28:37 +04:00
ZERO_STRUCT ( io - > smb2 . out ) ;
2006-05-20 20:53:44 +04:00
io - > smb2 . out . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2008-04-17 05:54:26 +04:00
switch ( io2 - > generic . out . oplock_level ) {
2008-04-19 02:14:52 +04:00
case BATCH_OPLOCK_RETURN :
2008-04-17 05:54:26 +04:00
io - > smb2 . out . oplock_level = SMB2_OPLOCK_LEVEL_BATCH ;
break ;
2008-04-19 02:14:52 +04:00
case EXCLUSIVE_OPLOCK_RETURN :
2008-04-17 05:54:26 +04:00
io - > smb2 . out . oplock_level = SMB2_OPLOCK_LEVEL_EXCLUSIVE ;
break ;
2008-04-19 02:14:52 +04:00
case LEVEL_II_OPLOCK_RETURN :
2008-04-17 05:54:26 +04:00
io - > smb2 . out . oplock_level = SMB2_OPLOCK_LEVEL_II ;
break ;
default :
io - > smb2 . out . oplock_level = SMB2_OPLOCK_LEVEL_NONE ;
break ;
}
io - > smb2 . out . reserved = 0 ;
2006-05-20 20:53:44 +04:00
io - > smb2 . out . create_action = io2 - > generic . out . create_action ;
io - > smb2 . out . create_time = io2 - > generic . out . create_time ;
io - > smb2 . out . access_time = io2 - > generic . out . access_time ;
io - > smb2 . out . write_time = io2 - > generic . out . write_time ;
io - > smb2 . out . change_time = io2 - > generic . out . change_time ;
io - > smb2 . out . alloc_size = io2 - > generic . out . alloc_size ;
io - > smb2 . out . size = io2 - > generic . out . size ;
2006-07-01 18:04:28 +04:00
io - > smb2 . out . file_attr = io2 - > generic . out . attrib ;
2008-02-13 09:36:41 +03:00
io - > smb2 . out . reserved2 = 0 ;
2008-05-29 13:16:26 +04:00
io - > smb2 . out . maximal_access = io2 - > generic . out . maximal_access ;
2016-07-11 13:12:52 +03:00
memcpy ( io - > smb2 . out . on_disk_id , io2 - > generic . out . on_disk_id ,
sizeof ( io2 - > generic . out . on_disk_id ) ) ;
2006-05-20 20:53:44 +04:00
break ;
2004-11-04 10:36:53 +03:00
default :
return NT_STATUS_INVALID_LEVEL ;
2004-11-01 13:02:24 +03:00
}
2004-11-04 10:36:53 +03:00
2004-11-04 16:15:22 +03:00
/* doing a secondary request async is more trouble than its
worth */
state = req - > async_states - > state ;
req - > async_states - > state & = ~ NTVFS_ASYNC_STATE_MAY_ASYNC ;
if ( write_time ! = 0 ) {
2006-03-10 17:31:17 +03:00
sf = talloc ( req , union smb_setfileinfo ) ;
NT_STATUS_HAVE_NO_MEMORY ( sf ) ;
sf - > generic . level = RAW_SFILEINFO_STANDARD ;
2006-05-20 12:15:22 +04:00
sf - > generic . in . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2004-11-04 16:15:22 +03:00
sf - > standard . in . create_time = 0 ;
sf - > standard . in . write_time = write_time ;
sf - > standard . in . access_time = 0 ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > setfileinfo_fn ( ntvfs , req , sf ) ;
2004-11-04 16:15:22 +03:00
}
if ( set_size ! = 0 ) {
2005-01-27 10:08:20 +03:00
sf = talloc ( req , union smb_setfileinfo ) ;
2006-03-10 17:31:17 +03:00
NT_STATUS_HAVE_NO_MEMORY ( sf ) ;
2004-11-04 16:15:22 +03:00
sf - > generic . level = RAW_SFILEINFO_END_OF_FILE_INFORMATION ;
2006-05-20 12:15:22 +04:00
sf - > generic . in . file . ntvfs = io2 - > generic . out . file . ntvfs ;
2004-11-06 10:58:45 +03:00
sf - > end_of_file_info . in . size = set_size ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > setfileinfo_fn ( ntvfs , req , sf ) ;
2004-11-04 16:15:22 +03:00
if ( NT_STATUS_IS_OK ( status ) ) {
io - > openx . out . size = io - > openx . in . size ;
}
}
req - > async_states - > state = state ;
2004-11-01 13:02:24 +03:00
return NT_STATUS_OK ;
}
2004-12-13 13:48:21 +03:00
/*
the core of the mapping between openx style parameters and ntcreatex
parameters
*/
static NTSTATUS map_openx_open ( uint16_t flags , uint16_t open_mode ,
uint16_t open_func , const char * fname ,
union smb_open * io2 )
{
2008-12-18 03:00:47 +03:00
io2 - > generic . in . create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE ;
2010-03-05 06:57:50 +03:00
io2 - > generic . in . private_flags = 0 ;
2008-12-18 03:00:47 +03:00
2004-12-13 13:48:21 +03:00
if ( flags & OPENX_FLAGS_REQUEST_OPLOCK ) {
io2 - > generic . in . flags | = NTCREATEX_FLAGS_REQUEST_OPLOCK ;
}
if ( flags & OPENX_FLAGS_REQUEST_BATCH_OPLOCK ) {
io2 - > generic . in . flags | = NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK ;
}
switch ( open_mode & OPENX_MODE_ACCESS_MASK ) {
case OPENX_MODE_ACCESS_READ :
2005-09-10 06:21:44 +04:00
case OPENX_MODE_ACCESS_EXEC :
2004-12-13 13:48:21 +03:00
io2 - > generic . in . access_mask = SEC_RIGHTS_FILE_READ ;
break ;
case OPENX_MODE_ACCESS_WRITE :
io2 - > generic . in . access_mask = SEC_RIGHTS_FILE_WRITE ;
break ;
case OPENX_MODE_ACCESS_RDWR :
case OPENX_MODE_ACCESS_FCB :
io2 - > generic . in . access_mask =
SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE ;
break ;
default :
2005-07-04 05:57:53 +04:00
return NT_STATUS_DOS ( ERRDOS , ERRbadaccess ) ;
2004-12-13 13:48:21 +03:00
}
switch ( open_mode & OPENX_MODE_DENY_MASK ) {
case OPENX_MODE_DENY_READ :
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_WRITE ;
break ;
case OPENX_MODE_DENY_WRITE :
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_READ ;
break ;
case OPENX_MODE_DENY_ALL :
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_NONE ;
break ;
case OPENX_MODE_DENY_NONE :
io2 - > generic . in . share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE ;
break ;
case OPENX_MODE_DENY_DOS :
/* DENY_DOS is quite strange - it depends on the filename! */
2010-03-05 06:57:50 +03:00
io2 - > generic . in . private_flags | =
2004-12-13 13:48:21 +03:00
NTCREATEX_OPTIONS_PRIVATE_DENY_DOS ;
if ( is_exe_filename ( fname ) ) {
io2 - > generic . in . share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE ;
} else {
if ( ( open_mode & OPENX_MODE_ACCESS_MASK ) = = OPENX_MODE_ACCESS_READ ) {
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_READ ;
} else {
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_NONE ;
}
}
break ;
case OPENX_MODE_DENY_FCB :
2010-03-05 06:57:50 +03:00
io2 - > generic . in . private_flags | = NTCREATEX_OPTIONS_PRIVATE_DENY_FCB ;
2004-12-13 13:48:21 +03:00
io2 - > generic . in . share_access = NTCREATEX_SHARE_ACCESS_NONE ;
break ;
default :
2005-07-04 05:57:53 +04:00
return NT_STATUS_DOS ( ERRDOS , ERRbadaccess ) ;
2004-12-13 13:48:21 +03:00
}
switch ( open_func ) {
case ( OPENX_OPEN_FUNC_OPEN ) :
io2 - > generic . in . open_disposition = NTCREATEX_DISP_OPEN ;
break ;
case ( OPENX_OPEN_FUNC_TRUNC ) :
io2 - > generic . in . open_disposition = NTCREATEX_DISP_OVERWRITE ;
break ;
case ( OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE ) :
io2 - > generic . in . open_disposition = NTCREATEX_DISP_CREATE ;
break ;
case ( OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE ) :
io2 - > generic . in . open_disposition = NTCREATEX_DISP_OPEN_IF ;
break ;
case ( OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE ) :
io2 - > generic . in . open_disposition = NTCREATEX_DISP_OVERWRITE_IF ;
break ;
default :
/* this one is very strange */
if ( ( open_mode & OPENX_MODE_ACCESS_MASK ) = = OPENX_MODE_ACCESS_EXEC ) {
io2 - > generic . in . open_disposition = NTCREATEX_DISP_CREATE ;
break ;
}
2005-07-04 05:57:53 +04:00
return NT_STATUS_DOS ( ERRDOS , ERRbadaccess ) ;
2004-12-13 13:48:21 +03:00
}
return NT_STATUS_OK ;
}
2003-08-13 05:53:07 +04:00
/*
NTVFS open generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_open ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_open * io )
2003-08-13 05:53:07 +04:00
{
NTSTATUS status ;
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 12:28:31 +04:00
union smb_open * io2 ;
2003-08-13 05:53:07 +04:00
2005-01-27 10:08:20 +03:00
io2 = talloc_zero ( req , union smb_open ) ;
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 12:28:31 +04:00
if ( io2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
2003-08-13 05:53:07 +04:00
}
2006-03-10 17:31:17 +03:00
status = ntvfs_map_async_setup ( ntvfs , req ,
io , io2 ,
2004-11-04 10:36:53 +03:00
( second_stage_t ) ntvfs_map_open_finish ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
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 12:28:31 +04:00
2004-11-04 10:36:53 +03:00
io2 - > generic . level = RAW_OPEN_GENERIC ;
2003-08-13 05:53:07 +04:00
switch ( io - > generic . level ) {
case RAW_OPEN_OPENX :
2004-12-13 13:48:21 +03:00
status = map_openx_open ( io - > openx . in . flags ,
io - > openx . in . open_mode ,
io - > openx . in . open_func ,
io - > openx . in . fname ,
io2 ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
2004-11-04 15:12:09 +03:00
goto done ;
2004-11-04 10:36:53 +03:00
}
io2 - > generic . in . file_attr = io - > openx . in . file_attrs ;
io2 - > generic . in . fname = io - > openx . in . fname ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-11-04 10:36:53 +03:00
break ;
2003-08-13 05:53:07 +04:00
case RAW_OPEN_OPEN :
2004-12-13 13:48:21 +03:00
status = map_openx_open ( 0 ,
io - > openold . in . open_mode ,
OPENX_OPEN_FUNC_OPEN ,
io - > openold . in . fname ,
io2 ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
goto done ;
}
2004-11-02 07:17:30 +03:00
io2 - > generic . in . file_attr = io - > openold . in . search_attrs ;
io2 - > generic . in . fname = io - > openold . in . fname ;
2004-12-13 13:48:21 +03:00
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-12-13 13:48:21 +03:00
break ;
case RAW_OPEN_T2OPEN :
io2 - > generic . level = RAW_OPEN_NTTRANS_CREATE ;
if ( io - > t2open . in . open_func = = 0 ) {
status = NT_STATUS_OBJECT_NAME_COLLISION ;
2004-11-04 15:12:09 +03:00
goto done ;
2003-08-13 05:53:07 +04:00
}
2004-12-13 13:48:21 +03:00
status = map_openx_open ( io - > t2open . in . flags ,
io - > t2open . in . open_mode ,
io - > t2open . in . open_func ,
io - > t2open . in . fname ,
io2 ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
2004-11-04 15:12:09 +03:00
goto done ;
2003-08-13 05:53:07 +04:00
}
2004-12-13 13:48:21 +03:00
io2 - > generic . in . file_attr = io - > t2open . in . file_attrs ;
io2 - > generic . in . fname = io - > t2open . in . fname ;
2005-01-27 10:08:20 +03:00
io2 - > generic . in . ea_list = talloc ( io2 , struct smb_ea_list ) ;
2004-12-13 13:48:21 +03:00
io2 - > generic . in . ea_list - > num_eas = io - > t2open . in . num_eas ;
io2 - > generic . in . ea_list - > eas = io - > t2open . in . eas ;
2004-11-04 10:36:53 +03:00
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-11-06 10:58:45 +03:00
break ;
2004-11-04 16:15:22 +03:00
case RAW_OPEN_MKNEW :
io2 - > generic . in . file_attr = io - > mknew . in . attrib ;
io2 - > generic . in . fname = io - > mknew . in . fname ;
io2 - > generic . in . open_disposition = NTCREATEX_DISP_CREATE ;
io2 - > generic . in . access_mask =
2004-11-30 07:33:27 +03:00
SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE ;
2004-11-04 16:15:22 +03:00
io2 - > generic . in . share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-11-04 16:15:22 +03:00
break ;
case RAW_OPEN_CREATE :
io2 - > generic . in . file_attr = io - > mknew . in . attrib ;
io2 - > generic . in . fname = io - > mknew . in . fname ;
io2 - > generic . in . open_disposition = NTCREATEX_DISP_OPEN_IF ;
io2 - > generic . in . access_mask =
2004-11-30 07:33:27 +03:00
SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE ;
2004-11-04 16:15:22 +03:00
io2 - > generic . in . share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-11-04 16:15:22 +03:00
break ;
case RAW_OPEN_CTEMP :
io2 - > generic . in . file_attr = io - > ctemp . in . attrib ;
io2 - > generic . in . fname =
talloc_asprintf ( io2 , " %s \\ SRV%s " ,
io - > ctemp . in . directory ,
generate_random_str_list ( io2 , 5 , " 0123456789 " ) ) ;
io2 - > generic . in . open_disposition = NTCREATEX_DISP_CREATE ;
io2 - > generic . in . access_mask =
2004-11-30 07:33:27 +03:00
SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE ;
2004-11-04 16:15:22 +03:00
io2 - > generic . in . share_access =
NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2004-11-04 16:15:22 +03:00
break ;
2006-05-20 20:53:44 +04:00
case RAW_OPEN_SMB2 :
2008-04-17 05:54:26 +04:00
switch ( io - > smb2 . in . oplock_level ) {
case SMB2_OPLOCK_LEVEL_BATCH :
io2 - > generic . in . flags = NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK |
NTCREATEX_FLAGS_REQUEST_OPLOCK ;
break ;
case SMB2_OPLOCK_LEVEL_EXCLUSIVE :
io2 - > generic . in . flags = NTCREATEX_FLAGS_REQUEST_OPLOCK ;
break ;
default :
io2 - > generic . in . flags = 0 ;
break ;
}
2009-10-15 11:26:19 +04:00
io2 - > generic . in . root_fid . fnum = 0 ;
2008-02-13 09:36:41 +03:00
io2 - > generic . in . access_mask = io - > smb2 . in . desired_access ;
2008-05-28 10:28:37 +04:00
io2 - > generic . in . alloc_size = io - > smb2 . in . alloc_size ;
2008-02-13 09:36:41 +03:00
io2 - > generic . in . file_attr = io - > smb2 . in . file_attributes ;
2006-05-20 20:53:44 +04:00
io2 - > generic . in . share_access = io - > smb2 . in . share_access ;
2008-02-13 09:36:41 +03:00
io2 - > generic . in . open_disposition = io - > smb2 . in . create_disposition ;
2006-05-20 20:53:44 +04:00
io2 - > generic . in . create_options = io - > smb2 . in . create_options ;
2008-02-13 09:36:41 +03:00
io2 - > generic . in . impersonation = io - > smb2 . in . impersonation_level ;
2006-05-20 20:53:44 +04:00
io2 - > generic . in . security_flags = 0 ;
io2 - > generic . in . fname = io - > smb2 . in . fname ;
2008-05-28 10:28:37 +04:00
io2 - > generic . in . sec_desc = io - > smb2 . in . sec_desc ;
io2 - > generic . in . ea_list = & io - > smb2 . in . eas ;
2008-05-29 13:16:26 +04:00
io2 - > generic . in . query_maximal_access = io - > smb2 . in . query_maximal_access ;
2016-07-11 13:12:52 +03:00
io2 - > generic . in . query_on_disk_id = io - > smb2 . in . query_on_disk_id ;
2010-03-05 06:57:50 +03:00
io2 - > generic . in . private_flags = 0 ;
2008-05-28 10:28:37 +04:00
/* we don't support timewarp yet */
if ( io - > smb2 . in . timewarp ! = 0 ) {
status = NT_STATUS_OBJECT_NAME_NOT_FOUND ;
break ;
}
2008-05-26 09:02:43 +04:00
2008-05-27 06:42:43 +04:00
/* we need to check these bits before we check the private mask */
2008-08-14 11:52:45 +04:00
if ( io2 - > generic . in . create_options & SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK ) {
2008-09-23 06:09:56 +04:00
DEBUG ( 2 , ( __location__ " create_options 0x%x not supported \n " ,
io2 - > generic . in . create_options ) ) ;
2008-05-27 06:42:43 +04:00
status = NT_STATUS_NOT_SUPPORTED ;
break ;
}
2008-08-14 11:52:45 +04:00
/* TODO: find out why only SMB2 ignores these */
io2 - > generic . in . create_options & = ~ NTCREATEX_OPTIONS_SYNC_ALERT ;
io2 - > generic . in . create_options & = ~ NTCREATEX_OPTIONS_ASYNC_ALERT ;
2008-05-26 09:02:43 +04:00
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > open_fn ( ntvfs , req , io2 ) ;
2006-05-20 20:53:44 +04:00
break ;
2004-11-04 16:15:22 +03:00
2004-11-04 10:36:53 +03:00
default :
2004-11-04 15:12:09 +03:00
status = NT_STATUS_INVALID_LEVEL ;
break ;
2003-08-13 05:53:07 +04:00
}
2004-11-04 15:12:09 +03:00
done :
2004-11-04 10:36:53 +03:00
return ntvfs_map_async_finish ( req , status ) ;
2003-08-13 05:53:07 +04:00
}
/*
2009-06-26 15:31:19 +04:00
NTVFS any to fsinfo mapper
2003-08-13 05:53:07 +04:00
*/
2009-06-26 15:31:19 +04:00
static NTSTATUS ntvfs_map_fsinfo_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_fsinfo * fs ,
union smb_fsinfo * fs2 ,
NTSTATUS status )
2003-08-13 05:53:07 +04:00
{
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
/* and convert it to the required level */
switch ( fs - > generic . level ) {
case RAW_QFS_DSKATTR : {
/* map from generic to DSKATTR */
2010-01-05 20:42:54 +03:00
unsigned int bpunit = 64 ;
2003-08-13 05:53:07 +04:00
/* we need to scale the sizes to fit */
for ( bpunit = 64 ; bpunit < 0x10000 ; bpunit * = 2 ) {
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 12:28:31 +04:00
if ( fs2 - > generic . out . blocks_total * ( double ) fs2 - > generic . out . block_size < bpunit * 512 * 65535.0 ) {
2003-08-13 05:53:07 +04:00
break ;
}
}
fs - > dskattr . out . blocks_per_unit = bpunit ;
fs - > dskattr . out . block_size = 512 ;
fs - > dskattr . out . units_total =
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 12:28:31 +04:00
( fs2 - > generic . out . blocks_total * ( double ) fs2 - > generic . out . block_size ) / ( bpunit * 512 ) ;
2003-08-13 05:53:07 +04:00
fs - > dskattr . out . units_free =
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 12:28:31 +04:00
( fs2 - > generic . out . blocks_free * ( double ) fs2 - > generic . out . block_size ) / ( bpunit * 512 ) ;
2003-08-13 05:53:07 +04:00
/* we must return a maximum of 2G to old DOS systems, or they get very confused */
2006-03-16 21:54:19 +03:00
if ( bpunit > 64 & & req - > ctx - > protocol < = PROTOCOL_LANMAN2 ) {
2003-08-13 05:53:07 +04:00
fs - > dskattr . out . blocks_per_unit = 64 ;
fs - > dskattr . out . units_total = 0xFFFF ;
fs - > dskattr . out . units_free = 0xFFFF ;
}
return NT_STATUS_OK ;
}
case RAW_QFS_ALLOCATION :
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 12:28:31 +04:00
fs - > allocation . out . fs_id = fs2 - > generic . out . fs_id ;
fs - > allocation . out . total_alloc_units = fs2 - > generic . out . blocks_total ;
fs - > allocation . out . avail_alloc_units = fs2 - > generic . out . blocks_free ;
2003-08-13 05:53:07 +04:00
fs - > allocation . out . sectors_per_unit = 1 ;
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 12:28:31 +04:00
fs - > allocation . out . bytes_per_sector = fs2 - > generic . out . block_size ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_VOLUME :
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 12:28:31 +04:00
fs - > volume . out . serial_number = fs2 - > generic . out . serial_number ;
fs - > volume . out . volume_name . s = fs2 - > generic . out . volume_name ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_VOLUME_INFO :
case RAW_QFS_VOLUME_INFORMATION :
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 12:28:31 +04:00
fs - > volume_info . out . create_time = fs2 - > generic . out . create_time ;
fs - > volume_info . out . serial_number = fs2 - > generic . out . serial_number ;
fs - > volume_info . out . volume_name . s = fs2 - > generic . out . volume_name ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_SIZE_INFO :
case RAW_QFS_SIZE_INFORMATION :
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 12:28:31 +04:00
fs - > size_info . out . total_alloc_units = fs2 - > generic . out . blocks_total ;
fs - > size_info . out . avail_alloc_units = fs2 - > generic . out . blocks_free ;
2003-08-13 05:53:07 +04:00
fs - > size_info . out . sectors_per_unit = 1 ;
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 12:28:31 +04:00
fs - > size_info . out . bytes_per_sector = fs2 - > generic . out . block_size ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_DEVICE_INFO :
case RAW_QFS_DEVICE_INFORMATION :
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 12:28:31 +04:00
fs - > device_info . out . device_type = fs2 - > generic . out . device_type ;
fs - > device_info . out . characteristics = fs2 - > generic . out . device_characteristics ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_ATTRIBUTE_INFO :
case RAW_QFS_ATTRIBUTE_INFORMATION :
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 12:28:31 +04:00
fs - > attribute_info . out . fs_attr = fs2 - > generic . out . fs_attr ;
fs - > attribute_info . out . max_file_component_length = fs2 - > generic . out . max_file_component_length ;
fs - > attribute_info . out . fs_type . s = fs2 - > generic . out . fs_type ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_QUOTA_INFORMATION :
ZERO_STRUCT ( fs - > quota_information . out . unknown ) ;
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 12:28:31 +04:00
fs - > quota_information . out . quota_soft = fs2 - > generic . out . quota_soft ;
fs - > quota_information . out . quota_hard = fs2 - > generic . out . quota_hard ;
fs - > quota_information . out . quota_flags = fs2 - > generic . out . quota_flags ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_FULL_SIZE_INFORMATION :
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 12:28:31 +04:00
fs - > full_size_information . out . total_alloc_units = fs2 - > generic . out . blocks_total ;
fs - > full_size_information . out . call_avail_alloc_units = fs2 - > generic . out . blocks_free ;
fs - > full_size_information . out . actual_avail_alloc_units = fs2 - > generic . out . blocks_free ;
2003-08-13 05:53:07 +04:00
fs - > full_size_information . out . sectors_per_unit = 1 ;
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 12:28:31 +04:00
fs - > full_size_information . out . bytes_per_sector = fs2 - > generic . out . block_size ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_QFS_OBJECTID_INFORMATION :
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 12:28:31 +04:00
fs - > objectid_information . out . guid = fs2 - > generic . out . guid ;
2003-08-13 05:53:07 +04:00
ZERO_STRUCT ( fs - > objectid_information . out . unknown ) ;
return NT_STATUS_OK ;
2015-03-13 03:00:51 +03:00
case RAW_QFS_SECTOR_SIZE_INFORMATION :
fs - > sector_size_info . out . logical_bytes_per_sector
= fs2 - > generic . out . block_size ;
fs - > sector_size_info . out . phys_bytes_per_sector_atomic
= fs2 - > generic . out . block_size ;
fs - > sector_size_info . out . phys_bytes_per_sector_perf
= fs2 - > generic . out . block_size ;
fs - > sector_size_info . out . fs_effective_phys_bytes_per_sector_atomic
= fs2 - > generic . out . block_size ;
fs - > sector_size_info . out . flags
= QFS_SSINFO_FLAGS_ALIGNED_DEVICE
| QFS_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE ;
fs - > sector_size_info . out . byte_off_sector_align = 0 ;
fs - > sector_size_info . out . byte_off_partition_align = 0 ;
return NT_STATUS_OK ;
2011-06-16 10:39:03 +04:00
case RAW_QFS_GENERIC :
case RAW_QFS_UNIX_INFO :
2011-06-08 21:00:18 +04:00
return NT_STATUS_INVALID_LEVEL ;
}
2011-06-16 10:39:03 +04:00
return NT_STATUS_INVALID_LEVEL ;
2003-08-13 05:53:07 +04:00
}
2009-06-26 15:31:19 +04:00
/*
NTVFS fsinfo any to generic mapper
*/
NTSTATUS ntvfs_map_fsinfo ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_fsinfo * fs )
{
NTSTATUS status ;
union smb_fsinfo * fs2 ;
fs2 = talloc ( req , union smb_fsinfo ) ;
if ( fs2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
if ( fs - > generic . level = = RAW_QFS_GENERIC ) {
return NT_STATUS_INVALID_LEVEL ;
}
status = ntvfs_map_async_setup ( ntvfs , req , fs , fs2 ,
( second_stage_t ) ntvfs_map_fsinfo_finish ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
/* ask the backend for the generic info */
fs2 - > generic . level = RAW_QFS_GENERIC ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > fsinfo_fn ( ntvfs , req , fs2 ) ;
2009-06-26 15:31:19 +04:00
return ntvfs_map_async_finish ( req , status ) ;
}
2003-08-13 05:53:07 +04:00
/*
NTVFS fileinfo generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_fileinfo ( TALLOC_CTX * mem_ctx ,
2006-03-10 17:31:17 +03:00
union smb_fileinfo * info ,
2006-01-11 13:53:52 +03:00
union smb_fileinfo * info2 )
2003-08-13 05:53:07 +04:00
{
2003-12-04 14:01:58 +03:00
int i ;
2003-08-13 05:53:07 +04:00
/* and convert it to the required level using results in info2 */
switch ( info - > generic . level ) {
case RAW_FILEINFO_GETATTR :
2003-12-04 14:01:58 +03:00
info - > getattr . out . attrib = info2 - > generic . out . attrib & 0xff ;
2003-08-13 05:53:07 +04:00
info - > getattr . out . size = info2 - > generic . out . size ;
2004-05-25 17:57:39 +04:00
info - > getattr . out . write_time = nt_time_to_unix ( info2 - > generic . out . write_time ) ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_FILEINFO_GETATTRE :
info - > getattre . out . attrib = info2 - > generic . out . attrib ;
info - > getattre . out . size = info2 - > generic . out . size ;
2004-05-25 17:57:39 +04:00
info - > getattre . out . write_time = nt_time_to_unix ( info2 - > generic . out . write_time ) ;
info - > getattre . out . create_time = nt_time_to_unix ( info2 - > generic . out . create_time ) ;
info - > getattre . out . access_time = nt_time_to_unix ( info2 - > generic . out . access_time ) ;
2003-08-13 05:53:07 +04:00
info - > getattre . out . alloc_size = info2 - > generic . out . alloc_size ;
return NT_STATUS_OK ;
case RAW_FILEINFO_NETWORK_OPEN_INFORMATION :
info - > network_open_information . out . create_time = info2 - > generic . out . create_time ;
info - > network_open_information . out . access_time = info2 - > generic . out . access_time ;
info - > network_open_information . out . write_time = info2 - > generic . out . write_time ;
info - > network_open_information . out . change_time = info2 - > generic . out . change_time ;
info - > network_open_information . out . alloc_size = info2 - > generic . out . alloc_size ;
info - > network_open_information . out . size = info2 - > generic . out . size ;
info - > network_open_information . out . attrib = info2 - > generic . out . attrib ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ALL_INFO :
case RAW_FILEINFO_ALL_INFORMATION :
info - > all_info . out . create_time = info2 - > generic . out . create_time ;
info - > all_info . out . access_time = info2 - > generic . out . access_time ;
info - > all_info . out . write_time = info2 - > generic . out . write_time ;
info - > all_info . out . change_time = info2 - > generic . out . change_time ;
info - > all_info . out . attrib = info2 - > generic . out . attrib ;
info - > all_info . out . alloc_size = info2 - > generic . out . alloc_size ;
info - > all_info . out . size = info2 - > generic . out . size ;
info - > all_info . out . nlink = info2 - > generic . out . nlink ;
info - > all_info . out . delete_pending = info2 - > generic . out . delete_pending ;
info - > all_info . out . directory = info2 - > generic . out . directory ;
info - > all_info . out . ea_size = info2 - > generic . out . ea_size ;
info - > all_info . out . fname . s = info2 - > generic . out . fname . s ;
info - > all_info . out . fname . private_length = info2 - > generic . out . fname . private_length ;
return NT_STATUS_OK ;
case RAW_FILEINFO_BASIC_INFO :
case RAW_FILEINFO_BASIC_INFORMATION :
info - > basic_info . out . create_time = info2 - > generic . out . create_time ;
info - > basic_info . out . access_time = info2 - > generic . out . access_time ;
info - > basic_info . out . write_time = info2 - > generic . out . write_time ;
info - > basic_info . out . change_time = info2 - > generic . out . change_time ;
info - > basic_info . out . attrib = info2 - > generic . out . attrib ;
return NT_STATUS_OK ;
case RAW_FILEINFO_STANDARD :
2004-05-25 17:57:39 +04:00
info - > standard . out . create_time = nt_time_to_unix ( info2 - > generic . out . create_time ) ;
info - > standard . out . access_time = nt_time_to_unix ( info2 - > generic . out . access_time ) ;
info - > standard . out . write_time = nt_time_to_unix ( info2 - > generic . out . write_time ) ;
2003-08-13 05:53:07 +04:00
info - > standard . out . size = info2 - > generic . out . size ;
info - > standard . out . alloc_size = info2 - > generic . out . alloc_size ;
info - > standard . out . attrib = info2 - > generic . out . attrib ;
return NT_STATUS_OK ;
case RAW_FILEINFO_EA_SIZE :
2004-05-25 17:57:39 +04:00
info - > ea_size . out . create_time = nt_time_to_unix ( info2 - > generic . out . create_time ) ;
info - > ea_size . out . access_time = nt_time_to_unix ( info2 - > generic . out . access_time ) ;
info - > ea_size . out . write_time = nt_time_to_unix ( info2 - > generic . out . write_time ) ;
2003-08-13 05:53:07 +04:00
info - > ea_size . out . size = info2 - > generic . out . size ;
info - > ea_size . out . alloc_size = info2 - > generic . out . alloc_size ;
info - > ea_size . out . attrib = info2 - > generic . out . attrib ;
info - > ea_size . out . ea_size = info2 - > generic . out . ea_size ;
return NT_STATUS_OK ;
case RAW_FILEINFO_STANDARD_INFO :
case RAW_FILEINFO_STANDARD_INFORMATION :
info - > standard_info . out . alloc_size = info2 - > generic . out . alloc_size ;
info - > standard_info . out . size = info2 - > generic . out . size ;
info - > standard_info . out . nlink = info2 - > generic . out . nlink ;
info - > standard_info . out . delete_pending = info2 - > generic . out . delete_pending ;
info - > standard_info . out . directory = info2 - > generic . out . directory ;
return NT_STATUS_OK ;
case RAW_FILEINFO_INTERNAL_INFORMATION :
2003-09-02 08:37:33 +04:00
info - > internal_information . out . file_id = info2 - > generic . out . file_id ;
2003-08-13 05:53:07 +04:00
return NT_STATUS_OK ;
case RAW_FILEINFO_EA_INFO :
case RAW_FILEINFO_EA_INFORMATION :
info - > ea_info . out . ea_size = info2 - > generic . out . ea_size ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ATTRIBUTE_TAG_INFORMATION :
info - > attribute_tag_information . out . attrib = info2 - > generic . out . attrib ;
info - > attribute_tag_information . out . reparse_tag = info2 - > generic . out . reparse_tag ;
return NT_STATUS_OK ;
case RAW_FILEINFO_STREAM_INFO :
case RAW_FILEINFO_STREAM_INFORMATION :
info - > stream_info . out . num_streams = info2 - > generic . out . num_streams ;
2003-12-04 14:01:58 +03:00
if ( info - > stream_info . out . num_streams > 0 ) {
2005-01-06 06:06:58 +03:00
info - > stream_info . out . streams =
2006-03-10 17:31:17 +03:00
talloc_array ( mem_ctx ,
2005-01-06 06:06:58 +03:00
struct stream_struct ,
info - > stream_info . out . num_streams ) ;
2003-12-04 14:01:58 +03:00
if ( ! info - > stream_info . out . streams ) {
DEBUG ( 2 , ( " ntvfs_map_fileinfo: no memory for %d streams \n " ,
info - > stream_info . out . num_streams ) ) ;
return NT_STATUS_NO_MEMORY ;
}
for ( i = 0 ; i < info - > stream_info . out . num_streams ; i + + ) {
info - > stream_info . out . streams [ i ] = info2 - > generic . out . streams [ i ] ;
info - > stream_info . out . streams [ i ] . stream_name . s =
2006-03-10 17:31:17 +03:00
talloc_strdup ( info - > stream_info . out . streams ,
info2 - > generic . out . streams [ i ] . stream_name . s ) ;
2003-12-04 14:01:58 +03:00
if ( ! info - > stream_info . out . streams [ i ] . stream_name . s ) {
DEBUG ( 2 , ( " ntvfs_map_fileinfo: no memory for stream_name \n " ) ) ;
return NT_STATUS_NO_MEMORY ;
}
}
2003-08-13 05:53:07 +04:00
}
return NT_STATUS_OK ;
case RAW_FILEINFO_NAME_INFO :
case RAW_FILEINFO_NAME_INFORMATION :
2006-03-10 17:31:17 +03:00
info - > name_info . out . fname . s = talloc_strdup ( mem_ctx , info2 - > generic . out . fname . s ) ;
NT_STATUS_HAVE_NO_MEMORY ( info - > name_info . out . fname . s ) ;
2003-08-13 05:53:07 +04:00
info - > name_info . out . fname . private_length = info2 - > generic . out . fname . private_length ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ALT_NAME_INFO :
case RAW_FILEINFO_ALT_NAME_INFORMATION :
2006-03-10 17:31:17 +03:00
info - > alt_name_info . out . fname . s = talloc_strdup ( mem_ctx , info2 - > generic . out . alt_fname . s ) ;
NT_STATUS_HAVE_NO_MEMORY ( info - > alt_name_info . out . fname . s ) ;
2003-08-13 05:53:07 +04:00
info - > alt_name_info . out . fname . private_length = info2 - > generic . out . alt_fname . private_length ;
return NT_STATUS_OK ;
2003-12-04 14:01:58 +03:00
case RAW_FILEINFO_POSITION_INFORMATION :
info - > position_information . out . position = info2 - > generic . out . position ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ALL_EAS :
info - > all_eas . out . num_eas = info2 - > generic . out . num_eas ;
if ( info - > all_eas . out . num_eas > 0 ) {
2006-03-10 17:31:17 +03:00
info - > all_eas . out . eas = talloc_array ( mem_ctx ,
2005-01-06 06:06:58 +03:00
struct ea_struct ,
info - > all_eas . out . num_eas ) ;
2003-12-04 14:01:58 +03:00
if ( ! info - > all_eas . out . eas ) {
DEBUG ( 2 , ( " ntvfs_map_fileinfo: no memory for %d eas \n " ,
info - > all_eas . out . num_eas ) ) ;
return NT_STATUS_NO_MEMORY ;
}
for ( i = 0 ; i < info - > all_eas . out . num_eas ; i + + ) {
info - > all_eas . out . eas [ i ] = info2 - > generic . out . eas [ i ] ;
info - > all_eas . out . eas [ i ] . name . s =
2006-03-10 17:31:17 +03:00
talloc_strdup ( info - > all_eas . out . eas ,
info2 - > generic . out . eas [ i ] . name . s ) ;
2003-12-04 14:01:58 +03:00
if ( ! info - > all_eas . out . eas [ i ] . name . s ) {
DEBUG ( 2 , ( " ntvfs_map_fileinfo: no memory for stream_name \n " ) ) ;
return NT_STATUS_NO_MEMORY ;
}
info - > all_eas . out . eas [ i ] . value . data =
2009-02-13 13:35:17 +03:00
( uint8_t * ) talloc_memdup ( info - > all_eas . out . eas ,
2003-12-04 14:01:58 +03:00
info2 - > generic . out . eas [ i ] . value . data ,
info2 - > generic . out . eas [ i ] . value . length ) ;
if ( ! info - > all_eas . out . eas [ i ] . value . data ) {
DEBUG ( 2 , ( " ntvfs_map_fileinfo: no memory for stream_name \n " ) ) ;
return NT_STATUS_NO_MEMORY ;
}
}
}
return NT_STATUS_OK ;
case RAW_FILEINFO_IS_NAME_VALID :
return NT_STATUS_OK ;
case RAW_FILEINFO_COMPRESSION_INFO :
case RAW_FILEINFO_COMPRESSION_INFORMATION :
info - > compression_info . out . compressed_size = info2 - > generic . out . compressed_size ;
info - > compression_info . out . format = info2 - > generic . out . format ;
info - > compression_info . out . unit_shift = info2 - > generic . out . unit_shift ;
info - > compression_info . out . chunk_shift = info2 - > generic . out . chunk_shift ;
info - > compression_info . out . cluster_shift = info2 - > generic . out . cluster_shift ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ACCESS_INFORMATION :
info - > access_information . out . access_flags = info2 - > generic . out . access_flags ;
return NT_STATUS_OK ;
case RAW_FILEINFO_MODE_INFORMATION :
info - > mode_information . out . mode = info2 - > generic . out . mode ;
return NT_STATUS_OK ;
case RAW_FILEINFO_ALIGNMENT_INFORMATION :
info - > alignment_information . out . alignment_requirement =
info2 - > generic . out . alignment_requirement ;
return NT_STATUS_OK ;
case RAW_FILEINFO_UNIX_BASIC :
2014-02-27 12:29:36 +04:00
# if 1
return NT_STATUS_INVALID_LEVEL ;
# else
2003-12-04 14:01:58 +03:00
info - > unix_basic_info . out . end_of_file = info2 - > generic . out . end_of_file ;
info - > unix_basic_info . out . num_bytes = info2 - > generic . out . size ;
info - > unix_basic_info . out . status_change_time = info2 - > generic . out . change_time ;
info - > unix_basic_info . out . access_time = info2 - > generic . out . access_time ;
info - > unix_basic_info . out . change_time = info2 - > generic . out . change_time ;
info - > unix_basic_info . out . uid = info2 - > generic . out . uid ;
info - > unix_basic_info . out . gid = info2 - > generic . out . gid ;
info - > unix_basic_info . out . file_type = info2 - > generic . out . file_type ;
info - > unix_basic_info . out . dev_major = info2 - > generic . out . device ;
info - > unix_basic_info . out . dev_minor = info2 - > generic . out . device ;
info - > unix_basic_info . out . unique_id = info2 - > generic . out . inode ;
info - > unix_basic_info . out . permissions = info2 - > generic . out . permissions ;
info - > unix_basic_info . out . nlink = info2 - > generic . out . nlink ;
return NT_STATUS_OK ;
2014-02-27 12:29:36 +04:00
# endif
2003-12-04 14:01:58 +03:00
case RAW_FILEINFO_UNIX_LINK :
2014-02-27 12:29:36 +04:00
# if 1
return NT_STATUS_INVALID_LEVEL ;
# else
2003-12-04 14:01:58 +03:00
info - > unix_link_info . out . link_dest = info2 - > generic . out . link_dest ;
return NT_STATUS_OK ;
# endif
2011-06-16 10:39:03 +04:00
case RAW_FILEINFO_GENERIC :
case RAW_FILEINFO_SEC_DESC :
case RAW_FILEINFO_EA_LIST :
case RAW_FILEINFO_UNIX_INFO2 :
case RAW_FILEINFO_SMB2_ALL_EAS :
case RAW_FILEINFO_SMB2_ALL_INFORMATION :
2011-06-08 21:00:18 +04:00
return NT_STATUS_INVALID_LEVEL ;
2003-08-13 05:53:07 +04:00
}
2011-06-16 10:39:03 +04:00
return NT_STATUS_INVALID_LEVEL ;
2003-08-13 05:53:07 +04:00
}
/*
2009-06-26 15:31:19 +04:00
NTVFS any to fileinfo mapper
*/
static NTSTATUS ntvfs_map_qfileinfo_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_fileinfo * info ,
union smb_fileinfo * info2 ,
NTSTATUS status )
{
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
return ntvfs_map_fileinfo ( req , info , info2 ) ;
}
/*
2003-08-13 05:53:07 +04:00
NTVFS fileinfo generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_qfileinfo ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_fileinfo * info )
2003-08-13 05:53:07 +04:00
{
NTSTATUS status ;
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 12:28:31 +04:00
union smb_fileinfo * info2 ;
2005-01-27 10:08:20 +03:00
info2 = talloc ( req , union smb_fileinfo ) ;
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 12:28:31 +04:00
if ( info2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2003-08-13 05:53:07 +04:00
if ( info - > generic . level = = RAW_FILEINFO_GENERIC ) {
return NT_STATUS_INVALID_LEVEL ;
}
2009-06-26 15:31:19 +04:00
status = ntvfs_map_async_setup ( ntvfs , req , info , info2 ,
( second_stage_t ) ntvfs_map_qfileinfo_finish ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
2003-08-13 05:53:07 +04:00
/* ask the backend for the generic info */
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 12:28:31 +04:00
info2 - > generic . level = RAW_FILEINFO_GENERIC ;
2006-05-20 12:15:22 +04:00
info2 - > generic . in . file . ntvfs = info - > generic . in . file . ntvfs ;
2003-08-13 05:53:07 +04:00
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > qfileinfo_fn ( ntvfs , req , info2 ) ;
2009-06-26 15:31:19 +04:00
return ntvfs_map_async_finish ( req , status ) ;
}
/*
NTVFS any to fileinfo mapper
*/
static NTSTATUS ntvfs_map_qpathinfo_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_fileinfo * info ,
union smb_fileinfo * info2 ,
NTSTATUS status )
{
2003-08-13 05:53:07 +04:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
2009-06-26 15:31:19 +04:00
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 12:28:31 +04:00
return ntvfs_map_fileinfo ( req , info , info2 ) ;
2003-08-13 05:53:07 +04:00
}
/*
NTVFS pathinfo generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_qpathinfo ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_fileinfo * info )
2003-08-13 05:53:07 +04:00
{
NTSTATUS status ;
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 12:28:31 +04:00
union smb_fileinfo * info2 ;
2005-01-27 10:08:20 +03:00
info2 = talloc ( req , union smb_fileinfo ) ;
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 12:28:31 +04:00
if ( info2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2003-08-13 05:53:07 +04:00
if ( info - > generic . level = = RAW_FILEINFO_GENERIC ) {
return NT_STATUS_INVALID_LEVEL ;
}
2009-06-26 15:31:19 +04:00
status = ntvfs_map_async_setup ( ntvfs , req , info , info2 ,
( second_stage_t ) ntvfs_map_qpathinfo_finish ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
2003-08-13 05:53:07 +04:00
/* ask the backend for the generic info */
2006-03-13 01:48:25 +03:00
info2 - > generic . level = RAW_FILEINFO_GENERIC ;
info2 - > generic . in . file . path = info - > generic . in . file . path ;
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 12:28:31 +04:00
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > qpathinfo_fn ( ntvfs , req , info2 ) ;
2009-06-26 15:31:19 +04:00
return ntvfs_map_async_finish ( req , status ) ;
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 12:28:31 +04:00
}
/*
NTVFS lock generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_lock ( struct ntvfs_module_context * ntvfs ,
2008-06-02 05:04:13 +04:00
struct ntvfs_request * req ,
union smb_lock * lck )
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 12:28:31 +04:00
{
union smb_lock * lck2 ;
struct smb_lock_entry * locks ;
2005-01-27 10:08:20 +03:00
lck2 = talloc ( req , union smb_lock ) ;
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 12:28:31 +04:00
if ( lck2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2005-01-27 10:08:20 +03:00
locks = talloc_array ( lck2 , struct smb_lock_entry , 1 ) ;
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 12:28:31 +04:00
if ( locks = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
switch ( lck - > generic . level ) {
case RAW_LOCK_LOCKX :
return NT_STATUS_INVALID_LEVEL ;
case RAW_LOCK_LOCK :
2007-05-14 17:47:03 +04:00
lck2 - > generic . level = RAW_LOCK_GENERIC ;
lck2 - > generic . in . file . ntvfs = lck - > lock . in . file . ntvfs ;
lck2 - > generic . in . mode = 0 ;
lck2 - > generic . in . timeout = 0 ;
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 12:28:31 +04:00
lck2 - > generic . in . ulock_cnt = 0 ;
lck2 - > generic . in . lock_cnt = 1 ;
2007-05-14 17:47:03 +04:00
lck2 - > generic . in . locks = locks ;
locks - > pid = req - > smbpid ;
locks - > offset = lck - > lock . in . offset ;
locks - > count = lck - > lock . in . count ;
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 12:28:31 +04:00
break ;
case RAW_LOCK_UNLOCK :
2007-05-14 17:47:03 +04:00
lck2 - > generic . level = RAW_LOCK_GENERIC ;
lck2 - > generic . in . file . ntvfs = lck - > unlock . in . file . ntvfs ;
lck2 - > generic . in . mode = 0 ;
lck2 - > generic . in . timeout = 0 ;
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 12:28:31 +04:00
lck2 - > generic . in . ulock_cnt = 1 ;
lck2 - > generic . in . lock_cnt = 0 ;
2007-05-14 17:47:03 +04:00
lck2 - > generic . in . locks = locks ;
locks - > pid = req - > smbpid ;
locks - > offset = lck - > unlock . in . offset ;
locks - > count = lck - > unlock . in . count ;
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 12:28:31 +04:00
break ;
2006-05-22 21:21:38 +04:00
2008-05-21 16:12:20 +04:00
case RAW_LOCK_SMB2 : {
/* this is only approximate! We need to change the
generic structure to fix this properly */
2008-06-02 05:04:13 +04:00
int i ;
bool isunlock ;
2008-05-21 16:12:20 +04:00
if ( lck - > smb2 . in . lock_count < 1 ) {
2007-05-14 17:47:03 +04:00
return NT_STATUS_INVALID_PARAMETER ;
}
lck2 - > generic . level = RAW_LOCK_GENERIC ;
lck2 - > generic . in . file . ntvfs = lck - > smb2 . in . file . ntvfs ;
2008-05-21 16:12:20 +04:00
lck2 - > generic . in . timeout = UINT32_MAX ;
lck2 - > generic . in . mode = 0 ;
lck2 - > generic . in . lock_cnt = 0 ;
lck2 - > generic . in . ulock_cnt = 0 ;
lck2 - > generic . in . locks = talloc_zero_array ( lck2 , struct smb_lock_entry ,
lck - > smb2 . in . lock_count ) ;
if ( lck2 - > generic . in . locks = = NULL ) {
return NT_STATUS_NO_MEMORY ;
2007-05-14 17:47:03 +04:00
}
2008-06-02 05:04:13 +04:00
/* only the first lock gives the UNLOCK bit - see
MS - SMB2 3.3 .5 .14 */
if ( lck - > smb2 . in . locks [ 0 ] . flags & SMB2_LOCK_FLAG_UNLOCK ) {
2009-11-26 08:35:03 +03:00
if ( lck - > smb2 . in . locks [ 0 ] . flags & SMB2_LOCK_FLAG_FAIL_IMMEDIATELY ) {
return NT_STATUS_INVALID_PARAMETER ;
}
2008-06-02 05:04:13 +04:00
lck2 - > generic . in . ulock_cnt = lck - > smb2 . in . lock_count ;
isunlock = true ;
} else {
lck2 - > generic . in . lock_cnt = lck - > smb2 . in . lock_count ;
isunlock = false ;
2007-05-14 21:58:28 +04:00
}
2008-06-02 05:04:13 +04:00
for ( i = 0 ; i < lck - > smb2 . in . lock_count ; i + + ) {
2009-11-27 11:09:10 +03:00
if ( ! isunlock & &
lck - > smb2 . in . locks [ i ] . flags = = SMB2_LOCK_FLAG_NONE ) {
2009-11-18 10:11:46 +03:00
return NT_STATUS_INVALID_PARAMETER ;
}
if ( lck - > smb2 . in . locks [ i ] . flags & ~ SMB2_LOCK_FLAG_ALL_MASK ) {
return NT_STATUS_INVALID_PARAMETER ;
}
2008-06-02 05:04:13 +04:00
if ( isunlock & &
( lck - > smb2 . in . locks [ i ] . flags &
( SMB2_LOCK_FLAG_SHARED | SMB2_LOCK_FLAG_EXCLUSIVE ) ) ) {
2008-05-27 11:22:02 +04:00
return NT_STATUS_INVALID_PARAMETER ;
}
2008-06-03 03:36:02 +04:00
if ( ! isunlock & &
( lck - > smb2 . in . locks [ i ] . flags & SMB2_LOCK_FLAG_UNLOCK ) ) {
return NT_STATUS_INVALID_PARAMETER ;
}
lck2 - > generic . in . locks [ i ] . pid = req - > smbpid ;
2008-06-02 05:04:13 +04:00
lck2 - > generic . in . locks [ i ] . offset = lck - > smb2 . in . locks [ i ] . offset ;
2008-06-03 03:36:02 +04:00
lck2 - > generic . in . locks [ i ] . count = lck - > smb2 . in . locks [ i ] . length ;
2008-05-27 11:22:02 +04:00
if ( ! ( lck - > smb2 . in . locks [ i ] . flags & SMB2_LOCK_FLAG_EXCLUSIVE ) ) {
lck2 - > generic . in . mode = LOCKING_ANDX_SHARED_LOCK ;
}
if ( lck - > smb2 . in . locks [ i ] . flags & SMB2_LOCK_FLAG_FAIL_IMMEDIATELY ) {
lck2 - > generic . in . timeout = 0 ;
2008-05-21 16:12:20 +04:00
}
2007-05-14 17:47:03 +04:00
}
/* initialize output value */
2008-05-21 16:12:20 +04:00
lck - > smb2 . out . reserved = 0 ;
2007-05-14 17:47:03 +04:00
break ;
2008-05-21 16:12:20 +04:00
}
2008-04-19 00:32:25 +04:00
case RAW_LOCK_SMB2_BREAK :
lck2 - > generic . level = RAW_LOCK_GENERIC ;
lck2 - > generic . in . file . ntvfs = lck - > smb2_break . in . file . ntvfs ;
lck2 - > generic . in . mode = LOCKING_ANDX_OPLOCK_RELEASE |
( ( lck - > smb2_break . in . oplock_level < < 8 ) & 0xFF00 ) ;
lck2 - > generic . in . timeout = 0 ;
lck2 - > generic . in . ulock_cnt = 0 ;
lck2 - > generic . in . lock_cnt = 0 ;
lck2 - > generic . in . locks = NULL ;
/* initialize output value */
lck - > smb2_break . out . oplock_level = lck - > smb2_break . in . oplock_level ;
lck - > smb2_break . out . reserved = lck - > smb2_break . in . reserved ;
lck - > smb2_break . out . reserved2 = lck - > smb2_break . in . reserved2 ;
lck - > smb2_break . out . file = lck - > smb2_break . in . file ;
break ;
2007-05-14 17:47:03 +04:00
}
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 12:28:31 +04:00
2006-02-22 14:11:16 +03:00
/*
* we don ' t need to call ntvfs_map_async_setup ( ) here ,
* as lock ( ) doesn ' t have any output fields
*/
2012-06-13 11:11:42 +04:00
return ntvfs - > ops - > lock_fn ( ntvfs , req , lck2 ) ;
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 12:28:31 +04:00
}
/*
NTVFS write generic to any mapper
*/
2006-03-10 17:31:17 +03:00
static NTSTATUS ntvfs_map_write_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
2004-11-04 10:36:53 +03:00
union smb_write * wr ,
union smb_write * wr2 ,
NTSTATUS status )
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 12:28:31 +04:00
{
union smb_lock * lck ;
union smb_close * cl ;
2010-01-05 20:42:54 +03:00
unsigned int state ;
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 12:28:31 +04:00
2004-11-04 10:36:53 +03:00
if ( NT_STATUS_IS_ERR ( status ) ) {
return status ;
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 12:28:31 +04:00
}
switch ( wr - > generic . level ) {
case RAW_WRITE_WRITE :
wr - > write . out . nwritten = wr2 - > generic . out . nwritten ;
break ;
case RAW_WRITE_WRITEUNLOCK :
2004-11-04 10:36:53 +03:00
wr - > writeunlock . out . nwritten = wr2 - > generic . out . nwritten ;
2005-01-27 10:08:20 +03:00
lck = talloc ( wr2 , union smb_lock ) ;
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 12:28:31 +04:00
if ( lck = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2006-05-20 12:15:22 +04:00
lck - > unlock . level = RAW_LOCK_UNLOCK ;
lck - > unlock . in . file . ntvfs = wr - > writeunlock . in . file . ntvfs ;
lck - > unlock . in . count = wr - > writeunlock . in . count ;
lck - > unlock . in . offset = wr - > writeunlock . in . offset ;
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 12:28:31 +04:00
2004-11-04 10:36:53 +03:00
if ( lck - > unlock . in . count ! = 0 ) {
/* do the lock sync for now */
state = req - > async_states - > state ;
req - > async_states - > state & = ~ NTVFS_ASYNC_STATE_MAY_ASYNC ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > lock_fn ( ntvfs , req , lck ) ;
2004-11-04 10:36:53 +03:00
req - > async_states - > state = state ;
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 12:28:31 +04:00
}
break ;
case RAW_WRITE_WRITECLOSE :
2004-11-04 10:36:53 +03:00
wr - > writeclose . out . nwritten = wr2 - > generic . out . nwritten ;
2005-01-27 10:08:20 +03:00
cl = talloc ( wr2 , union smb_close ) ;
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 12:28:31 +04:00
if ( cl = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2006-03-13 01:48:25 +03:00
cl - > close . level = RAW_CLOSE_CLOSE ;
2006-05-20 12:15:22 +04:00
cl - > close . in . file . ntvfs = wr - > writeclose . in . file . ntvfs ;
2006-03-13 01:48:25 +03:00
cl - > close . in . write_time = wr - > writeclose . in . mtime ;
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 12:28:31 +04:00
2004-11-04 10:36:53 +03:00
if ( wr2 - > generic . in . count ! = 0 ) {
/* do the close sync for now */
state = req - > async_states - > state ;
req - > async_states - > state & = ~ NTVFS_ASYNC_STATE_MAY_ASYNC ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > close_fn ( ntvfs , req , cl ) ;
2004-11-04 10:36:53 +03:00
req - > async_states - > state = state ;
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 12:28:31 +04:00
}
break ;
case RAW_WRITE_SPLWRITE :
2004-11-04 10:36:53 +03:00
break ;
2006-05-20 22:56:08 +04:00
case RAW_WRITE_SMB2 :
wr - > smb2 . out . _pad = 0 ;
wr - > smb2 . out . nwritten = wr2 - > generic . out . nwritten ;
wr - > smb2 . out . unknown1 = 0 ;
break ;
2004-11-04 10:36:53 +03:00
default :
return NT_STATUS_INVALID_LEVEL ;
}
return status ;
}
/*
NTVFS write generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_write ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_write * wr )
2004-11-04 10:36:53 +03:00
{
union smb_write * wr2 ;
NTSTATUS status ;
2005-01-27 10:08:20 +03:00
wr2 = talloc ( req , union smb_write ) ;
2004-11-04 10:36:53 +03:00
if ( wr2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2006-03-10 17:31:17 +03:00
status = ntvfs_map_async_setup ( ntvfs , req , wr , wr2 ,
2004-11-04 10:36:53 +03:00
( second_stage_t ) ntvfs_map_write_finish ) ;
2004-11-04 14:28:38 +03:00
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
2004-11-04 10:36:53 +03:00
wr2 - > writex . level = RAW_WRITE_GENERIC ;
switch ( wr - > generic . level ) {
case RAW_WRITE_WRITEX :
status = NT_STATUS_INVALID_LEVEL ;
break ;
case RAW_WRITE_WRITE :
2006-05-20 12:15:22 +04:00
wr2 - > writex . in . file . ntvfs = wr - > write . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
wr2 - > writex . in . offset = wr - > write . in . offset ;
wr2 - > writex . in . wmode = 0 ;
wr2 - > writex . in . remaining = wr - > write . in . remaining ;
wr2 - > writex . in . count = wr - > write . in . count ;
wr2 - > writex . in . data = wr - > write . in . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > write_fn ( ntvfs , req , wr2 ) ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_WRITE_WRITEUNLOCK :
2006-05-20 12:15:22 +04:00
wr2 - > writex . in . file . ntvfs = wr - > writeunlock . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
wr2 - > writex . in . offset = wr - > writeunlock . in . offset ;
wr2 - > writex . in . wmode = 0 ;
wr2 - > writex . in . remaining = wr - > writeunlock . in . remaining ;
wr2 - > writex . in . count = wr - > writeunlock . in . count ;
wr2 - > writex . in . data = wr - > writeunlock . in . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > write_fn ( ntvfs , req , wr2 ) ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_WRITE_WRITECLOSE :
2006-05-20 12:15:22 +04:00
wr2 - > writex . in . file . ntvfs = wr - > writeclose . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
wr2 - > writex . in . offset = wr - > writeclose . in . offset ;
wr2 - > writex . in . wmode = 0 ;
wr2 - > writex . in . remaining = 0 ;
wr2 - > writex . in . count = wr - > writeclose . in . count ;
wr2 - > writex . in . data = wr - > writeclose . in . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > write_fn ( ntvfs , req , wr2 ) ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_WRITE_SPLWRITE :
2006-05-20 12:15:22 +04:00
wr2 - > writex . in . file . ntvfs = wr - > splwrite . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
wr2 - > writex . in . offset = 0 ;
wr2 - > writex . in . wmode = 0 ;
wr2 - > writex . in . remaining = 0 ;
wr2 - > writex . in . count = wr - > splwrite . in . count ;
wr2 - > writex . in . data = wr - > splwrite . in . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > write_fn ( ntvfs , req , wr2 ) ;
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 12:28:31 +04:00
break ;
2006-05-20 22:56:08 +04:00
case RAW_WRITE_SMB2 :
wr2 - > writex . in . file . ntvfs = wr - > smb2 . in . file . ntvfs ;
wr2 - > writex . in . offset = wr - > smb2 . in . offset ;
wr2 - > writex . in . wmode = 0 ;
wr2 - > writex . in . remaining = 0 ;
wr2 - > writex . in . count = wr - > smb2 . in . data . length ;
wr2 - > writex . in . data = wr - > smb2 . in . data . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > write_fn ( ntvfs , req , wr2 ) ;
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 12:28:31 +04:00
}
2004-11-04 10:36:53 +03:00
return ntvfs_map_async_finish ( req , status ) ;
}
/*
NTVFS read generic to any mapper - finish the out mapping
*/
2006-03-10 17:31:17 +03:00
static NTSTATUS ntvfs_map_read_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
2004-11-04 10:36:53 +03:00
union smb_read * rd ,
union smb_read * rd2 ,
NTSTATUS status )
{
switch ( rd - > generic . level ) {
case RAW_READ_READ :
2006-05-20 23:03:06 +04:00
rd - > read . out . nread = rd2 - > generic . out . nread ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_READ_READBRAW :
2006-05-20 23:03:06 +04:00
rd - > readbraw . out . nread = rd2 - > generic . out . nread ;
2004-11-04 10:36:53 +03:00
break ;
case RAW_READ_LOCKREAD :
2006-05-20 23:03:06 +04:00
rd - > lockread . out . nread = rd2 - > generic . out . nread ;
break ;
case RAW_READ_SMB2 :
rd - > smb2 . out . data . length = rd2 - > generic . out . nread ;
2008-04-14 13:31:17 +04:00
rd - > smb2 . out . remaining = 0 ;
rd - > smb2 . out . reserved = 0 ;
2004-11-04 10:36:53 +03:00
break ;
default :
return NT_STATUS_INVALID_LEVEL ;
}
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 12:28:31 +04:00
return status ;
}
/*
2004-11-04 10:36:53 +03:00
NTVFS read * to readx mapper
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 12:28:31 +04:00
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_read ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_read * rd )
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 12:28:31 +04:00
{
union smb_read * rd2 ;
union smb_lock * lck ;
NTSTATUS status ;
2010-01-05 20:42:54 +03:00
unsigned int state ;
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 12:28:31 +04:00
2005-01-27 10:08:20 +03:00
rd2 = talloc ( req , union smb_read ) ;
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 12:28:31 +04:00
if ( rd2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2006-03-10 17:31:17 +03:00
status = ntvfs_map_async_setup ( ntvfs , req , rd , rd2 ,
2004-11-04 10:36:53 +03:00
( second_stage_t ) ntvfs_map_read_finish ) ;
if ( ! NT_STATUS_IS_OK ( status ) ) {
return status ;
}
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 12:28:31 +04:00
2004-11-04 10:36:53 +03:00
rd2 - > readx . level = RAW_READ_READX ;
2007-10-07 02:28:14 +04:00
rd2 - > readx . in . read_for_execute = false ;
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 12:28:31 +04:00
switch ( rd - > generic . level ) {
case RAW_READ_READX :
status = NT_STATUS_INVALID_LEVEL ;
break ;
case RAW_READ_READ :
2006-05-20 12:15:22 +04:00
rd2 - > readx . in . file . ntvfs = rd - > read . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
rd2 - > readx . in . offset = rd - > read . in . offset ;
rd2 - > readx . in . mincnt = rd - > read . in . count ;
rd2 - > readx . in . maxcnt = rd - > read . in . count ;
rd2 - > readx . in . remaining = rd - > read . in . remaining ;
rd2 - > readx . out . data = rd - > read . out . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > read_fn ( ntvfs , req , rd2 ) ;
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 12:28:31 +04:00
break ;
case RAW_READ_READBRAW :
2006-05-20 12:15:22 +04:00
rd2 - > readx . in . file . ntvfs = rd - > readbraw . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
rd2 - > readx . in . offset = rd - > readbraw . in . offset ;
rd2 - > readx . in . mincnt = rd - > readbraw . in . mincnt ;
rd2 - > readx . in . maxcnt = rd - > readbraw . in . maxcnt ;
rd2 - > readx . in . remaining = 0 ;
rd2 - > readx . out . data = rd - > readbraw . out . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > read_fn ( ntvfs , req , rd2 ) ;
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 12:28:31 +04:00
break ;
case RAW_READ_LOCKREAD :
2004-11-04 10:36:53 +03:00
/* do the initial lock sync for now */
state = req - > async_states - > state ;
req - > async_states - > state & = ~ NTVFS_ASYNC_STATE_MAY_ASYNC ;
2005-01-27 10:08:20 +03:00
lck = talloc ( rd2 , union smb_lock ) ;
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 12:28:31 +04:00
if ( lck = = NULL ) {
2004-11-04 15:12:09 +03:00
status = NT_STATUS_NO_MEMORY ;
goto done ;
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 12:28:31 +04:00
}
2006-03-13 01:48:25 +03:00
lck - > lock . level = RAW_LOCK_LOCK ;
2006-05-20 12:15:22 +04:00
lck - > lock . in . file . ntvfs = rd - > lockread . in . file . ntvfs ;
2006-03-13 01:48:25 +03:00
lck - > lock . in . count = rd - > lockread . in . count ;
lck - > lock . in . offset = rd - > lockread . in . offset ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > lock_fn ( ntvfs , req , lck ) ;
2004-11-04 10:36:53 +03:00
req - > async_states - > state = state ;
2006-05-20 12:15:22 +04:00
rd2 - > readx . in . file . ntvfs = rd - > lockread . in . file . ntvfs ;
2004-11-04 10:36:53 +03:00
rd2 - > readx . in . offset = rd - > lockread . in . offset ;
rd2 - > readx . in . mincnt = rd - > lockread . in . count ;
rd2 - > readx . in . maxcnt = rd - > lockread . in . count ;
rd2 - > readx . in . remaining = rd - > lockread . in . remaining ;
rd2 - > readx . out . data = rd - > lockread . out . data ;
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 12:28:31 +04:00
if ( NT_STATUS_IS_OK ( status ) ) {
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > read_fn ( ntvfs , req , rd2 ) ;
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 12:28:31 +04:00
}
break ;
2006-05-20 23:03:06 +04:00
case RAW_READ_SMB2 :
rd2 - > readx . in . file . ntvfs = rd - > smb2 . in . file . ntvfs ;
rd2 - > readx . in . offset = rd - > smb2 . in . offset ;
2008-05-27 12:20:23 +04:00
rd2 - > readx . in . mincnt = rd - > smb2 . in . min_count ;
2006-05-20 23:03:06 +04:00
rd2 - > readx . in . maxcnt = rd - > smb2 . in . length ;
rd2 - > readx . in . remaining = 0 ;
rd2 - > readx . out . data = rd - > smb2 . out . data . data ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > read_fn ( ntvfs , req , rd2 ) ;
2006-05-20 23:03:06 +04:00
break ;
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 12:28:31 +04:00
}
2004-11-04 15:12:09 +03:00
done :
2004-11-04 10:36:53 +03:00
return ntvfs_map_async_finish ( req , status ) ;
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 12:28:31 +04:00
}
2008-05-27 10:43:36 +04:00
/*
NTVFS close generic to any mapper
*/
static NTSTATUS ntvfs_map_close_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_close * cl ,
union smb_close * cl2 ,
NTSTATUS status )
{
NT_STATUS_NOT_OK_RETURN ( status ) ;
switch ( cl - > generic . level ) {
case RAW_CLOSE_SMB2 :
cl - > smb2 . out . flags = cl2 - > generic . out . flags ;
cl - > smb2 . out . _pad = 0 ;
cl - > smb2 . out . create_time = cl2 - > generic . out . create_time ;
cl - > smb2 . out . access_time = cl2 - > generic . out . access_time ;
cl - > smb2 . out . write_time = cl2 - > generic . out . write_time ;
cl - > smb2 . out . change_time = cl2 - > generic . out . change_time ;
cl - > smb2 . out . alloc_size = cl2 - > generic . out . alloc_size ;
cl - > smb2 . out . size = cl2 - > generic . out . size ;
cl - > smb2 . out . file_attr = cl2 - > generic . out . file_attr ;
break ;
default :
break ;
}
return status ;
}
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 12:28:31 +04:00
/*
NTVFS close generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_close ( struct ntvfs_module_context * ntvfs ,
2006-03-10 17:31:17 +03:00
struct ntvfs_request * req ,
union smb_close * cl )
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 12:28:31 +04:00
{
union smb_close * cl2 ;
2008-05-27 10:43:36 +04:00
NTSTATUS status ;
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 12:28:31 +04:00
2005-01-27 10:08:20 +03:00
cl2 = talloc ( req , union smb_close ) ;
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 12:28:31 +04:00
if ( cl2 = = NULL ) {
return NT_STATUS_NO_MEMORY ;
}
2004-10-20 16:24:31 +04:00
switch ( cl - > generic . level ) {
2008-05-27 10:43:36 +04:00
case RAW_CLOSE_GENERIC :
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 12:28:31 +04:00
return NT_STATUS_INVALID_LEVEL ;
2008-05-27 10:43:36 +04:00
case RAW_CLOSE_CLOSE :
cl2 - > generic . level = RAW_CLOSE_GENERIC ;
cl2 - > generic . in . file = cl - > close . in . file ;
cl2 - > generic . in . write_time = cl - > close . in . write_time ;
cl2 - > generic . in . flags = 0 ;
break ;
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 12:28:31 +04:00
case RAW_CLOSE_SPLCLOSE :
2008-05-27 10:43:36 +04:00
cl2 - > generic . level = RAW_CLOSE_GENERIC ;
cl2 - > generic . in . file = cl - > splclose . in . file ;
2006-07-08 11:37:05 +04:00
cl2 - > generic . in . write_time = 0 ;
2008-05-27 10:43:36 +04:00
cl2 - > generic . in . flags = 0 ;
2006-05-20 21:20:34 +04:00
break ;
case RAW_CLOSE_SMB2 :
2008-05-27 10:43:36 +04:00
cl2 - > generic . level = RAW_CLOSE_GENERIC ;
cl2 - > generic . in . file = cl - > smb2 . in . file ;
2006-07-08 11:37:05 +04:00
cl2 - > generic . in . write_time = 0 ;
2008-05-27 10:43:36 +04:00
cl2 - > generic . in . flags = cl - > smb2 . in . flags ;
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 12:28:31 +04:00
break ;
}
2008-05-27 10:43:36 +04:00
status = ntvfs_map_async_setup ( ntvfs , req , cl , cl2 ,
( second_stage_t ) ntvfs_map_close_finish ) ;
NT_STATUS_NOT_OK_RETURN ( status ) ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > close_fn ( ntvfs , req , cl2 ) ;
2006-02-22 14:11:16 +03:00
2008-05-27 10:43:36 +04:00
return ntvfs_map_async_finish ( req , status ) ;
2003-08-13 05:53:07 +04:00
}
2006-07-17 15:17:32 +04:00
/*
NTVFS notify generic to any mapper
*/
static NTSTATUS ntvfs_map_notify_finish ( struct ntvfs_module_context * ntvfs ,
struct ntvfs_request * req ,
union smb_notify * nt ,
union smb_notify * nt2 ,
NTSTATUS status )
{
NT_STATUS_NOT_OK_RETURN ( status ) ;
switch ( nt - > nttrans . level ) {
case RAW_NOTIFY_SMB2 :
if ( nt2 - > nttrans . out . num_changes = = 0 ) {
return STATUS_NOTIFY_ENUM_DIR ;
}
nt - > smb2 . out . num_changes = nt2 - > nttrans . out . num_changes ;
nt - > smb2 . out . changes = talloc_steal ( req , nt2 - > nttrans . out . changes ) ;
break ;
default :
return NT_STATUS_INVALID_LEVEL ;
}
return status ;
}
/*
NTVFS notify generic to any mapper
*/
2008-04-02 06:53:27 +04:00
NTSTATUS ntvfs_map_notify ( struct ntvfs_module_context * ntvfs ,
2006-07-17 15:17:32 +04:00
struct ntvfs_request * req ,
union smb_notify * nt )
{
union smb_notify * nt2 ;
NTSTATUS status ;
nt2 = talloc ( req , union smb_notify ) ;
NT_STATUS_HAVE_NO_MEMORY ( nt2 ) ;
status = ntvfs_map_async_setup ( ntvfs , req , nt , nt2 ,
( second_stage_t ) ntvfs_map_notify_finish ) ;
NT_STATUS_NOT_OK_RETURN ( status ) ;
nt2 - > nttrans . level = RAW_NOTIFY_NTTRANS ;
switch ( nt - > nttrans . level ) {
case RAW_NOTIFY_NTTRANS :
status = NT_STATUS_INVALID_LEVEL ;
break ;
case RAW_NOTIFY_SMB2 :
nt2 - > nttrans . in . file . ntvfs = nt - > smb2 . in . file . ntvfs ;
nt2 - > nttrans . in . buffer_size = nt - > smb2 . in . buffer_size ;
nt2 - > nttrans . in . completion_filter = nt - > smb2 . in . completion_filter ;
nt2 - > nttrans . in . recursive = nt - > smb2 . in . recursive ;
2012-06-13 11:11:42 +04:00
status = ntvfs - > ops - > notify_fn ( ntvfs , req , nt2 ) ;
2006-07-17 15:17:32 +04:00
break ;
}
return ntvfs_map_async_finish ( req , status ) ;
}