#include "includes.h"
+extern struct current_user current_user;
extern userdom_struct current_user_info;
extern uint16 global_oplock_port;
extern uint16 global_smbpid;
static BOOL open_file(files_struct *fsp,connection_struct *conn,
const char *fname,SMB_STRUCT_STAT *psbuf,int flags,mode_t mode, uint32 desired_access)
{
- extern struct current_user current_user;
int accmode = (flags & O_ACCMODE);
int local_flags = flags;
fsp->dev = psbuf->st_dev;
fsp->vuid = current_user.vuid;
fsp->file_pid = global_smbpid;
- fsp->size = psbuf->st_size;
fsp->can_lock = True;
fsp->can_read = ((flags & O_WRONLY)==0);
fsp->can_write = ((flags & (O_WRONLY|O_RDWR))!=0);
fsp->is_directory = False;
fsp->is_stat = False;
fsp->directory_delete_on_close = False;
+ if (conn->aio_write_behind_list && is_in_path(fname, conn->aio_write_behind_list, conn->case_sensitive)) {
+ fsp->aio_write_behind = True;
+ }
+
string_set(&fsp->fsp_name,fname);
fsp->wcp = NULL; /* Write cache pointer. */
append does not mean the same thing under dos and unix */
switch (GET_OPEN_MODE(share_mode)) {
+ case DOS_OPEN_EXEC:
case DOS_OPEN_RDONLY:
flags = O_RDONLY;
if (desired_access == 0)
desired_access = FILE_READ_DATA|FILE_WRITE_DATA;
break;
case DOS_OPEN_RDWR:
- case DOS_OPEN_EXEC:
flags = O_RDWR;
if (desired_access == 0)
desired_access = FILE_READ_DATA|FILE_WRITE_DATA;
DEBUG(10,("open_file_shared : share_mode = %x\n", fsp->share_mode ));
if (Access) {
- (*Access) = open_mode;
+ (*Access) = (SET_DENY_MODE(deny_mode) | SET_OPEN_MODE(open_mode));
}
action = 0;
files_struct *open_directory(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf,
uint32 desired_access, int share_mode, int smb_ofun, int *action)
{
- extern struct current_user current_user;
BOOL got_stat = False;
files_struct *fsp = file_new(conn);
BOOL delete_on_close = GET_DELETE_ON_CLOSE_FLAG(share_mode);
fsp->mode = psbuf->st_mode;
fsp->inode = psbuf->st_ino;
fsp->dev = psbuf->st_dev;
- fsp->size = psbuf->st_size;
fsp->vuid = current_user.vuid;
fsp->file_pid = global_smbpid;
fsp->can_lock = True;
files_struct *open_file_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf)
{
- extern struct current_user current_user;
files_struct *fsp = NULL;
if (!VALID_STAT(*psbuf))
fsp->mode = psbuf->st_mode;
fsp->inode = psbuf->st_ino;
fsp->dev = psbuf->st_dev;
- fsp->size = psbuf->st_size;
fsp->vuid = current_user.vuid;
fsp->file_pid = global_smbpid;
fsp->can_lock = False;