In aio_fork, we have to close all fd's, we might hold a gpfs share mode
[kai/samba-autobuild/.git] / source3 / modules / vfs_acl_xattr.c
index c28ba839be0cefc27928684d34d13c3eb957d305..49e48998790872fa146188f36476c252fa3140ce 100644 (file)
@@ -328,10 +328,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
        size_t size;
        char *parent_name;
 
-       if (!parent_dirname_talloc(ctx,
-                               fname,
-                               &parent_name,
-                               NULL)) {
+       if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -384,7 +381,11 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
                if (fsp && !fsp->is_directory && fsp->fh->fd != -1) {
                        ret = SMB_VFS_FSTAT(fsp, &sbuf);
                } else {
-                       ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+                       if (fsp && fsp->posix_open) {
+                               ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf);
+                       } else {
+                               ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+                       }
                }
                if (ret == -1) {
                        return map_nt_error_from_unix(errno);
@@ -562,7 +563,11 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
                        return NT_STATUS_OK;
                }
                if (fsp->is_directory || fsp->fh->fd == -1) {
-                       ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       if (fsp->posix_open) {
+                               ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       } else {
+                               ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+                       }
                } else {
                        ret = SMB_VFS_FSTAT(fsp, &sbuf);
                }
@@ -579,6 +584,7 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
                psd = nc_psd;
        }
 
+#if 0
        if ((security_info_sent & DACL_SECURITY_INFORMATION) &&
                        psd->dacl != NULL &&
                        (psd->type & (SE_DESC_DACL_AUTO_INHERITED|
@@ -594,6 +600,7 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
                }
                psd = new_psd;
        }
+#endif
 
        if (DEBUGLEVEL >= 10) {
                DEBUG(10,("fset_nt_acl_xattr: storing xattr sd for file %s\n",
@@ -611,52 +618,6 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
  Remove a Windows ACL - we're setting the underlying POSIX ACL.
 *********************************************************************/
 
-static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
-                              const char *name,
-                              SMB_ACL_TYPE_T type,
-                              SMB_ACL_T theacl)
-{
-       int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
-                                               name,
-                                               type,
-                                               theacl);
-       if (ret == -1) {
-               return -1;
-       }
-
-       become_root();
-       SMB_VFS_REMOVEXATTR(handle, name, XATTR_NTACL_NAME);
-       unbecome_root();
-
-       return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
-static int sys_acl_set_fd_xattr(vfs_handle_struct *handle,
-                            files_struct *fsp,
-                            SMB_ACL_T theacl)
-{
-       int ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
-                                               fsp,
-                                               theacl);
-       if (ret == -1) {
-               return -1;
-       }
-
-       become_root();
-       SMB_VFS_FREMOVEXATTR(handle, fsp, XATTR_NTACL_NAME);
-       unbecome_root();
-
-       return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
 static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
                               const char *name,
                               SMB_ACL_TYPE_T type,
@@ -716,10 +677,6 @@ static vfs_op_tuple skel_op_tuples[] =
        {SMB_VFS_OP(sys_acl_set_file_xattr), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(sys_acl_set_fd_xattr), SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT},
 
-       /* POSIX ACL operations. */
-       {SMB_VFS_OP(sys_acl_set_file_xattr), SMB_VFS_OP_SYS_ACL_SET_FILE, SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(sys_acl_set_fd_xattr), SMB_VFS_OP_SYS_ACL_SET_FD, SMB_VFS_LAYER_TRANSPARENT},
-
        {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
 };