/*
* 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.
*/
/*
*
* SMB_INFO_STANDARD
* SMB_INFO_SET_EAS
* SMB_SET_FILE_BASIC_INFO
* SMB_SET_FILE_DISPOSITION_INFO
* SMB_SET_FILE_END_OF_FILE_INFO
* SMB_SET_FILE_ALLOCATION_INFO
*
* Handled Passthrough levels:
* SMB_FILE_BASIC_INFORMATION
* SMB_FILE_RENAME_INFORMATION
* SMB_FILE_LINK_INFORMATION
* SMB_FILE_DISPOSITION_INFORMATION
* SMB_FILE_END_OF_FILE_INFORMATION
* SMB_FILE_ALLOCATION_INFORMATION
*
* Internal levels representing non trans2 requests
* SMB_SET_INFORMATION
* SMB_SET_INFORMATION2
*/
/*
* Setting timestamps:
* The behaviour when the time field is set to -1 is not documented
* but is generally treated like 0, meaning that that server file
* system assigned value need not be changed.
*
* Setting attributes - FILE_ATTRIBUTE_NORMAL:
* SMB_SET_INFORMATION -
* - if the specified attributes have ONLY FILE_ATTRIBUTE_NORMAL set
* do NOT change the file's attributes.
* SMB_SET_BASIC_INFO -
* - 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.
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_fsops.h>
/*
* These functions all return and NT status code.
*/
/*
* smb_com_trans2_set_file_information
*/
{
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_SUCCESS);
}
/*
* smb_com_trans2_set_path_information
*/
{
return (SDRC_ERROR);
}
return (SDRC_ERROR);
return (SDRC_ERROR);
return (SDRC_SUCCESS);
}
/*
* smb_com_set_information (aka setattr)
*/
{
return (SDRC_SUCCESS);
}
void
{
}
{
return (SDRC_ERROR);
}
return (SDRC_ERROR);
return (SDRC_ERROR);
if (smbsr_encode_empty_result(sr) != 0)
return (SDRC_ERROR);
return (SDRC_SUCCESS);
}
/*
* smb_com_set_information2 (aka setattre)
*/
{
return (SDRC_SUCCESS);
}
void
{
}
{
return (SDRC_ERROR);
return (SDRC_ERROR);
if (smbsr_encode_empty_result(sr) != 0)
return (SDRC_ERROR);
return (SDRC_SUCCESS);
}
/*
* smb_set_by_fid
*
* Common code for setting file information by open file id.
* Use the id to identify the node object and invoke smb_set_fileinfo
* for that node.
*
* Setting attributes on a named pipe by id is handled by simply
* returning success.
*/
static int
{
int rc = 0;
if (SMB_TREE_IS_READONLY(sr)) {
return (-1);
}
return (0);
return (-1);
}
return (0);
}
if (status != 0) {
rc = -1;
}
return (rc);
}
/*
* smb_set_by_path
*
* Common code for setting file information by file name.
* Use the file name to identify the node object and invoke
* smb_set_fileinfo for that node.
*
* Path should be set in sr->arg.dirop.fqi.fq_path prior to
* calling smb_set_by_path.
*
* Setting attributes on a named pipe by name is an error and
* is handled in the calling functions so that they can return
* the appropriate error status code (which differs by caller).
*/
static int
{
int rc;
char *name;
if (SMB_TREE_IS_READONLY(sr)) {
return (-1);
}
return (-1);
if (rc == 0) {
}
if (rc != 0) {
} else {
}
return (-1);
}
if (status != 0) {
rc = -1;
}
return (rc);
}
/*
* smb_set_fileinfo
*
* For compatibility with windows servers, SMB_FILE_LINK_INFORMATION
* is handled by returning NT_STATUS_NOT_SUPPORTED.
*/
static uint32_t
{
switch (infolev) {
case SMB_SET_INFORMATION:
break;
case SMB_SET_INFORMATION2:
break;
case SMB_INFO_STANDARD:
break;
case SMB_INFO_SET_EAS:
/* EAs not supported */
status = 0;
break;
case SMB_SET_FILE_BASIC_INFO:
break;
break;
break;
break;
break;
break;
default:
break;
}
return (status);
}
/*
* smb_set_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 do NOT change
* the file's attributes.
*/
static uint32_t
{
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 != FILE_ATTRIBUTE_NORMAL) {
}
}
if (rc != 0)
return (status);
}
/*
* smb_set_information2
*/
static uint32_t
{
int rc;
return (NT_STATUS_INFO_LENGTH_MISMATCH);
}
}
}
if (rc != 0)
return (status);
}
/*
* smb_set_standard_info
*
*/
static uint32_t
{
int rc;
return (NT_STATUS_INFO_LENGTH_MISMATCH);
}
}
}
if (rc != 0)
return (status);
}
/*
* smb_set_rename_info
*
* This call only allows a rename in the same directory, and the
* directory name is not part of the new name provided.
*
* Explicitly specified parameter validation rules:
* - If rootdir is not NULL respond with NT_STATUS_INVALID_PARAMETER.
* - If the filename contains a separator character respond with
* NT_STATUS_INVALID_PARAMETER.
*
* Oplock break:
* Some Windows servers break BATCH oplocks prior to the rename.
* W2K3 does not. We behave as W2K3; we do not send an oplock break.
*/
static uint32_t
{
char *fname;
char *path;
int rc;
if (rc == 0) {
}
if (rc != 0)
return (NT_STATUS_INFO_LENGTH_MISMATCH);
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_NOT_SUPPORTED);
}
/*
* Construct the full dst. path relative to the share root.
* Allocated path is free'd in smb_request_free.
*/
/* Got here via: smb_set_by_path */
} else {
/* Got here via: smb_set_by_fid */
if (rc != 0) {
return (status);
}
}
/*
* The common rename code can slightly optimize a
* rename in the same directory when we set the
* dst_fqi->fq_dnode, dst_fqi->fq_last_comp
*/
return (status);
}