diff options
author | Tim Prouty <tprouty@samba.org> | 2009-06-16 12:01:13 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-06-17 20:11:53 -0700 |
commit | 4e3656b8d1d0bf8c0c4ade01332e7384ea890810 (patch) | |
tree | efcb240c8b0dbdd791e01dfe62a50f4cfdca47e5 /source3/smbd | |
parent | 5cfac1a1bd59712d7a771d3631e869c5d078a0f3 (diff) | |
download | samba-4e3656b8d1d0bf8c0c4ade01332e7384ea890810.tar.gz samba-4e3656b8d1d0bf8c0c4ade01332e7384ea890810.tar.bz2 samba-4e3656b8d1d0bf8c0c4ade01332e7384ea890810.zip |
s3: Change SMB_VFS_OPEN to take an smb_filename struct
This was a little messy because of all of the vfs modules I had to
touch. Most of them were pretty straight forward, but the streams
modules required a little attention to handle smb_filename. Since the
use of smb_filename enables the vfs modules to access the raw,
over-the-wire stream, a little bit of the handling that was being done
by split_ntfs_stream_name has now been shifted into the individual
stream modules. It may be a little more code, but overall it gives
more flexibility to the streams modules, while also allowing correct
stream handling.
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/filename.c | 5 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 16 | ||||
-rw-r--r-- | source3/smbd/open.c | 8 |
3 files changed, 22 insertions, 7 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 0f69ce4820..456caf590b 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -115,8 +115,6 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name, { struct smb_filename smb_fname_loc; - SMB_ASSERT(psbuf); - ZERO_STRUCT(smb_fname_loc); /* Setup the base_name/stream_name. */ @@ -124,7 +122,8 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name, smb_fname_loc.stream_name = CONST_DISCARD(char *, stream_name); /* Copy the psbuf if one was given. */ - smb_fname_loc.st = *psbuf; + if (psbuf) + smb_fname_loc.st = *psbuf; /* Let copy_smb_filename() do the heavy lifting. */ return copy_smb_filename(ctx, &smb_fname_loc, smb_fname_out); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index d2a052dd55..c4d0374e99 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -318,6 +318,22 @@ bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname) } /**************************************************************************** + Returns true if the filename's stream == "::$DATA" + ***************************************************************************/ +bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname) +{ + if (lp_posix_pathnames()) { + return false; + } + + if (!smb_fname->stream_name) { + return false; + } + + return StrCaseCmp(smb_fname->stream_name, "::$DATA") == 0; +} + +/**************************************************************************** Reply to an NT create and X call on a pipe ****************************************************************************/ diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 7b2fc19a6c..5d82738f6a 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -119,7 +119,7 @@ static NTSTATUS check_open_rights(struct connection_struct *conn, ****************************************************************************/ static NTSTATUS fd_open(struct connection_struct *conn, - const char *fname, + struct smb_filename *smb_fname, files_struct *fsp, int flags, mode_t mode) @@ -137,7 +137,7 @@ static NTSTATUS fd_open(struct connection_struct *conn, } #endif - fsp->fh->fd = SMB_VFS_OPEN(conn,fname,fsp,flags,mode); + fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, mode); if (fsp->fh->fd == -1) { status = map_nt_error_from_unix(errno); if (errno == EMFILE) { @@ -155,7 +155,7 @@ static NTSTATUS fd_open(struct connection_struct *conn, } DEBUG(10,("fd_open: name %s, flags = 0%o mode = 0%o, fd = %d. %s\n", - fname, flags, (int)mode, fsp->fh->fd, + smb_fname_str_dbg(smb_fname), flags, (int)mode, fsp->fh->fd, (fsp->fh->fd == -1) ? strerror(errno) : "" )); return status; @@ -422,7 +422,7 @@ static NTSTATUS open_file(files_struct *fsp, } /* Actually do the open */ - status = fd_open(conn, path, fsp, local_flags, unx_mode); + status = fd_open(conn, smb_fname, fsp, local_flags, unx_mode); if (!NT_STATUS_IS_OK(status)) { DEBUG(3,("Error opening file %s (%s) (local_flags=%d) " "(flags=%d)\n", smb_fname_str_dbg(smb_fname), |