summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/VFS/skel_opaque.c3
-rw-r--r--examples/VFS/skel_transparent.c5
-rw-r--r--source3/include/vfs.h11
-rw-r--r--source3/include/vfs_macros.h8
-rw-r--r--source3/modules/vfs_catia.c27
-rw-r--r--source3/modules/vfs_ceph.c5
-rw-r--r--source3/modules/vfs_default.c7
-rw-r--r--source3/modules/vfs_full_audit.c8
-rw-r--r--source3/modules/vfs_glusterfs.c3
-rw-r--r--source3/modules/vfs_media_harmony.c21
-rw-r--r--source3/modules/vfs_shadow_copy2.c25
-rw-r--r--source3/modules/vfs_snapper.c41
-rw-r--r--source3/modules/vfs_time_audit.c7
-rw-r--r--source3/modules/vfs_unityed_media.c22
-rw-r--r--source3/smbd/trans2.c2
-rw-r--r--source3/smbd/vfs.c7
16 files changed, 130 insertions, 72 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index ae0d4dc2b62..aeb1ff37b5f 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -507,7 +507,8 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
return NULL;
}
-static int skel_chflags(vfs_handle_struct *handle, const char *path,
+static int skel_chflags(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
uint flags)
{
errno = ENOSYS;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 30f2b4e6f03..f3adae3978f 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -596,10 +596,11 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
return SMB_VFS_NEXT_REALPATH(handle, path);
}
-static int skel_chflags(vfs_handle_struct *handle, const char *path,
+static int skel_chflags(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
uint flags)
{
- return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
}
static struct file_id skel_file_id_create(vfs_handle_struct *handle,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index ec7f0d0a731..93ec6e8f49a 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -214,6 +214,8 @@
/* Version 37 - Change getxattr from const char *
to const struct smb_filename * */
/* Version 37 - Change mknod from const char * to const struct smb_filename * */
+/* Version 37 - Change chflags from const char *
+ to const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 37
@@ -734,7 +736,9 @@ struct vfs_fn_pointers {
mode_t mode,
SMB_DEV_T dev);
char *(*realpath_fn)(struct vfs_handle_struct *handle, const char *path);
- int (*chflags_fn)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
+ int (*chflags_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags);
struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
struct tevent_req *(*copy_chunk_send_fn)(struct vfs_handle_struct *handle,
@@ -1231,8 +1235,9 @@ int smb_vfs_call_mknod(struct vfs_handle_struct *handle,
mode_t mode,
SMB_DEV_T dev);
char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path);
-int smb_vfs_call_chflags(struct vfs_handle_struct *handle, const char *path,
- unsigned int flags);
+int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags);
struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 30271a6fc3a..701dc534984 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -336,10 +336,10 @@
#define SMB_VFS_NEXT_REALPATH(handle, path) \
smb_vfs_call_realpath((handle)->next, (path))
-#define SMB_VFS_CHFLAGS(conn, path, flags) \
- smb_vfs_call_chflags((conn)->vfs_handles, (path), (flags))
-#define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) \
- smb_vfs_call_chflags((handle)->next, (path), (flags))
+#define SMB_VFS_CHFLAGS(conn, smb_fname, flags) \
+ smb_vfs_call_chflags((conn)->vfs_handles, (smb_fname), (flags))
+#define SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags) \
+ smb_vfs_call_chflags((handle)->next, (smb_fname), (flags))
#define SMB_VFS_FILE_ID_CREATE(conn, sbuf) \
smb_vfs_call_file_id_create((conn)->vfs_handles, (sbuf))
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 2592367ed2b..ed16e43aa38 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -1062,21 +1062,36 @@ catia_realpath(vfs_handle_struct *handle, const char *path)
}
static int catia_chflags(struct vfs_handle_struct *handle,
- const char *path, unsigned int flags)
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
- char *mapped_name = NULL;
+ char *name = NULL;
+ struct smb_filename *catia_smb_fname = NULL;
NTSTATUS status;
int ret;
- status = catia_string_replace_allocate(handle->conn, path,
- &mapped_name, vfs_translate_to_unix);
+ status = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
}
+ catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+ name,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (catia_smb_fname == NULL) {
+ TALLOC_FREE(name);
+ errno = ENOMEM;
+ return -1;
+ }
- ret = SMB_VFS_NEXT_CHFLAGS(handle, mapped_name, flags);
- TALLOC_FREE(mapped_name);
+ ret = SMB_VFS_NEXT_CHFLAGS(handle, catia_smb_fname, flags);
+ TALLOC_FREE(name);
+ TALLOC_FREE(catia_smb_fname);
return ret;
}
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index d88ceacee33..d936738ff5a 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1189,8 +1189,9 @@ static char *cephwrap_realpath(struct vfs_handle_struct *handle, const char *pa
return result;
}
-static int cephwrap_chflags(struct vfs_handle_struct *handle, const char *path,
- unsigned int flags)
+static int cephwrap_chflags(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
errno = ENOSYS;
return -1;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6de5d641c3e..b2c6c28f87b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2465,11 +2465,12 @@ static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path)
return result;
}
-static int vfswrap_chflags(vfs_handle_struct *handle, const char *path,
- unsigned int flags)
+static int vfswrap_chflags(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
#ifdef HAVE_CHFLAGS
- return chflags(path, flags);
+ return chflags(smb_fname->base_name, flags);
#else
errno = ENOSYS;
return -1;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index af165dd4b69..634caf09a61 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1686,13 +1686,15 @@ static char *smb_full_audit_realpath(vfs_handle_struct *handle,
}
static int smb_full_audit_chflags(vfs_handle_struct *handle,
- const char *path, unsigned int flags)
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
int result;
- result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
- do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s", path);
+ do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s",
+ smb_fname->base_name);
return result;
}
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 7c727773a64..878c5078c58 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1257,7 +1257,8 @@ static int vfs_gluster_mknod(struct vfs_handle_struct *handle,
}
static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
- const char *path, unsigned int flags)
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
errno = ENOSYS;
return -1;
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 99a5e9b6979..37b396a5bea 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1923,33 +1923,30 @@ out:
* Failure: set errno, return -1
*/
static int mh_chflags(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
unsigned int flags)
{
int status;
- char *clientPath;
+ struct smb_filename *clientFname = NULL;
TALLOC_CTX *ctx;
DEBUG(MH_INFO_DEBUG, ("Entering mh_chflags\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
goto out;
}
- clientPath = NULL;
ctx = talloc_tos();
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ if ((status = alloc_get_client_smb_fname(handle, ctx,
+ smb_fname,
+ &clientFname))) {
goto err;
}
- status = SMB_VFS_NEXT_CHFLAGS(handle, clientPath, flags);
+ status = SMB_VFS_NEXT_CHFLAGS(handle, clientFname, flags);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 1fb492ba71e..35c08549afa 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -2309,7 +2309,8 @@ static int shadow_copy2_rmdir(vfs_handle_struct *handle,
return ret;
}
-static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname,
+static int shadow_copy2_chflags(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
unsigned int flags)
{
time_t timestamp = 0;
@@ -2317,23 +2318,37 @@ static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname,
int saved_errno = 0;
int ret;
char *conv;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
- &timestamp, &stripped)) {
+ if (!shadow_copy2_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ &timestamp,
+ &stripped)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_CHFLAGS(handle, fname, flags);
+ return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
}
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_CHFLAGS(handle, conv, flags);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
if (ret == -1) {
saved_errno = errno;
}
+ TALLOC_FREE(conv_smb_fname);
TALLOC_FREE(conv);
if (saved_errno != 0) {
errno = saved_errno;
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 61e7496f95e..ec23c616aae 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -2654,30 +2654,47 @@ static int snapper_gmt_rmdir(vfs_handle_struct *handle,
return ret;
}
-static int snapper_gmt_chflags(vfs_handle_struct *handle, const char *fname,
- unsigned int flags)
+static int snapper_gmt_chflags(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
- time_t timestamp;
- char *stripped;
- int ret, saved_errno;
- char *conv;
+ time_t timestamp = 0;
+ char *stripped = NULL;
+ int ret = -1;
+ int saved_errno = 0;
+ char *conv = NULL;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
- &timestamp, &stripped)) {
+ if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name, &timestamp, &stripped)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_CHFLAGS(handle, fname, flags);
+ return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
}
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_CHFLAGS(handle, conv, flags);
- saved_errno = errno;
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL,
+ smb_fname->flags);
TALLOC_FREE(conv);
- errno = saved_errno;
+ if (conv_smb_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_CHFLAGS(handle, conv_smb_fname, flags);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(conv_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return ret;
}
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 3bbe2d96149..aa882bb7700 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1512,19 +1512,20 @@ static char *smb_time_audit_realpath(vfs_handle_struct *handle,
}
static int smb_time_audit_chflags(vfs_handle_struct *handle,
- const char *path, unsigned int flags)
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("chflags", timediff, path);
+ smb_time_audit_log_smb_fname("chflags", timediff, smb_fname);
}
return result;
diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c
index cda6ad635a8..aa06ea361fa 100644
--- a/source3/modules/vfs_unityed_media.c
+++ b/source3/modules/vfs_unityed_media.c
@@ -1464,27 +1464,27 @@ err:
}
static int um_chflags(vfs_handle_struct *handle,
- const char *path,
- unsigned int flags)
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
int status;
- char *client_path = NULL;
-
- DEBUG(10, ("Entering um_chflags\n"));
+ struct smb_filename *client_fname = NULL;
- if (!is_in_media_files(path)) {
- return SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+ DEBUG(10, ("Entering um_mknod\n"));
+ if (!is_in_media_files(smb_fname->base_name)) {
+ return SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
}
- status = alloc_get_client_path(handle, talloc_tos(),
- path, &client_path);
+ status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ smb_fname, &client_fname);
if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_CHFLAGS(handle, client_path, flags);
+ status = SMB_VFS_NEXT_CHFLAGS(handle, client_fname, flags);
+
err:
- TALLOC_FREE(client_path);
+ TALLOC_FREE(client_fname);
return status;
}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 758644bc230..3e1cfa8ca96 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7905,7 +7905,7 @@ static NTSTATUS smb_set_file_unix_info2(connection_struct *conn,
/* XXX: we should be using SMB_VFS_FCHFLAGS here. */
return NT_STATUS_NOT_SUPPORTED;
} else {
- if (SMB_VFS_CHFLAGS(conn, smb_fname->base_name,
+ if (SMB_VFS_CHFLAGS(conn, smb_fname,
stat_fflags) != 0) {
return map_nt_error_from_unix(errno);
}
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index b129bb1ce05..9248091153a 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -2182,11 +2182,12 @@ char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path)
return handle->fns->realpath_fn(handle, path);
}
-int smb_vfs_call_chflags(struct vfs_handle_struct *handle, const char *path,
- unsigned int flags)
+int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ unsigned int flags)
{
VFS_FIND(chflags);
- return handle->fns->chflags_fn(handle, path, flags);
+ return handle->fns->chflags_fn(handle, smb_fname, flags);
}
struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,