summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-06 15:44:09 -0700
committerTim Prouty <tprouty@samba.org>2009-07-07 21:33:48 -0700
commitdad913118344922139401ee5afaec8f3e68e05dd (patch)
treea41532995bb4a6cd759108d26b86c35603a96211 /source3/modules
parent7ca59ffe5a6608ac865e6fe403b17638af09595a (diff)
downloadsamba-dad913118344922139401ee5afaec8f3e68e05dd.tar.gz
samba-dad913118344922139401ee5afaec8f3e68e05dd.tar.bz2
samba-dad913118344922139401ee5afaec8f3e68e05dd.zip
s3 onefs: Fix a few bugs from the smb_filename migration
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/onefs.h6
-rw-r--r--source3/modules/onefs_streams.c10
-rw-r--r--source3/modules/vfs_onefs_shadow_copy.c68
3 files changed, 35 insertions, 49 deletions
diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h
index 88ba5a93f6..e0e463778c 100644
--- a/source3/modules/onefs.h
+++ b/source3/modules/onefs.h
@@ -72,7 +72,8 @@ int onefs_fstat(vfs_handle_struct *handle, struct files_struct *fsp,
int onefs_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname);
-int onefs_unlink(vfs_handle_struct *handle, const char *path);
+int onefs_unlink(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname);
NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
@@ -81,7 +82,8 @@ NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
unsigned int *num_streams,
struct stream_struct **streams);
-int onefs_vtimes_streams(vfs_handle_struct *handle, const char *fname,
+int onefs_vtimes_streams(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
int flags, struct timespec times[3]);
NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c
index 91917eef44..d33d9f30a2 100644
--- a/source3/modules/onefs_streams.c
+++ b/source3/modules/onefs_streams.c
@@ -463,14 +463,12 @@ int onefs_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
}
int onefs_unlink(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+ 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;
+ NTSTATUS status;
/* Not a stream. */
if (!is_ntfs_stream_smb_fname(smb_fname)) {
@@ -520,10 +518,6 @@ int onefs_vtimes_streams(vfs_handle_struct *handle,
START_PROFILE(syscall_ntimes);
- ret = onefs_is_stream(fname, &base, &stream, &is_stream);
- if (ret)
- return ret;
-
if (!is_ntfs_stream_smb_fname(smb_fname)) {
ret = vtimes(smb_fname->base_name, times, flags);
return ret;
diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c
index 651e20a875..112ef30749 100644
--- a/source3/modules/vfs_onefs_shadow_copy.c
+++ b/source3/modules/vfs_onefs_shadow_copy.c
@@ -143,6 +143,9 @@ onefs_shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
return ret; \
} while (0) \
+/*
+ * XXX: Convert osc_canonicalize_path to use talloc instead of malloc.
+ */
#define SHADOW_NEXT_SMB_FNAME(op, args, rtype) do { \
char *smb_base_name_tmp = NULL; \
char *cpath = NULL; \
@@ -161,37 +164,6 @@ onefs_shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
return ret; \
} while (0) \
-
-/*
- * XXX: Convert osc_canonicalize_path to use talloc instead of malloc.
- */
-#define SHADOW_NEXT_SMB_FNAME_CONST(op, args, rtype) do { \
- struct smb_filename *smb_fname_tmp = NULL; \
- char *cpath = NULL; \
- char *snap_component = NULL; \
- rtype ret; \
- if (shadow_copy_match_name(smb_fname->base_name, \
- &snap_component)) { \
- cpath = osc_canonicalize_path(smb_fname->base_name, \
- snap_component); \
- smb_fname->base_name = cpath; \
- } \
- status = create_synthetic_smb_fname(talloc_tos(), \
- cpath ?: smb_fname->base_name, \
- smb_fname->stream_name, &smb_fname->st, \
- &smb_fname_tmp); \
- if (!NT_STATUS_IS_OK(status)) { \
- errno = map_errno_from_nt_status(status); \
- return ret; \
- } \
- ret = SMB_VFS_NEXT_ ## op args; \
- TALLOC_FREE(smb_fname_tmp) \
- SAFE_FREE(cpath); \
- return ret; \
- } while (0) \
-
-
-
static uint64_t
onefs_shadow_copy_disk_free(vfs_handle_struct *handle, const char *path,
bool small_query, uint64_t *bsize, uint64_t *dfree,
@@ -351,11 +323,20 @@ onefs_shadow_copy_lstat(vfs_handle_struct *handle,
static int
onefs_shadow_copy_unlink(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+ const struct smb_filename *smb_fname_in)
{
- SHADOW_NEXT_SMB_FNAME_CONST(UNLINK,
- (handle, smb_fname_tmp),
- int);
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
+
+ status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ SHADOW_NEXT_SMB_FNAME(UNLINK,
+ (handle, smb_fname),
+ int);
}
static int
@@ -395,12 +376,21 @@ onefs_shadow_copy_chdir(vfs_handle_struct *handle, const char *path)
static int
onefs_shadow_copy_ntimes(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
+ const struct smb_filename *smb_fname_in,
struct smb_file_time *ft)
{
- SHADOW_NEXT_SMB_FNAME_CONST(NTIMES,
- (handle, smb_fname_tmp, ft),
- int);
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
+
+ status = copy_smb_filename(talloc_tos(), smb_fname_in, &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ SHADOW_NEXT_SMB_FNAME(NTIMES,
+ (handle, smb_fname, ft),
+ int);
}