s3: Plumb smb_filename through map_open_params_to_ntcreate
authorTim Prouty <tprouty@samba.org>
Tue, 21 Jul 2009 16:29:59 +0000 (09:29 -0700)
committerTim Prouty <tprouty@samba.org>
Tue, 21 Jul 2009 19:04:58 +0000 (12:04 -0700)
source3/include/proto.h
source3/smbd/open.c
source3/smbd/reply.c
source3/smbd/trans2.c

index c48cebce1156da374cef0d3151dbf826a33f4ea9..fe81bd2c97b652b4bed9e16ce7c732d19effeadd 100644 (file)
@@ -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,
index 7692c7c8471874288dd52dbc644f54da181a0b88..87cab1966b443451b7e38a590e67b45f3fbc83a8 100644 (file)
@@ -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,
index 46fdd4adde79119d5d8dedacbbde818e850fed37..5924c46cc1f633fc60407280714a71e768b5f7bf 100644 (file)
@@ -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;
index e2efed331d621ec5b8a636811b68adbd4c043896..9ce541aa63870972186c47782d7a1999cfa69837 100644 (file)
@@ -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;
        }