summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/printing/nt_printing.c78
-rw-r--r--source3/smbd/nttrans.c54
-rw-r--r--source3/smbd/open.c26
-rw-r--r--source3/smbd/posix_acls.c29
-rw-r--r--source3/smbd/reply.c151
-rw-r--r--source3/smbd/trans2.c159
6 files changed, 330 insertions, 167 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 244b3aee03e..0c54c6452ab 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1344,14 +1344,24 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
goto error_exit;
}
- status = open_file_ntcreate(conn, NULL, filepath, &stat_buf,
- FILE_GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- INTERNAL_OPEN_ONLY,
- NULL, &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ filepath, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_READ, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &stat_buf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
/* Old file not found, so by definition new file is in fact newer */
@@ -1385,14 +1395,24 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
goto error_exit;
}
- status = open_file_ntcreate(conn, NULL, filepath, &stat_buf,
- FILE_GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- INTERNAL_OPEN_ONLY,
- NULL, &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ filepath, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_READ, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &stat_buf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
/* New file not found, this shouldn't occur if the caller did its job */
@@ -1528,14 +1548,24 @@ static uint32 get_correct_cversion(struct pipes_struct *p,
goto error_exit;
}
- status = open_file_ntcreate(conn, NULL, driverpath, &st,
- FILE_GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- INTERNAL_OPEN_ONLY,
- NULL, &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ driverpath, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_READ, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &st); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3,("get_correct_cversion: Can't open file [%s], errno = %d\n",
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index b66aba5aac4..a7b2cb6c312 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1186,27 +1186,49 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
DEBUG(10,("copy_internals: doing file copy %s to %s\n",
oldname, newname));
- status = open_file_ntcreate(conn, req, oldname, &sbuf1,
- FILE_READ_DATA, /* Read-only. */
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN,
- 0, /* No create options. */
- FILE_ATTRIBUTE_NORMAL,
- NO_OPLOCK,
- &info, &fsp1);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ oldname, /* fname */
+ false, /* is_dos_path */
+ FILE_READ_DATA, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ NO_OPLOCK, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp1, /* result */
+ &info, /* pinfo */
+ &sbuf1); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- status = open_file_ntcreate(conn, req, newname, &sbuf2,
- FILE_WRITE_DATA, /* Read-only. */
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_CREATE,
- 0, /* No create options. */
- fattr,
- NO_OPLOCK,
- &info, &fsp2);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ newname, /* fname */
+ false, /* is_dos_path */
+ FILE_WRITE_DATA, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ FILE_CREATE, /* create_disposition*/
+ 0, /* create_options */
+ fattr, /* file_attributes */
+ NO_OPLOCK, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp2, /* result */
+ &info, /* pinfo */
+ &sbuf2); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
close_file(NULL, fsp1, ERROR_CLOSE);
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 989024f553d..62d4827bb25 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2493,14 +2493,24 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, cons
SET_STAT_INVALID(sbuf);
- status = open_directory(conn, req, directory, &sbuf,
- FILE_READ_ATTRIBUTES, /* Just a stat open */
- FILE_SHARE_NONE, /* Ignored for stat opens */
- FILE_CREATE,
- 0,
- FILE_ATTRIBUTE_DIRECTORY,
- NULL,
- &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ directory, /* fname */
+ false, /* is_dos_path */
+ FILE_READ_ATTRIBUTES, /* access_mask */
+ FILE_SHARE_NONE, /* share_access */
+ FILE_CREATE, /* create_disposition*/
+ FILE_DIRECTORY_FILE, /* create_options */
+ FILE_ATTRIBUTE_DIRECTORY, /* file_attributes */
+ 0, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &sbuf); /* psbuf */
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 97fd3b2bbe9..78a5d548c26 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3248,17 +3248,24 @@ NTSTATUS append_parent_acl(files_struct *fsp,
return NT_STATUS_NO_MEMORY;
}
- status = open_directory(fsp->conn,
- NULL,
- parent_name,
- &sbuf,
- FILE_READ_ATTRIBUTES, /* Just a stat open */
- FILE_SHARE_NONE, /* Ignored for stat opens */
- FILE_OPEN,
- 0,
- INTERNAL_OPEN_ONLY,
- &info,
- &parent_fsp);
+ status = SMB_VFS_CREATE_FILE(
+ fsp->conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ parent_name, /* fname */
+ false, /* is_dos_path */
+ FILE_READ_ATTRIBUTES, /* access_mask */
+ FILE_SHARE_NONE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ FILE_DIRECTORY_FILE, /* create_options */
+ 0, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &parent_fsp, /* result */
+ &info, /* pinfo */
+ &sbuf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
return status;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2465e73a18c..728753bc3b7 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2123,14 +2123,24 @@ void reply_ctemp(struct smb_request *req)
SMB_VFS_STAT(conn,fname,&sbuf);
/* We should fail if file does not exist. */
- status = open_file_ntcreate(conn, req, fname, &sbuf,
- FILE_GENERIC_READ | FILE_GENERIC_WRITE,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN,
- 0,
- fattr,
- oplock_request,
- NULL, &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ fattr, /* file_attributes */
+ oplock_request, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &sbuf); /* psbuf */
/* close fd from smb_mkstemp() */
close(tmpfd);
@@ -5631,6 +5641,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
struct smb_Dir *dir_hnd = NULL;
const char *dname;
long offset = 0;
+ int create_options = 0;
ZERO_STRUCT(sbuf1);
ZERO_STRUCT(sbuf2);
@@ -5744,17 +5755,29 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
ZERO_STRUCT(sbuf1);
SMB_VFS_STAT(conn, directory, &sbuf1);
- status = S_ISDIR(sbuf1.st_mode) ?
- open_directory(conn, req, directory, &sbuf1,
- access_mask,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0, 0, NULL,
- &fsp)
- : open_file_ntcreate(conn, req, directory, &sbuf1,
- access_mask,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0, 0, 0, NULL,
- &fsp);
+ if (S_ISDIR(sbuf1.st_mode)) {
+ create_options |= FILE_DIRECTORY_FILE;
+ }
+
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ directory, /* fname */
+ false, /* is_dos_path */
+ access_mask, /* access_mask */
+ (FILE_SHARE_READ | /* share_access */
+ FILE_SHARE_WRITE),
+ FILE_OPEN, /* create_disposition*/
+ create_options, /* create_options */
+ 0, /* file_attributes */
+ 0, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &sbuf1); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not open rename source %s: %s\n",
@@ -5848,20 +5871,34 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
ZERO_STRUCT(sbuf1);
SMB_VFS_STAT(conn, fname, &sbuf1);
- status = S_ISDIR(sbuf1.st_mode) ?
- open_directory(conn, req, fname, &sbuf1,
- access_mask,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0, 0, NULL,
- &fsp)
- : open_file_ntcreate(conn, req, fname, &sbuf1,
- access_mask,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN, 0, 0, 0, NULL,
- &fsp);
+ create_options = 0;
+
+ if (S_ISDIR(sbuf1.st_mode)) {
+ create_options |= FILE_DIRECTORY_FILE;
+ }
+
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ access_mask, /* access_mask */
+ (FILE_SHARE_READ | /* share_access */
+ FILE_SHARE_WRITE),
+ FILE_OPEN, /* create_disposition*/
+ create_options, /* create_options */
+ 0, /* file_attributes */
+ 0, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ NULL, /* pinfo */
+ &sbuf1); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(3,("rename_internals: open_file_ntcreate "
+ DEBUG(3,("rename_internals: SMB_VFS_CREATE_FILE "
"returned %s rename %s -> %s\n",
nt_errstr(status), directory, newname));
break;
@@ -6052,14 +6089,24 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
}
}
- status = open_file_ntcreate(conn, NULL, src, &src_sbuf,
- FILE_GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- INTERNAL_OPEN_ONLY,
- NULL, &fsp1);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ src, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_READ, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp1, /* result */
+ NULL, /* pinfo */
+ &src_sbuf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(dest);
@@ -6071,14 +6118,24 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
ZERO_STRUCTP(&sbuf2);
}
- status = open_file_ntcreate(conn, NULL, dest, &sbuf2,
- FILE_GENERIC_WRITE,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- new_create_disposition,
- 0,
- dosattrs,
- INTERNAL_OPEN_ONLY,
- NULL, &fsp2);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ NULL, /* req */
+ 0, /* root_dir_fid */
+ dest, /* fname */
+ false, /* is_dos_path */
+ FILE_GENERIC_WRITE, /* access_mask */
+ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
+ new_create_disposition, /* create_disposition*/
+ 0, /* create_options */
+ dosattrs, /* file_attributes */
+ INTERNAL_OPEN_ONLY, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp2, /* result */
+ NULL, /* pinfo */
+ &sbuf2); /* psbuf */
TALLOC_FREE(dest);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 9ba6d198c4c..b9a04e9b4f6 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -5059,15 +5059,26 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
return NT_STATUS_OK;
}
- status = open_file_ntcreate(conn, req, fname, psbuf,
- FILE_WRITE_ATTRIBUTES,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- FORCE_OPLOCK_BREAK_TO_NONE,
- NULL, &new_fsp);
-
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ FILE_WRITE_ATTRIBUTES, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ FORCE_OPLOCK_BREAK_TO_NONE, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &new_fsp, /* result */
+ NULL, /* pinfo */
+ psbuf); /* psbuf */
+
if (!NT_STATUS_IS_OK(status)) {
/* NB. We check for open_was_deferred in the caller. */
return status;
@@ -5828,14 +5839,25 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
/* Pathname or stat or directory file. */
- status = open_file_ntcreate(conn, req, fname, psbuf,
- FILE_WRITE_DATA,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN,
- 0,
- FILE_ATTRIBUTE_NORMAL,
- FORCE_OPLOCK_BREAK_TO_NONE,
- NULL, &new_fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ FILE_WRITE_DATA, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ FILE_OPEN, /* create_disposition*/
+ 0, /* create_options */
+ FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ FORCE_OPLOCK_BREAK_TO_NONE, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &new_fsp, /* result */
+ NULL, /* pinfo */
+ psbuf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
/* NB. We check for open_was_deferred in the caller. */
@@ -6259,16 +6281,24 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
DEBUG(10,("smb_posix_mkdir: file %s, mode 0%o\n",
fname, (unsigned int)unixmode ));
- status = open_directory(conn, req,
- fname,
- psbuf,
- FILE_READ_ATTRIBUTES, /* Just a stat open */
- FILE_SHARE_NONE, /* Ignored for stat opens */
- FILE_CREATE,
- 0,
- mod_unixmode,
- &info,
- &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ FILE_READ_ATTRIBUTES, /* access_mask */
+ FILE_SHARE_NONE, /* share_access */
+ FILE_CREATE, /* create_disposition*/
+ FILE_DIRECTORY_FILE, /* create_options */
+ mod_unixmode, /* file_attributes */
+ 0, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ &info, /* pinfo */
+ psbuf); /* psbuf */
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
@@ -6425,17 +6455,25 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
(unsigned int)wire_open_mode,
(unsigned int)unixmode ));
- status = open_file_ntcreate(conn, req,
- fname,
- psbuf,
- access_mask,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- create_disp,
- 0, /* no create options yet. */
- mod_unixmode,
- oplock_request,
- &info,
- &fsp);
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ access_mask, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ create_disp, /* create_disposition*/
+ 0, /* create_options */
+ mod_unixmode, /* file_attributes */
+ oplock_request, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ &info, /* pinfo */
+ psbuf); /* psbuf */
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -6520,6 +6558,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
uint16 flags = 0;
char del = 1;
int info = 0;
+ int create_options = 0;
int i;
struct share_mode_lock *lck = NULL;
@@ -6543,31 +6582,29 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
fname));
if (VALID_STAT_OF_DIR(*psbuf)) {
- status = open_directory(conn, req,
- fname,
- psbuf,
- DELETE_ACCESS,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN,
- 0,
- FILE_FLAG_POSIX_SEMANTICS|0777,
- &info,
- &fsp);
- } else {
-
- status = open_file_ntcreate(conn, req,
- fname,
- psbuf,
- DELETE_ACCESS,
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- FILE_OPEN,
- 0,
- FILE_FLAG_POSIX_SEMANTICS|0777,
- 0, /* No oplock, but break existing ones. */
- &info,
- &fsp);
+ create_options |= FILE_DIRECTORY_FILE;
}
+ status = SMB_VFS_CREATE_FILE(
+ conn, /* conn */
+ req, /* req */
+ 0, /* root_dir_fid */
+ fname, /* fname */
+ false, /* is_dos_path */
+ DELETE_ACCESS, /* access_mask */
+ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */
+ FILE_SHARE_DELETE),
+ FILE_OPEN, /* create_disposition*/
+ create_options, /* create_options */
+ FILE_FLAG_POSIX_SEMANTICS|0777, /* file_attributes */
+ 0, /* oplock_request */
+ 0, /* allocation_size */
+ NULL, /* sd */
+ NULL, /* ea_list */
+ &fsp, /* result */
+ &info, /* pinfo */
+ psbuf); /* psbuf */
+
if (!NT_STATUS_IS_OK(status)) {
return status;
}