/*
* 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.
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/winioctl.h>
smb_xa_t *);
/*
* This table defines the list of FSCTL values for which we'll
* call a funtion to perform specific processing.
*
* Note: If support is added for FSCTL_SET_ZERO_DATA, it must break
* any oplocks on the file to none:
* smb_oplock_break(sr, node, SMB_OPLOCK_BREAK_TO_NONE);
*/
static const struct {
} ioctl_ret_tbl[] = {
};
/*
* smb_nt_transact_ioctl
*
* This command allows device and file system control functions to be
* transferred transparently from client to server.
*
* Setup Words Encoding Description
* =========================== =========================================
* ULONG FunctionCode; NT device or file system control code
* USHORT Fid; Handle for io or fs control. Unless BIT0
* of ISFLAGS is set.
* BOOLEAN IsFsctl; Indicates whether the command is a device
* control (FALSE) or a file system control
* (TRUE).
* UCHAR IsFlags; BIT0 - command is to be applied to share
* root handle. Share must be a DFS share.
*
* Data Block Encoding Description
* =========================== =========================================
* Data[ TotalDataCount ] Passed to the Fsctl or Ioctl
*
* Server Response Description
* =========================== ==================================
* SetupCount 1
* Setup[0] Length of information returned by
* io or fs control.
* DataCount Length of information returned by
* io or fs control.
* Data[ DataCount ] The results of the io or fs control.
*/
{
unsigned char is_fsctl;
unsigned char is_flags;
int i;
return (SDRC_ERROR);
}
/*
* Invoke handler if specified, otherwise the default
* behavior is to return NT_STATUS_NOT_SUPPORTED
*/
for (i = 0; i < sizeof (ioctl_ret_tbl) / sizeof (ioctl_ret_tbl[0]);
i++) {
break;
}
}
if (status != NT_STATUS_SUCCESS) {
return (SDRC_ERROR);
}
return (SDRC_SUCCESS);
}
/* ARGSUSED */
static uint32_t
{
return (NT_STATUS_SUCCESS);
}
/* ARGSUSED */
static uint32_t
{
return (NT_STATUS_INVALID_PARAMETER);
}
/*
* smb_nt_trans_ioctl_set_sparse
*
* There may, or may not be a data block in this request.
* If there IS a data block, the first byte is a boolean
* specifying whether to set (non zero) or clear (zero)
* the sparse attribute of the file.
* If there is no data block, this indicates a request to
* set the sparse attribute.
*/
static uint32_t
{
int rc = 0;
if (SMB_TREE_IS_READONLY(sr))
return (NT_STATUS_ACCESS_DENIED);
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_INVALID_HANDLE);
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INVALID_PARAMETER);
}
if (smbsr_decode_data_avail(sr)) {
}
}
/*
* Using kcred because we just want the DOS attrs
* and don't want access errors for this.
*/
if (rc != 0) {
}
if ((set == 0) &&
} else if ((set != 0) &&
}
if (rc != 0) {
}
}
return (NT_STATUS_SUCCESS);
}
/*
* smb_nt_trans_ioctl_set_zero_data
*
* Check that the request is valid on the specified file.
* The implementation is a noop.
*/
/* ARGSUSED */
static uint32_t
{
if (SMB_TREE_IS_READONLY(sr))
return (NT_STATUS_ACCESS_DENIED);
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_INVALID_HANDLE);
return (NT_STATUS_INVALID_PARAMETER);
}
if (smb_node_is_dir(node)) {
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_SUCCESS);
}
/*
* smb_nt_trans_ioctl_query_alloc_ranges
*
* Responds with either:
* - no data if the file is zero size
* - a single range containing the starting point and length requested
*/
static uint32_t
{
int rc;
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_INVALID_HANDLE);
return (NT_STATUS_INVALID_PARAMETER);
}
return (NT_STATUS_INVALID_PARAMETER);
}
/* If zero size file don't return any data */
if (rc != 0) {
}
return (NT_STATUS_SUCCESS);
}
}
/*
* Return a single range regardless of whether the file
* is sparse or not.
*/
return (NT_STATUS_BUFFER_TOO_SMALL);
}
}
return (NT_STATUS_SUCCESS);
}
static uint32_t
{
return (NT_STATUS_INVALID_PARAMETER);
return (NT_STATUS_INVALID_HANDLE);
return (NT_STATUS_INVALID_PARAMETER);
}
fsctl.OutputCount = 0;
return (status);
}