summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-06-22 15:26:56 -0700
committerTim Prouty <tprouty@samba.org>2009-06-24 21:15:25 -0700
commite129384d7c1df664e447186673dd107e190e2894 (patch)
tree166c08e9d2ee0bbb8a88fb2ad76ed226a62f83dc /source3/include
parent36c10191750c845a2a7cd6cc62149b1095c0b651 (diff)
downloadsamba-e129384d7c1df664e447186673dd107e190e2894.tar.gz
samba-e129384d7c1df664e447186673dd107e190e2894.tar.bz2
samba-e129384d7c1df664e447186673dd107e190e2894.zip
s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT
This patch introduces two new temporary helper functions vfs_stat_smb_fname and vfs_lstat_smb_fname. They basically allowed me to call the new smb_filename version of stat, while avoiding plumbing it through callers that are still too inconvenient. As the conversion moves along, I will be able to remove callers of this, with the goal being to remove all callers. There was also a bug in create_synthetic_smb_fname_split (also a temporary utility function) that caused it to incorrectly handle filenames with ':'s in them when in posix mode. This is now fixed.
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/proto.h21
-rw-r--r--source3/include/vfs.h6
-rw-r--r--source3/include/vfs_macros.h12
3 files changed, 21 insertions, 18 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ffd2858594..d55d6c1976 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3508,7 +3508,6 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
/* The following definitions come from modules/vfs_default.c */
-int vfswrap_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
NTSTATUS vfs_default_init(void);
@@ -6336,11 +6335,13 @@ NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
/* The following definitions come from smbd/file_access.c */
bool can_access_file_acl(struct connection_struct *conn,
- const char * fname,
- uint32_t access_mask);
+ const struct smb_filename *smb_fname,
+ uint32_t access_mask);
bool can_delete_file_in_directory(connection_struct *conn,
- const struct smb_filename *smb_fname);
-bool can_access_file_data(connection_struct *conn, const char *fname, const SMB_STRUCT_STAT *psbuf, uint32 access_mask);
+ struct smb_filename *smb_fname);
+bool can_access_file_data(connection_struct *conn,
+ const struct smb_filename *smb_fname,
+ uint32 access_mask);
bool can_write_to_file(connection_struct *conn, const char *fname, const SMB_STRUCT_STAT *psbuf);
bool directory_has_default_acl(connection_struct *conn, const char *fname);
@@ -6366,12 +6367,16 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_f
char **full_name);
NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
const char *stream_name,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct smb_filename **smb_fname_out);
NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
const char *fname,
- SMB_STRUCT_STAT *psbuf,
+ const SMB_STRUCT_STAT *psbuf,
struct smb_filename **smb_fname_out);
+int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
+ SMB_STRUCT_STAT *psbuf);
+int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
+ SMB_STRUCT_STAT *psbuf);
const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
const struct smb_filename *smb_fname_in,
@@ -7137,8 +7142,6 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
bool smbd_vfs_init(connection_struct *conn);
-bool vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_STAT *st);
-bool vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT *sbuf);
NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
ssize_t vfs_pread_data(files_struct *fsp, char *buf,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 53a4798d37..2a0c5ec805 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -118,7 +118,7 @@
/* Leave at 25 - not yet released. Add locking calls. -- zkirsch. */
/* Leave at 25 - not yet released. Add strict locking calls. -- drichards. */
/* Changed to version 26 - Plumb struct smb_filename to SMB_VFS_CREATE_FILE,
- SMB_VFS_OPEN. */
+ SMB_VFS_OPEN, SMB_VFS_STAT, SMB_VFS_LSTAT. */
#define SMB_VFS_INTERFACE_VERSION 26
@@ -359,9 +359,9 @@ struct vfs_ops {
ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count);
int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
- int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
+ int (*stat)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
- int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+ int (*lstat)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
int (*unlink)(struct vfs_handle_struct *handle, const char *path);
int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index d888361dc4..b0a0737aac 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -60,9 +60,9 @@
#define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) ((tofsp)->conn->vfs.ops.recvfile((tofsp)->conn->vfs.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
#define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new)))
#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp)))
-#define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_STAT(conn, smb_fname) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (smb_fname)))
#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_LSTAT(conn, smb_fname) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (smb_fname)))
#define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs.ops.get_alloc_size((conn)->vfs.handles.get_alloc_size, (fsp), (sbuf)))
#define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
#define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
@@ -195,9 +195,9 @@
#define SMB_VFS_OPAQUE_RECVFILE(fromfd, tofsp, offset, count) ((tofsp)->conn->vfs_opaque.ops.recvfile((tofsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
#define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new)))
#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp)))
-#define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_OPAQUE_STAT(conn, smb_fname) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (smb_fname)))
#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_OPAQUE_LSTAT(conn, smb_fname) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (smb_fname)))
#define SMB_VFS_OPAQUE_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_opaque.ops.get_alloc_size((conn)->vfs_opaque.handles.get_alloc_size, (fsp), (sbuf)))
#define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
#define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
@@ -331,9 +331,9 @@
#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
#define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new)))
#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp)))
-#define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_NEXT_STAT(handle, smb_fname) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (smb_fname)))
#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_NEXT_LSTAT(handle, smb_fname) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (smb_fname)))
#define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_next.ops.get_alloc_size((conn)->vfs_next.handles.get_alloc_size, (fsp), (sbuf)))
#define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
#define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))