diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/vfs.h | 7 | ||||
-rw-r--r-- | source3/include/vfs_macros.h | 8 | ||||
-rw-r--r-- | source3/modules/vfs_default.c | 15 | ||||
-rw-r--r-- | source3/modules/vfs_full_audit.c | 13 | ||||
-rw-r--r-- | source3/modules/vfs_onefs_shadow_copy.c | 4 | ||||
-rw-r--r-- | source3/modules/vfs_tsmsm.c | 13 | ||||
-rw-r--r-- | source3/smbd/dosmode.c | 2 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 5 |
8 files changed, 53 insertions, 14 deletions
diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 7e5b87a418..304f04356c 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -401,7 +401,9 @@ struct vfs_fn_pointers { bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); /* offline operations */ - bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); + bool (*is_offline)(struct vfs_handle_struct *handle, + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf); int (*set_offline)(struct vfs_handle_struct *handle, const char *path); }; @@ -815,7 +817,8 @@ int smb_vfs_call_aio_suspend(struct vfs_handle_struct *handle, bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp); bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle, - const char *path, SMB_STRUCT_STAT *sbuf); + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf); int smb_vfs_call_set_offline(struct vfs_handle_struct *handle, const char *path); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 7c26529385..029806d335 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -602,10 +602,10 @@ #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) \ smb_vfs_call_aio_force((handle)->next,(fsp)) -#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) \ - smb_vfs_call_is_offline((conn)->vfs_handles,(path),(sbuf)) -#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) \ - smb_vfs_call_is_offline((handle)->next,(path),(sbuf)) +#define SMB_VFS_IS_OFFLINE(conn,fname,sbuf) \ + smb_vfs_call_is_offline((conn)->vfs_handles,(fname),(sbuf)) +#define SMB_VFS_NEXT_IS_OFFLINE(handle,fname,sbuf) \ + smb_vfs_call_is_offline((handle)->next,(fname),(sbuf)) #define SMB_VFS_SET_OFFLINE(conn,path) \ smb_vfs_call_set_offline((conn)->vfs_handles,(path)) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 5448db8ee0..6ad538149a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1607,9 +1607,14 @@ static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_str return false; } -static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) +static bool vfswrap_is_offline(struct vfs_handle_struct *handle, + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf) { - if (ISDOT(path) || ISDOTDOT(path)) { + NTSTATUS status; + char *path; + + if (ISDOT(fname->base_name) || ISDOTDOT(fname->base_name)) { return false; } @@ -1620,6 +1625,12 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *pat return false; } + status = get_full_smb_filename(talloc_tos(), fname, &path); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return false; + } + return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; } diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index a9a4a0664e..e5c375ad95 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -2203,6 +2203,18 @@ static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle, return result; } +static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle, + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf) +{ + bool result; + + result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf); + do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s", + smb_fname_str_do_log(fname)); + return result; +} + static struct vfs_fn_pointers vfs_full_audit_fns = { /* Disk operations */ @@ -2320,6 +2332,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .aio_fsync = smb_full_audit_aio_fsync, .aio_suspend = smb_full_audit_aio_suspend, .aio_force = smb_full_audit_aio_force, + .is_offline = smb_full_audit_is_offline, }; NTSTATUS vfs_full_audit_init(void) diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c index bcc40f0d9f..a6681c0ab4 100644 --- a/source3/modules/vfs_onefs_shadow_copy.c +++ b/source3/modules/vfs_onefs_shadow_copy.c @@ -634,8 +634,10 @@ onefs_shadow_copy_lsetxattr(vfs_handle_struct *handle, const char *path, static bool onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle, - const char *path, SMB_STRUCT_STAT *sbuf) + const struct smb_fname *fname, + SMB_STRUCT_STAT *sbuf) { +#error Isilon, please convert "char *path" to "struct smb_fname *fname" SHADOW_NEXT(IS_OFFLINE, (handle, cpath ?: path, sbuf), bool); diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index 95c83de08d..533fde2003 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -146,8 +146,9 @@ static int tsmsm_connect(struct vfs_handle_struct *handle, } static bool tsmsm_is_offline(struct vfs_handle_struct *handle, - const char *path, - SMB_STRUCT_STAT *stbuf) { + const struct smb_filename *fname, + SMB_STRUCT_STAT *stbuf) +{ struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; const dm_sessid_t *dmsession_id; void *dmhandle = NULL; @@ -158,6 +159,14 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle, bool offline; char *buf = NULL; size_t buflen; + NTSTATUS status; + char *path; + + status = get_full_smb_filename(talloc_tos(), fname, &path); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return false; + } /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available, then assume it is not offline (it may not be 100%, as it could be sparse) */ diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index c0bf168e53..307da32bc3 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -648,7 +648,7 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname) } } - offline = SMB_VFS_IS_OFFLINE(conn, smb_fname->base_name, &smb_fname->st); + offline = SMB_VFS_IS_OFFLINE(conn, smb_fname, &smb_fname->st); if (S_ISREG(smb_fname->st.st_ex_mode) && offline) { result |= FILE_ATTRIBUTE_OFFLINE; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 40aaf6bb74..71de587d17 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2006,10 +2006,11 @@ bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle, } bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle, - const char *path, SMB_STRUCT_STAT *sbuf) + const struct smb_filename *fname, + SMB_STRUCT_STAT *sbuf) { VFS_FIND(is_offline); - return handle->fns->is_offline(handle, path, sbuf); + return handle->fns->is_offline(handle, fname, sbuf); } int smb_vfs_call_set_offline(struct vfs_handle_struct *handle, |