summaryrefslogtreecommitdiff
path: root/source3/modules/onefs_streams.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-02 09:27:44 -0700
committerTim Prouty <tprouty@samba.org>2009-07-06 15:38:36 -0700
commit258952aa85f2a68e2d2362522f6114c6a439f1e3 (patch)
tree696d8f4425cb6d82c95c0923ba1b0405d39a1f5e /source3/modules/onefs_streams.c
parent133e915a81510f543f6458f377857d4f1b680970 (diff)
downloadsamba-258952aa85f2a68e2d2362522f6114c6a439f1e3.tar.gz
samba-258952aa85f2a68e2d2362522f6114c6a439f1e3.tar.bz2
samba-258952aa85f2a68e2d2362522f6114c6a439f1e3.zip
s3: Plumb smb_filename through SMB_VFS_UNLINK
Diffstat (limited to 'source3/modules/onefs_streams.c')
-rw-r--r--source3/modules/onefs_streams.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c
index 8963037c22..c22fc711a0 100644
--- a/source3/modules/onefs_streams.c
+++ b/source3/modules/onefs_streams.c
@@ -462,38 +462,49 @@ int onefs_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
return ret;
}
-int onefs_unlink(vfs_handle_struct *handle, const char *path)
+int onefs_unlink(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
+ struct smb_filename *smb_fname_onefs = NULL;
int ret;
bool is_stream;
char *base = NULL;
char *stream = NULL;
int dir_fd, saved_errno;
- ret = onefs_is_stream(path, &base, &stream, &is_stream);
- if (ret) {
- return ret;
+ /* Not a stream. */
+ if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
}
- if (!is_stream) {
- return SMB_VFS_NEXT_UNLINK(handle, path);
+ status = onefs_stream_prep_smb_fname(talloc_tos(), smb_fname,
+ &smb_fname_onefs);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
}
- /* If it's the ::$DATA stream just unlink the base file name. */
- if (!stream) {
- return SMB_VFS_NEXT_UNLINK(handle, base);
+ /* Default stream (the ::$DATA was just stripped off). */
+ if (!is_ntfs_stream_smb_fname(smb_fname_onefs)) {
+ ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname_onefs);
+ goto out;
}
- dir_fd = get_stream_dir_fd(handle->conn, base, NULL);
+ dir_fd = get_stream_dir_fd(handle->conn, smb_fname_onefs->base_name,
+ NULL);
if (dir_fd < 0) {
- return -1;
+ ret = -1;
+ goto out;
}
- ret = enc_unlinkat(dir_fd, stream, ENC_DEFAULT, 0);
+ ret = enc_unlinkat(dir_fd, smb_fname_onefs->stream_name, ENC_DEFAULT,
+ 0);
saved_errno = errno;
close(dir_fd);
errno = saved_errno;
+ out:
+ TALLOC_FREE(smb_fname_onefs);
return ret;
}