/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Common functions supporting both:
* SMB2 Set File Info
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_fsops.h>
/*
* smb_set_basic_info
* [MS-FSCC] 2.4.7
* FileBasicInformation
* SMB_SET_FILE_BASIC_INFO
* SMB_FILE_BASIC_INFORMATION
*
*
* It is not valid to set FILE_ATTRIBUTE_DIRECTORY if the
* target is not a directory.
*
* For compatibility with windows servers:
* - if the specified attributes have ONLY FILE_ATTRIBUTE_NORMAL set
* clear (0) the file's attributes.
* - if the specified attributes are 0 do NOT change the file's attributes.
*/
{
int rc;
return (NT_STATUS_INFO_LENGTH_MISMATCH);
if ((attributes & FILE_ATTRIBUTE_DIRECTORY) &&
(!smb_node_is_dir(node)))
return (NT_STATUS_INVALID_PARAMETER);
}
}
}
}
if (attributes != 0) {
}
if (rc != 0)
return (smb_errno2status(rc));
return (0);
}
/*
* smb_set_eof_info
* FileEndOfFileInformation
* SMB_SET_FILE_END_OF_FILE_INFO
* SMB_FILE_END_OF_FILE_INFORMATION
*/
{
int rc;
return (NT_STATUS_INFO_LENGTH_MISMATCH);
if (smb_node_is_dir(node))
return (NT_STATUS_INVALID_PARAMETER);
/* If opened by path, break exclusive oplock */
if (rc != 0)
return (smb_errno2status(rc));
return (0);
}
/*
* smb_set_alloc_info
* FileAllocationInformation
* SMB_SET_FILE_ALLOCATION_INFO
* SMB_FILE_ALLOCATION_INFORMATION
*/
{
int rc;
return (NT_STATUS_INFO_LENGTH_MISMATCH);
if (smb_node_is_dir(node))
return (NT_STATUS_INVALID_PARAMETER);
/* If opened by path, break exclusive oplock */
if (rc != 0)
return (smb_errno2status(rc));
return (0);
}
/*
* smb_set_disposition_info
* See:
* FileDispositionInformation
* SMB_SET_FILE_DISPOSITION_INFO
* SMB_FILE_DISPOSITION_INFORMATION
*
* File should have been opened with DELETE access otherwise
* the operation is not permitted.
*
* NOTE: The node should be marked delete-on-close upon the receipt
* of the Trans2SetFileInfo(SetDispositionInfo) if mark_delete is set.
* It is different than both SmbNtCreateAndX and SmbNtTransact, which
* set delete-on-close on the ofile and defer setting the flag on the
* node until the file is closed.
*
* Observation of Windows 2000 indicates the following:
*
* 1) If a file is not opened with delete-on-close create options and
* the delete-on-close is set via Trans2SetFileInfo(SetDispositionInfo)
* using that open file handle, any subsequent open requests will fail
* with DELETE_PENDING.
*
* 2) If a file is opened with delete-on-close create options and the
* client attempts to unset delete-on-close via Trans2SetFileInfo
* (SetDispositionInfo) prior to the file close, any subsequent open
* requests will still fail with DELETE_PENDING after the file is closed.
*
* 3) If a file is opened with delete-on-close create options and that
* file handle (not the last open handle and the only file handle
* with delete-on-close set) is closed. Any subsequent open requests
* will fail with DELETE_PENDING. Unsetting delete-on-close via
* Trans2SetFileInfo(SetDispositionInfo) at this time will unset the
* node delete-on-close flag, which will result in the file not being
* removed even after the last file handle is closed.
*/
{
return (NT_STATUS_INFO_LENGTH_MISMATCH);
return (NT_STATUS_ACCESS_DENIED);
if (mark_delete) {
if (SMB_TREE_SUPPORTS_CATIA(sr))
} else {
}
return (NT_STATUS_SUCCESS);
}