/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
#include <smbsrv/smb_kproto.h>
#include <smbsrv/smb_fsops.h>
/*
* The create directory message is sent to create a new directory. The
* appropriate Tid and additional pathname are passed. The directory must
* not exist for it to be created.
*
* Client Request Description
* ================================== =================================
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes; min = 2
* UCHAR BufferFormat; 0x04
* STRING DirectoryName[]; Directory name
*
* Servers require clients to have at least create permission for the
* subtree containing the directory in order to create a new directory.
* The creator's access rights to the new directory are be determined by
* local policy on the server.
*
* Server Response Description
* ================================== =================================
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes = 0
*/
{
int rc;
}
void
{
}
{
int rc = 0;
return (SDRC_ERROR);
}
return (SDRC_ERROR);
}
return (SDRC_ERROR);
}
}
/*
* smb_common_create_directory
*
* Currently called from:
* smb_com_create_directory
* smb_com_trans2_create_directory
*
* Returns errno values.
*/
int
{
int rc;
if (rc != 0)
return (rc);
return (EILSEQ); /* NT_STATUS_OBJECT_NAME_INVALID */
}
/* lookup node - to ensure that it does NOT exist */
if (rc == 0) {
return (EEXIST);
}
return (rc);
}
if (rc != NT_STATUS_SUCCESS) {
return (EACCES);
}
/*
* Explicitly set sa_dosattr, otherwise the file system may
* automatically apply FILE_ATTRIBUTE_ARCHIVE which, for
* compatibility with windows servers, should not be set.
*/
if (rc != 0) {
return (rc);
}
return (0);
}
/*
* The delete directory message is sent to delete an empty directory. The
* appropriate Tid and additional pathname are passed. The directory must
* be empty for it to be deleted.
*
* NT supports a hidden permission known as File Delete Child (FDC). If
* the user has FullControl access to a directory, the user is permitted
* to delete any object in the directory regardless of the permissions
* on the object.
*
* Client Request Description
* ================================== =================================
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes; min = 2
* UCHAR BufferFormat; 0x04
* STRING DirectoryName[]; Directory name
*
* The directory to be deleted cannot be the root of the share specified
* by Tid.
*
* Server Response Description
* ================================== =================================
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes = 0
*/
{
int rc;
}
void
{
}
{
int rc;
return (SDRC_ERROR);
}
return (SDRC_ERROR);
}
if (rc != 0) {
return (SDRC_ERROR);
}
if (rc != 0) {
else
return (SDRC_ERROR);
}
/*
* Delete should fail if this is the root of a share
* or a DFS link
*/
return (SDRC_ERROR);
}
return (SDRC_ERROR);
}
/*
* Using kcred because we just want the DOS attrs
* and don't want access errors for this.
*/
if (rc != 0) {
return (SDRC_ERROR);
}
!= NT_STATUS_SUCCESS)) {
return (SDRC_ERROR);
}
if (SMB_TREE_SUPPORTS_CATIA(sr))
if (rc != 0) {
else
return (SDRC_ERROR);
}
}
/*
* This SMB is used to verify that a path exists and is a directory. No
* error is returned if the given path exists and the client has read
* access to it. Client machines which maintain a concept of a "working
* directory" will find this useful to verify the validity of a "change
* working directory" command. Note that the servers do NOT have a concept
* of working directory for a particular client. The client must always
* supply full pathnames relative to the Tid in the SMB header.
*
* Client Request Description
* ================================== =================================
*
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes; min = 2
* UCHAR BufferFormat; 0x04
* STRING DirectoryPath[]; Directory path
*
* Server Response Description
* ================================== =================================
*
* UCHAR WordCount; Count of parameter words = 0
* USHORT ByteCount; Count of data bytes = 0
*
* DOS clients, in particular, depend on ERRbadpath if the directory is
* not found.
*/
{
int rc;
}
void
{
}
{
int rc;
char *path;
return (SDRC_ERROR);
}
}
return (SDRC_ERROR);
}
if (rc != 0) {
return (SDRC_ERROR);
}
if (rc != 0) {
else
return (SDRC_ERROR);
}
if (!smb_node_is_dir(node)) {
return (SDRC_ERROR);
}
return (SDRC_ERROR);
}
if (rc != 0) {
return (SDRC_ERROR);
}
}