summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-06-10 10:37:57 -0700
committerTim Prouty <tprouty@samba.org>2009-06-10 13:13:27 -0700
commita9ec21cf219c3aef0388c252539f315d3e606a71 (patch)
tree6e0072fabc7d1b33f7c824c850d7a8f3a39dc425 /source3/smbd/vfs.c
parentbddd7ad3dcc4a74fb61e09a2dd6fb7034c820046 (diff)
downloadsamba-a9ec21cf219c3aef0388c252539f315d3e606a71.tar.gz
samba-a9ec21cf219c3aef0388c252539f315d3e606a71.tar.bz2
samba-a9ec21cf219c3aef0388c252539f315d3e606a71.zip
s3: Prepare the first set of SMB_VFS_CREATE_FILE callers to take an smb_filename struct
Some of the callers required minimal changes, while others (copy_internals) required significant changes. The task is simplified a little bit because we are able to do operations and checks on the base_name when a stream isn't used. This patch should cause no functional changes. Volker, Jeremy: Please check
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r--source3/smbd/vfs.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 873e65e4a4..385454e587 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -382,18 +382,28 @@ bool vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT
Check if a file exists in the vfs.
********************************************************************/
-bool vfs_file_exist(connection_struct *conn, const char *fname,SMB_STRUCT_STAT *sbuf)
+NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname)
{
- SMB_STRUCT_STAT st;
+ char *fname = NULL;
+ NTSTATUS status;
- if (!sbuf)
- sbuf = &st;
+ status = get_full_smb_filename(talloc_tos(), smb_fname, &fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
- ZERO_STRUCTP(sbuf);
+ status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ if (SMB_VFS_STAT(conn, fname, &smb_fname->st) == -1) {
+ goto out;
+ }
- if (SMB_VFS_STAT(conn,fname,sbuf) == -1)
- return False;
- return(S_ISREG(sbuf->st_ex_mode));
+ /* Only return OK if stat was successful and S_ISREG */
+ if (S_ISREG(smb_fname->st.st_ex_mode)) {
+ status = NT_STATUS_OK;
+ }
+ out:
+ TALLOC_FREE(fname);
+ return status;
}
/****************************************************************************