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;
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,
/* 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
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,
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,
#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))
}
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;
}
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;
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;
}
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;
}
}
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;
* 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;
}
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;
int saved_errno = 0;
int ret;
char *conv;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
- ×tamp, &stripped)) {
+ if (!shadow_copy2_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ ×tamp,
+ &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;
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,
- ×tamp, &stripped)) {
+ if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+ smb_fname->base_name, ×tamp, &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;
}
}
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;
}
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;
}
/* 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);
}
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,