s3: Add new "is_dos_path" argument to SMB_VFS_CREATE_FILE
authorTim Prouty <tprouty@samba.org>
Thu, 20 Nov 2008 01:55:28 +0000 (17:55 -0800)
committerTim Prouty <tprouty@samba.org>
Thu, 4 Dec 2008 01:50:37 +0000 (17:50 -0800)
Now unix paths can be differentiated from windows paths so the
underlying create_file implementations can convert paths correctly.

source3/include/proto.h
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_default.c
source3/rpc_server/srv_srvsvc_nt.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/reply.c
source3/smbd/trans2.c

index 05ef17b51cac11522366deef6fef2d0dedc4450a..258139b877807512dbb053804f8aa8816087e407 100644 (file)
@@ -8154,6 +8154,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
                             uint16_t root_dir_fid,
                             const char *fname,
+                            bool is_dos_path,
                             uint32_t access_mask,
                             uint32_t share_access,
                             uint32_t create_disposition,
index 03b4b8e70623c3e7faa3d8d02261e17528e90ed0..5f6851a7bcc031233573529afd7af6ac52e2cbf0 100644 (file)
@@ -313,6 +313,7 @@ struct vfs_ops {
                                        struct smb_request *req,
                                        uint16_t root_dir_fid,
                                        const char *fname,
+                                       bool is_dos_path,
                                        uint32_t access_mask,
                                        uint32_t share_access,
                                        uint32_t create_disposition,
index 5c57e92899876b7476ef6f04c514c0c1c60f085d..97107f3f606649d71c6c07cefe8c151b0e3787db 100644 (file)
@@ -48,7 +48,7 @@
 
 /* File operations */
 #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((conn)->vfs.ops.create_file)((conn)->vfs.handles.create_file, (req), (root_dir_fid), (fname), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
+#define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, fname, is_dos_path, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((conn)->vfs.ops.create_file)((conn)->vfs.handles.create_file, (req), (root_dir_fid), (fname), (is_dos_path), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
 #define SMB_VFS_CLOSE(fsp) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp)))
 #define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.vfs_read((fsp)->conn->vfs.handles.vfs_read, (fsp), (data), (n)))
 #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off)))
 
 /* File operations */
 #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_OPAQUE_CREATE_FILE(conn, req, root_dir_fid, fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((conn)->vfs_opaque.ops.create_file)((conn)->vfs_opaque.handles.create_file, (req), (root_dir_fid), (fname), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
+#define SMB_VFS_OPAQUE_CREATE_FILE(conn, req, root_dir_fid, fname, is_dos_path, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((conn)->vfs_opaque.ops.create_file)((conn)->vfs_opaque.handles.create_file, (req), (root_dir_fid), (fname), (is_dos_path), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
 #define SMB_VFS_OPAQUE_CLOSE(fsp) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp)))
 #define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.vfs_read((fsp)->conn->vfs_opaque.handles.vfs_read, (fsp), (data), (n)))
 #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off)))
 
 /* File operations */
 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((handle)->vfs_next.ops.create_file)((handle)->vfs_next.handles.create_file, (req), (root_dir_fid), (fname), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
+#define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, fname, is_dos_path, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo, psbuf) (((handle)->vfs_next.ops.create_file)((handle)->vfs_next.handles.create_file, (req), (root_dir_fid), (fname), (is_dos_path), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo), (psbuf)))
 #define SMB_VFS_NEXT_CLOSE(handle, fsp) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp)))
 #define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.vfs_read((handle)->vfs_next.handles.vfs_read, (fsp), (data), (n)))
 #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off)))
index bca06dfaf7a53a06e1587f247d4ae1146b0fdae7..fde899d1afdf3d4b45aa2ac118cf53581110c858 100644 (file)
@@ -212,6 +212,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
                                    struct smb_request *req,
                                    uint16_t root_dir_fid,
                                    const char *fname,
+                                   bool is_dos_path,
                                    uint32_t access_mask,
                                    uint32_t share_access,
                                    uint32_t create_disposition,
@@ -226,7 +227,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
                                    SMB_STRUCT_STAT *psbuf)
 {
        return create_file_default(handle->conn, req, root_dir_fid, fname,
-                                  access_mask, share_access,
+                                  is_dos_path, access_mask, share_access,
                                   create_disposition, create_options,
                                   file_attributes, oplock_request,
                                   allocation_size, sd, ea_list, result, pinfo,
index b1a31f17611df71b21412a9cc240f7ad32eb543d..0febfbca0632b9310db786de6bba5ea21946438c 100644 (file)
@@ -2053,6 +2053,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
                NULL,                                   /* req */
                0,                                      /* root_dir_fid */
                r->in.file,                             /* fname */
+               true,                                   /* is_dos_path */
                FILE_READ_ATTRIBUTES,                   /* access_mask */
                FILE_SHARE_READ|FILE_SHARE_WRITE,       /* share_access */
                FILE_OPEN,                              /* create_disposition*/
@@ -2167,6 +2168,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
                NULL,                                   /* req */
                0,                                      /* root_dir_fid */
                r->in.file,                             /* fname */
+               true,                                   /* is_dos_path */
                FILE_WRITE_ATTRIBUTES,                  /* access_mask */
                FILE_SHARE_READ|FILE_SHARE_WRITE,       /* share_access */
                FILE_OPEN,                              /* create_disposition*/
index f2c6eaccca31baf734ed37aa584e806e8913687b..b66aba5aac444f1232ebe72988cab8e4a422861e 100644 (file)
@@ -479,6 +479,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
                req,                                    /* req */
                root_dir_fid,                           /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
                create_disposition,                     /* create_disposition*/
@@ -950,6 +951,7 @@ static void call_nt_transact_create(connection_struct *conn,
                req,                                    /* req */
                root_dir_fid,                           /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
                create_disposition,                     /* create_disposition*/
index 924b6c5905ddc22c4814b66fe0c7889b9aef4222..d8f5548883f0a9e81c00fa1b081e00bdb57f1c36 100644 (file)
@@ -3086,6 +3086,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
                             uint16_t root_dir_fid,
                             const char *fname,
+                            bool is_dos_path,
                             uint32_t access_mask,
                             uint32_t share_access,
                             uint32_t create_disposition,
@@ -3111,7 +3112,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                  "create_disposition = 0x%x create_options = 0x%x "
                  "oplock_request = 0x%x "
                  "root_dir_fid = 0x%x, ea_list = 0x%p, sd = 0x%p, "
-                 "fname = %s\n",
+                 "is_dos_path = %s, fname = %s\n",
                  (unsigned int)access_mask,
                  (unsigned int)file_attributes,
                  (unsigned int)share_access,
@@ -3119,7 +3120,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                  (unsigned int)create_options,
                  (unsigned int)oplock_request,
                  (unsigned int)root_dir_fid,
-                 ea_list, sd, fname));
+                 ea_list, sd, fname, is_dos_path ? "true" : "false"));
 
        /*
         * Get the file name.
@@ -3275,7 +3276,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
        }
 
-       {
+       if (is_dos_path) {
                char *converted_fname;
 
                SET_STAT_INVALID(sbuf);
index dfd4b47608ad564234b5cebd133849c70393b0e9..80292636a67ff6c212e0ef1893f537a27c0aa8a7 100644 (file)
@@ -1635,6 +1635,7 @@ void reply_open(struct smb_request *req)
                req,                                    /* req */
                0,                                      /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
                create_disposition,                     /* create_disposition*/
@@ -1780,6 +1781,7 @@ void reply_open_and_X(struct smb_request *req)
                req,                                    /* req */
                0,                                      /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
                create_disposition,                     /* create_disposition*/
@@ -1979,6 +1981,7 @@ void reply_mknew(struct smb_request *req)
                req,                                    /* req */
                0,                                      /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
                create_disposition,                     /* create_disposition*/
index 4669e883fdc422923743a9118d1df2ae58f33234..9ba6d198c4cd8f96ecde0f7856442ade1bb25c1f 100644 (file)
@@ -1011,6 +1011,7 @@ static void call_trans2open(connection_struct *conn,
                req,                                    /* req */
                0,                                      /* root_dir_fid */
                fname,                                  /* fname */
+               true,                                   /* is_dos_path */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
                create_disposition,                     /* create_disposition*/