From a9ec21cf219c3aef0388c252539f315d3e606a71 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Wed, 10 Jun 2009 10:37:57 -0700 Subject: 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 --- source3/smbd/vfs.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source3/smbd/vfs.c') 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; } /**************************************************************************** -- cgit