summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/smbd/open.c10
-rw-r--r--source3/smbd/reply.c19
-rw-r--r--source3/smbd/trans2.c10
4 files changed, 22 insertions, 20 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c48cebce11..fe81bd2c97 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6589,7 +6589,8 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req,
uint32 access_mask,
uint32 share_access,
uint32 create_options);
-bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func,
+bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
+ int deny_mode, int open_func,
uint32 *paccess_mask,
uint32 *pshare_mode,
uint32 *pcreate_disposition,
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 7692c7c847..87cab1966b 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1199,7 +1199,8 @@ NTSTATUS fcb_or_dos_open(struct smb_request *req,
Open a file with a share mode - old openX method - map into NTCreate.
****************************************************************************/
-bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func,
+bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
+ int deny_mode, int open_func,
uint32 *paccess_mask,
uint32 *pshare_mode,
uint32 *pcreate_disposition,
@@ -1212,7 +1213,8 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
DEBUG(10,("map_open_params_to_ntcreate: fname = %s, deny_mode = 0x%x, "
"open_func = 0x%x\n",
- fname, (unsigned int)deny_mode, (unsigned int)open_func ));
+ smb_fname_str_dbg(smb_fname), (unsigned int)deny_mode,
+ (unsigned int)open_func ));
/* Create the NT compatible access_mask. */
switch (GET_OPENX_MODE(deny_mode)) {
@@ -1286,7 +1288,7 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
case DENY_DOS:
create_options |= NTCREATEX_OPTIONS_PRIVATE_DENY_DOS;
- if (is_executable(fname)) {
+ if (is_executable(smb_fname->base_name)) {
share_mode = FILE_SHARE_READ|FILE_SHARE_WRITE;
} else {
if (GET_OPENX_MODE(deny_mode) == DOS_OPEN_RDONLY) {
@@ -1311,7 +1313,7 @@ bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func
DEBUG(10,("map_open_params_to_ntcreate: file %s, access_mask = 0x%x, "
"share_mode = 0x%x, create_disposition = 0x%x, "
"create_options = 0x%x\n",
- fname,
+ smb_fname_str_dbg(smb_fname),
(unsigned int)access_mask,
(unsigned int)share_mode,
(unsigned int)create_disposition,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 46fdd4adde..5924c46cc1 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1760,10 +1760,10 @@ void reply_open(struct smb_request *req)
goto out;
}
- if (!map_open_params_to_ntcreate(
- smb_fname->base_name, deny_mode, OPENX_FILE_EXISTS_OPEN,
- &access_mask, &share_mode, &create_disposition,
- &create_options)) {
+ if (!map_open_params_to_ntcreate(smb_fname, deny_mode,
+ OPENX_FILE_EXISTS_OPEN, &access_mask,
+ &share_mode, &create_disposition,
+ &create_options)) {
reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
goto out;
}
@@ -1931,9 +1931,10 @@ void reply_open_and_X(struct smb_request *req)
goto out;
}
- if (!map_open_params_to_ntcreate(
- smb_fname->base_name, deny_mode, smb_ofun, &access_mask,
- &share_mode, &create_disposition, &create_options)) {
+ if (!map_open_params_to_ntcreate(smb_fname, deny_mode, smb_ofun,
+ &access_mask, &share_mode,
+ &create_disposition,
+ &create_options)) {
reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
goto out;
}
@@ -6659,8 +6660,8 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
if (!target_is_directory && count) {
new_create_disposition = FILE_OPEN;
} else {
- if (!map_open_params_to_ntcreate(smb_fname_dst_tmp->base_name,
- 0, ofun, NULL, NULL,
+ if (!map_open_params_to_ntcreate(smb_fname_dst_tmp, 0, ofun,
+ NULL, NULL,
&new_create_disposition,
NULL)) {
status = NT_STATUS_INVALID_PARAMETER;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index e2efed331d..9ce541aa63 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1046,12 +1046,10 @@ static void call_trans2open(connection_struct *conn,
goto out;
}
- if (!map_open_params_to_ntcreate(smb_fname->base_name, deny_mode,
- open_ofun,
- &access_mask,
- &share_mode,
- &create_disposition,
- &create_options)) {
+ if (!map_open_params_to_ntcreate(smb_fname, deny_mode, open_ofun,
+ &access_mask, &share_mode,
+ &create_disposition,
+ &create_options)) {
reply_doserror(req, ERRDOS, ERRbadaccess);
goto out;
}