s3: Pass smb_filename through the set_offline vfs op
authorVolker Lendecke <vl@samba.org>
Fri, 25 Feb 2011 13:43:52 +0000 (06:43 -0700)
committerVolker Lendecke <vlendec@samba.org>
Wed, 2 Mar 2011 17:39:21 +0000 (18:39 +0100)
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_onefs_shadow_copy.c
source3/modules/vfs_tsmsm.c
source3/smbd/dosmode.c
source3/smbd/vfs.c

index 304f04356c475295ff68cf1a9cb37301159da672..64820afedf348d47d5be7fd9ac01f087c69956cb 100644 (file)
@@ -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 */
index 029806d33564987d0a650f7ccb207cd1981f9d55..d04be9b5aae77d06c2d713fbb15583483255ba43 100644 (file)
 #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 */
index 6ad538149a899984d67fa552f4498125aab71d79..b7e70a608b0d4a499b8398454efb590df1bfc4e8 100644 (file)
@@ -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)
index e5c375ad95bee7196b055df37152bb39eaefb809..303ffae660c65cba9e0ca6e6351b7aea7d133176 100644 (file)
@@ -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)
index a6681c0ab4f2936cfee46cf1ee9670f4111f1adf..9011f6da77ff6231b79d85203844c32e817747f2 100644 (file)
@@ -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);
index 533fde200307eb481b05f08e74786945853f0596..6383891913f2db3c1e5a083d0bbc743293d5b410 100644 (file)
@@ -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) {
index 307da32bc3eeff93c2f93cba669754ea4073009a..325a3c646102fb9e069f8220d936ad8bd63fcb43 100644 (file)
@@ -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 "
index 71de587d17cab388a4489befe406e84b6c108c08..41d36504131dd0775db0ad23ee38924753b63978 100644 (file)
@@ -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);
 }