From: Volker Lendecke Date: Fri, 25 Feb 2011 13:43:52 +0000 (-0700) Subject: s3: Pass smb_filename through the set_offline vfs op X-Git-Tag: tevent-0.9.11~165 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=cf7dac6fbccca6667e5ed20b199e80701b8a6bd4;p=samba.git s3: Pass smb_filename through the set_offline vfs op --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 304f04356c4..64820afedf3 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -404,7 +404,8 @@ struct vfs_fn_pointers { 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); + int (*set_offline)(struct vfs_handle_struct *handle, + const struct smb_filename *fname); }; /* @@ -820,6 +821,6 @@ bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle, const struct smb_filename *fname, SMB_STRUCT_STAT *sbuf); int smb_vfs_call_set_offline(struct vfs_handle_struct *handle, - const char *path); + const struct smb_filename *fname); #endif /* _VFS_H */ diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 029806d3356..d04be9b5aae 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -607,9 +607,9 @@ #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)) -#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) \ - smb_vfs_call_set_offline((handle)->next, (path)) +#define SMB_VFS_SET_OFFLINE(conn,fname) \ + smb_vfs_call_set_offline((conn)->vfs_handles,(fname)) +#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \ + smb_vfs_call_set_offline((handle)->next, (fname)) #endif /* _VFS_MACROS_H */ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 6ad538149a8..b7e70a608b0 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1634,7 +1634,8 @@ static bool vfswrap_is_offline(struct vfs_handle_struct *handle, return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; } -static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path) +static int vfswrap_set_offline(struct vfs_handle_struct *handle, + const struct smb_filename *fname) { /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */ #if defined(ENOTSUP) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index e5c375ad95b..303ffae660c 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -2215,6 +2215,17 @@ static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle, return result; } +static int smb_full_audit_set_offline(struct vfs_handle_struct *handle, + const struct smb_filename *fname) +{ + int result; + + result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname); + do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s", + smb_fname_str_do_log(fname)); + return result; +} + static struct vfs_fn_pointers vfs_full_audit_fns = { /* Disk operations */ @@ -2333,6 +2344,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .aio_suspend = smb_full_audit_aio_suspend, .aio_force = smb_full_audit_aio_force, .is_offline = smb_full_audit_is_offline, + .set_offline = smb_full_audit_set_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 a6681c0ab4f..9011f6da77f 100644 --- a/source3/modules/vfs_onefs_shadow_copy.c +++ b/source3/modules/vfs_onefs_shadow_copy.c @@ -645,8 +645,9 @@ onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle, static int onefs_shadow_copy_set_offline(struct vfs_handle_struct *handle, - const char *path) + const struct smb_filename *fname) { +#error Isilon, please convert "char *path" to "struct smb_fname *fname" SHADOW_NEXT(SET_OFFLINE, (handle, cpath ?: path), int); diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index 533fde20030..6383891913f 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -349,10 +349,13 @@ static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struc } static int tsmsm_set_offline(struct vfs_handle_struct *handle, - const char *path) { + const struct smb_filename *fname) +{ struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; int result = 0; char *command; + NTSTATUS status; + char *path; if (tsmd->hsmscript == NULL) { /* no script enabled */ @@ -360,6 +363,12 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle, return 0; } + status = get_full_smb_filename(talloc_tos(), fname, &path); + if (!NT_STATUS_IS_OK(status)) { + errno = map_errno_from_nt_status(status); + return false; + } + /* Now, call the script */ command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, path); if(!command) { diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 307da32bc3e..325a3c64610 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -719,7 +719,7 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname, if (dosmode & FILE_ATTRIBUTE_OFFLINE) { if (!(old_mode & FILE_ATTRIBUTE_OFFLINE)) { - lret = SMB_VFS_SET_OFFLINE(conn, smb_fname->base_name); + lret = SMB_VFS_SET_OFFLINE(conn, smb_fname); if (lret == -1) { DEBUG(0, ("set_dos_mode: client has asked to " "set FILE_ATTRIBUTE_OFFLINE to " diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 71de587d17c..41d36504131 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2014,8 +2014,8 @@ bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle, } int smb_vfs_call_set_offline(struct vfs_handle_struct *handle, - const char *path) + const struct smb_filename *fname) { VFS_FIND(set_offline); - return handle->fns->set_offline(handle, path); + return handle->fns->set_offline(handle, fname); }