r21757: Add SMB_VFS_CHFLAGS operation.
authorJames Peach <jpeach@samba.org>
Thu, 8 Mar 2007 01:40:49 +0000 (01:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:28 +0000 (12:18 -0500)
(This used to be commit 16cb22d6b83c502dec1b297c544c05d89714b3d6)

source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c

index 7bcd6cdf2c40edf58bd0529300b6d1c559c69024..5e7048bb54cca7d44350d5b605a89263dfed1d19 100644 (file)
@@ -69,7 +69,8 @@
    Also included linux setlease call - jmcd */
 /* Changed to version 20, use ntimes call instead of utime (greater
  * timestamp resolition. JRA. */
-#define SMB_VFS_INTERFACE_VERSION 20
+/* Changed to version21 to add chflags operation -- jpeach */
+#define SMB_VFS_INTERFACE_VERSION 21
 
 
 /* to bug old modules which are trying to compile with the old functions */
@@ -158,6 +159,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_MKNOD,
        SMB_VFS_OP_REALPATH,
        SMB_VFS_OP_NOTIFY_WATCH,
+       SMB_VFS_OP_CHFLAGS,
 
        /* NT ACL operations. */
 
@@ -289,6 +291,7 @@ struct vfs_ops {
                                                          void *private_data,
                                                          struct notify_event *ev),
                                         void *private_data, void *handle_p);
+               int (*chflags)(struct vfs_handle_struct *handle, const char *path, uint flags);
                
                /* NT ACL operations. */
                
@@ -406,6 +409,7 @@ struct vfs_ops {
                struct vfs_handle_struct *mknod;
                struct vfs_handle_struct *realpath;
                struct vfs_handle_struct *notify_watch;
+               struct vfs_handle_struct *chflags;
 
                /* NT ACL operations. */
 
index f4a289716bb21bf3bba11d0361cf9ac4742ab9d9..2ff313b42ce664c970c266700d6d3ac1f393dd55 100644 (file)
@@ -79,6 +79,7 @@
 #define SMB_VFS_MKNOD(conn, path, mode, dev) ((conn)->vfs.ops.mknod((conn)->vfs.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_REALPATH(conn, path, resolved_path) ((conn)->vfs.ops.realpath((conn)->vfs.handles.realpath, (path), (resolved_path)))
 #define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
+#define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags)))
 
 /* NT ACL operations. */
 #define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
 #define SMB_VFS_OPAQUE_MKNOD(conn, path, mode, dev) ((conn)->vfs_opaque.ops.mknod((conn)->vfs_opaque.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_OPAQUE_REALPATH(conn, path, resolved_path) ((conn)->vfs_opaque.ops.realpath((conn)->vfs_opaque.handles.realpath, (path), (resolved_path)))
 #define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
+#define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags)))
 
 /* NT ACL operations. */
 #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
 #define SMB_VFS_NEXT_MKNOD(handle, path, mode, dev) ((handle)->vfs_next.ops.mknod((handle)->vfs_next.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_NEXT_REALPATH(handle, path, resolved_path) ((handle)->vfs_next.ops.realpath((handle)->vfs_next.handles.realpath, (path), (resolved_path)))
 #define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
+#define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags)))
 
 /* NT ACL operations. */
 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
index f482a3b1f3d06df9dbe7a19b6c4648b904383403..4febc064d9449bd225caae757728c793e6b42add 100644 (file)
@@ -903,6 +903,12 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
        return NT_STATUS_OK;
 }
 
+static int vfswrap_chflags(vfs_handle_struct *handle, const char *path, int flags)
+{
+       errno = ENOSYS;
+       return -1;
+}
+
 static size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)
 {
        size_t result;
@@ -1286,6 +1292,8 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_notify_watch),      SMB_VFS_OP_NOTIFY_WATCH,
         SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_chflags),   SMB_VFS_OP_CHFLAGS,
+        SMB_VFS_LAYER_OPAQUE},
 
        /* NT ACL operations. */
 
index e609ae1cd1fa757139c066ab862e07ee69456552..79a511df41defbc7e2dc2cd1a7718ea7219594e1 100644 (file)
@@ -174,6 +174,8 @@ static int smb_full_audit_mknod(vfs_handle_struct *handle,
                       const char *pathname, mode_t mode, SMB_DEV_T dev);
 static char *smb_full_audit_realpath(vfs_handle_struct *handle,
                            const char *path, char *resolved_path);
+static int smb_full_audit_chflags(vfs_handle_struct *handle,
+                           const char *path, uint flags);
 static size_t smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                                int fd, uint32 security_info,
                                SEC_DESC **ppdesc);
@@ -397,6 +399,8 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_realpath),   SMB_VFS_OP_REALPATH,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_chflags),    SMB_VFS_OP_CHFLAGS,
+        SMB_VFS_LAYER_LOGGER},
 
        /* NT ACL operations. */
 
@@ -560,6 +564,7 @@ static struct {
        { SMB_VFS_OP_LINK,      "link" },
        { SMB_VFS_OP_MKNOD,     "mknod" },
        { SMB_VFS_OP_REALPATH,  "realpath" },
+       { SMB_VFS_OP_CHFLAGS,   "chflags" },
        { SMB_VFS_OP_FGET_NT_ACL,       "fget_nt_acl" },
        { SMB_VFS_OP_GET_NT_ACL,        "get_nt_acl" },
        { SMB_VFS_OP_FSET_NT_ACL,       "fset_nt_acl" },
@@ -1405,6 +1410,18 @@ static char *smb_full_audit_realpath(vfs_handle_struct *handle,
        return result;
 }
 
+static int smb_full_audit_chflags(vfs_handle_struct *handle,
+                           const char *path, uint flags)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
+
+       do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s", path);
+
+       return result;
+}
+
 static size_t smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                                int fd, uint32 security_info,
                                SEC_DESC **ppdesc)