diff options
author | Aravind Srinivasan <aravind.srinivasan@isilon.com> | 2009-08-26 14:56:09 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-08-28 16:38:57 -0700 |
commit | e046b382f24f507a19bfb020b145ea2ec8acafcb (patch) | |
tree | 867511a82c4772ee8f325c48ed1ec3f0b5e5d093 /source3/smbd/vfs.c | |
parent | 77e2403f1314a28722f0fb21f6682320b2e9935d (diff) | |
download | samba-e046b382f24f507a19bfb020b145ea2ec8acafcb.tar.gz samba-e046b382f24f507a19bfb020b145ea2ec8acafcb.tar.xz samba-e046b382f24f507a19bfb020b145ea2ec8acafcb.zip |
s3: Add a new VFS op called SMB_VFS_TRANSLATE_NAME
This vop is designed to work in tandem with SMB_VFS_READDIR to allow
vfs modules to make modifications to arbitrary filenames before
they're consumed by callers. Subsequently the core directory
enumeration code in smbd is now changed to free the memory that may be
allocated in a module. This vop enables the new version of catia in
the following patch.
Signed-off-by: Tim Prouty <tprouty@samba.org>
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r-- | source3/smbd/vfs.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 5425c55198..42ff8b19cd 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -662,7 +662,8 @@ SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf) { SMB_STRUCT_DIRENT *ptr= NULL; - char *dname; + char *dname = NULL; + NTSTATUS result; if (!p) return(NULL); @@ -671,7 +672,16 @@ char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf) if (!ptr) return(NULL); - dname = ptr->d_name; + dname = talloc_strdup(talloc_tos(), ptr->d_name); + if (dname == NULL) { + errno = ENOMEM; + return NULL; + } + result = SMB_VFS_TRANSLATE_NAME(conn, &dname); + if (!NT_STATUS_IS_OK(result)) { + TALLOC_FREE(dname); + return NULL; + } #ifdef NEXT2 if (telldir(p) < 0) @@ -1495,6 +1505,13 @@ void smb_vfs_call_strict_unlock(struct vfs_handle_struct *handle, handle->fns->strict_unlock(handle, fsp, plock); } +NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle, + char **mapped_name) +{ + VFS_FIND(translate_name); + return handle->fns->translate_name(handle, mapped_name); +} + NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 security_info, |