diff options
author | Tim Prouty <tprouty@samba.org> | 2009-07-22 09:52:09 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-07-22 11:48:22 -0700 |
commit | 07d3b69b55c37f26ba6fa8b0c1c59e800325b435 (patch) | |
tree | ed540dbd3cdb8e89db4d717f35f1daf2dad6f18d /source3/smbd/statcache.c | |
parent | 83284e13f91f685b8dcccb9202e33fe64e6930b2 (diff) | |
download | samba-07d3b69b55c37f26ba6fa8b0c1c59e800325b435.tar.gz samba-07d3b69b55c37f26ba6fa8b0c1c59e800325b435.tar.bz2 samba-07d3b69b55c37f26ba6fa8b0c1c59e800325b435.zip |
s3: Change unix_convert to use an smb_filename struct internally
This allows SMB_VFS_[L]STAT to be called directly. Additionally, I
changed NTSTATUS result to be named status for consistency.
I also removed the stat_cache_add() from build_stream_path() because
stat_cache_lookup() is never actually called on a file with a stream.
There is no reason why the stat cache couldn't be consulted for
streams in the future.
Jeremy/Volker, please take a look at this one when you get a chance.
Diffstat (limited to 'source3/smbd/statcache.c')
-rw-r--r-- | source3/smbd/statcache.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index daed9f8225..da52cc05d4 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -175,6 +175,8 @@ bool stat_cache_lookup(connection_struct *conn, DATA_BLOB data_val; char *name; TALLOC_CTX *ctx = talloc_tos(); + struct smb_filename *smb_fname = NULL; + NTSTATUS status; *pp_dirpath = NULL; *pp_start = *pp_name; @@ -274,14 +276,25 @@ bool stat_cache_lookup(connection_struct *conn, "-> [%s]\n", chk_name, translated_path )); DO_PROFILE_INC(statcache_hits); - if (vfs_stat_smb_fname(conn, translated_path, pst) != 0) { + status = create_synthetic_smb_fname(talloc_tos(), translated_path, + NULL, NULL, &smb_fname); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(chk_name); + TALLOC_FREE(translated_path); + return false; + } + + if (SMB_VFS_STAT(conn, smb_fname) != 0) { /* Discard this entry - it doesn't exist in the filesystem. */ memcache_delete(smbd_memcache(), STAT_CACHE, data_blob_const(chk_name, strlen(chk_name))); TALLOC_FREE(chk_name); TALLOC_FREE(translated_path); + TALLOC_FREE(smb_fname); return False; } + *pst = smb_fname->st; + TALLOC_FREE(smb_fname); if (!sizechanged) { memcpy(*pp_name, translated_path, |