/*
* 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.
*/
#ifndef _SMBSRV_NTIFS_H
#define _SMBSRV_NTIFS_H
/*
* This file provides definitions compatible with the NT Installable
* File System (IFS) interface. This header file also defines the Security
* Descriptor module from Windows.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The Volume and Directory bits are for SMB rather than NT.
* NT has an explicit Normal bit; this bit is implied in SMB
* when the Hidden, System and Directory bits are not set.
*
* File attributes and creation flags share the same 32-bit
* space.
*/
/*
* SMB requests.
*
* The CreateOptions specify the options to be applied when creating or
* opening the file, as a compatible combination of the following flags:
*
* FILE_DIRECTORY_FILE
* The file being created or opened is a directory file. With this
* flag, the Disposition parameter must be set to one of FILE_CREATE,
* FILE_OPEN, or FILE_OPEN_IF. With this flag, other compatible
* CreateOptions flags include only the following:
* FILE_SYNCHRONOUS_IO_ALERT
* FILE_SYNCHRONOUS_IO_NONALERT
* FILE_WRITE_THROUGH
* FILE_OPEN_FOR_BACKUP_INTENT
* FILE_OPEN_BY_FILE_ID
*
* FILE_NON_DIRECTORY_FILE
* The file being opened must not be a directory file or this call
* will fail. The file object being opened can represent a data file,
* a logical, virtual, or physical device, or a volume.
*
* FILE_WRITE_THROUGH
* System services, FSDs, and drivers that write data to the file must
* actually transfer the data into the file before any requested write
* operation is considered complete. This flag is automatically set if
* the CreateOptions flag FILE_NO_INTERMEDIATE _BUFFERING is set.
*
* FILE_SEQUENTIAL_ONLY
* All accesses to the file will be sequential.
*
* FILE_RANDOM_ACCESS
* Accesses to the file can be random, so no sequential read-ahead
* operations should be performed on the file by FSDs or the system.
* FILE_NO_INTERMEDIATE _BUFFERING The file cannot be cached or
* buffered in a driver's internal buffers. This flag is incompatible
* with the DesiredAccess FILE_APPEND_DATA flag.
*
* FILE_SYNCHRONOUS_IO_ALERT
* All operations on the file are performed synchronously. Any wait
* on behalf of the caller is subject to premature termination from
* alerts. This flag also causes the I/O system to maintain the file
* position context. If this flag is set, the DesiredAccess
* SYNCHRONIZE flag also must be set.
*
* FILE_SYNCHRONOUS_IO _NONALERT
* All operations on the file are performed synchronously. Waits in
* the system to synchronize I/O queuing and completion are not subject
* to alerts. This flag also causes the I/O system to maintain the file
* position context. If this flag is set, the DesiredAccess SYNCHRONIZE
* flag also must be set.
*
* FILE_CREATE_TREE _CONNECTION
* Create a tree connection for this file in order to open it over the
* network. This flag is irrelevant to device and intermediate drivers.
*
* FILE_COMPLETE_IF_OPLOCKED
* Complete this operation immediately with an alternate success code
* if the target file is oplocked, rather than blocking the caller's
* thread. If the file is oplocked, another caller already has access
* to the file over the network. This flag is irrelevant to device and
* intermediate drivers.
*
* FILE_NO_EA_KNOWLEDGE
* If the extended attributes on an existing file being opened indicate
* that the caller must understand EAs to properly interpret the file,
* fail this request because the caller does not understand how to deal
* with EAs. Device and intermediate drivers can ignore this flag.
*
* FILE_DELETE_ON_CLOSE
* Delete the file when the last reference to it is passed to close.
*
* FILE_OPEN_BY_FILE_ID
* The file name contains the name of a device and a 64-bit ID to
* be used to open the file. This flag is irrelevant to device and
* intermediate drivers.
*
* FILE_OPEN_FOR_BACKUP _INTENT
* The file is being opened for backup intent, hence, the system should
* check for certain access rights and grant the caller the appropriate
* accesses to the file before checking the input DesiredAccess against
* the file's security descriptor. This flag is irrelevant to device
* and intermediate drivers.
*/
/* UNUSED 0x00000400 */
/*
* Define the file information class values used by the NT DDK and HAL.
*/
typedef enum _FILE_INFORMATION_CLASS {
/*
* Define the file system information class values.
*/
typedef enum _FILE_FS_INFORMATION_CLASS {
/*
* Discretionary Access Control List (DACL)
*
* A Discretionary Access Control List (DACL), often abbreviated to
* ACL, is a list of access controls which either allow or deny access
* for users or groups to a resource. There is a list header followed
* by a list of access control entries (ACE). Each ACE specifies the
* access allowed or denied to a single user or group (identified by
* a SID).
*
* There is another access control list object called a System Access
* Control List (SACL), which is used to control auditing, but no
* support is provideed for SACLs at this time.
*
* ACL header format:
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------------------------------+---------------+---------------+
* | AclSize | Sbz1 | AclRevision |
* +-------------------------------+---------------+---------------+
* | Sbz2 | AceCount |
* +-------------------------------+-------------------------------+
*
* AclRevision specifies the revision level of the ACL. This value should
* be ACL_REVISION, unless the ACL contains an object-specific ACE, in which
* case this value must be ACL_REVISION_DS. All ACEs in an ACL must be at the
* same revision level.
*
* ACE header format:
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---------------+-------+-------+---------------+---------------+
* | AceSize | AceFlags | AceType |
* +---------------+-------+-------+---------------+---------------+
*
* Access mask format:
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---------------+---------------+-------------------------------+
* |G|G|G|G|Res'd|A| StandardRights| SpecificRights |
* |R|W|E|A| |S| | |
* +-+-------------+---------------+-------------------------------+
*
* typedef struct ACCESS_MASK {
* WORD SpecificRights;
* BYTE StandardRights;
* BYTE AccessSystemAcl : 1;
* BYTE Reserved : 3;
* BYTE GenericAll : 1;
* BYTE GenericExecute : 1;
* BYTE GenericWrite : 1;
* BYTE GenericRead : 1;
* } ACCESS_MASK;
*
*/
/*
* Current ACE and ACL revision Levels
*/
#define ACCESS_ALLOWED_ACE_TYPE 0
/*
* se_flags
* ----------
* Specifies a set of ACE type-specific control flags. This member can be a
* combination of the following values.
*
* CONTAINER_INHERIT_ACE: Child objects that are containers, such as
* directories, inherit the ACE as an effective ACE. The inherited
* ACE is inheritable unless the NO_PROPAGATE_INHERIT_ACE bit flag
* is also set.
*
* INHERIT_ONLY_ACE: Indicates an inherit-only ACE which does not control
* access to the object to which it is attached.
* If this flag is not set,
* the ACE is an effective ACE which controls access to the object
* to which it is attached.
* Both effective and inherit-only ACEs can be inherited
* depending on the state of the other inheritance flags.
*
* INHERITED_ACE: Windows 2000/XP: Indicates that the ACE was inherited.
* The system sets this bit when it propagates an
* inherited ACE to a child object.
*
* NO_PROPAGATE_INHERIT_ACE: If the ACE is inherited by a child object, the
* system clears the OBJECT_INHERIT_ACE and CONTAINER_INHERIT_ACE
* flags in the inherited ACE.
* This prevents the ACE from being inherited by
* subsequent generations of objects.
*
* OBJECT_INHERIT_ACE: Noncontainer child objects inherit the ACE as an
* effective ACE. For child objects that are containers,
* the ACE is inherited as an inherit-only ACE unless the
* NO_PROPAGATE_INHERIT_ACE bit flag is also set.
*/
/*
* These flags are only used in system audit or alarm ACEs to
* indicate when an audit message should be generated, i.e.
* on successful access or on unsuccessful access.
*/
/*
* se_bsize is the size, in bytes, of ACE as it appears on the wire.
* se_sln is used to sort the ACL when it's required.
*/
typedef struct smb_acehdr {
} smb_acehdr_t;
typedef struct smb_ace {
} smb_ace_t;
/*
* sl_bsize is the size of ACL in bytes as it appears on the wire.
*/
typedef struct smb_acl {
} smb_acl_t;
/*
*/
/*
* Security Descriptor (SD)
*
* Security descriptors provide protection for objects, for example
* files and directories. It identifies the owner and primary group
* (SIDs) and contains an access control list. When a user tries to
* access an object his SID is compared to the permissions in the
* DACL to determine if access should be allowed or denied. Note that
* this is a simplification because there are other factors, such as
* default behavior and privileges to be taken into account (see also
* access tokens).
*
* The boolean flags have the following meanings when set:
*
* SE_OWNER_DEFAULTED indicates that the SID pointed to by the Owner
* field was provided by a defaulting mechanism rather than explicitly
* provided by the original provider of the security descriptor. This
* may affect the treatment of the SID with respect to inheritance of
* an owner.
*
* SE_GROUP_DEFAULTED indicates that the SID in the Group field was
* provided by a defaulting mechanism rather than explicitly provided
* by the original provider of the security descriptor. This may
* affect the treatment of the SID with respect to inheritance of a
* primary group.
*
* SE_DACL_PRESENT indicates that the security descriptor contains a
* discretionary ACL. If this flag is set and the Dacl field of the
* SECURITY_DESCRIPTOR is null, then a null ACL is explicitly being
* specified.
*
* SE_DACL_DEFAULTED indicates that the ACL pointed to by the Dacl
* field was provided by a defaulting mechanism rather than explicitly
* provided by the original provider of the security descriptor. This
* may affect the treatment of the ACL with respect to inheritance of
* an ACL. This flag is ignored if the DaclPresent flag is not set.
*
* SE_SACL_PRESENT indicates that the security descriptor contains a
* system ACL pointed to by the Sacl field. If this flag is set and
* the Sacl field of the SECURITY_DESCRIPTOR is null, then an empty
* (but present) ACL is being specified.
*
* SE_SACL_DEFAULTED indicates that the ACL pointed to by the Sacl
* field was provided by a defaulting mechanism rather than explicitly
* provided by the original provider of the security descriptor. This
* may affect the treatment of the ACL with respect to inheritance of
* an ACL. This flag is ignored if the SaclPresent flag is not set.
*
* SE_DACL_PROTECTED Prevents ACEs set on the DACL of the parent container
* (and any objects above the parent container in the directory hierarchy)
* from being applied to the object's DACL.
*
* SE_SACL_PROTECTED Prevents ACEs set on the SACL of the parent container
* (and any objects above the parent container in the directory hierarchy)
* from being applied to the object's SACL.
*
* Note that the SE_DACL_PRESENT flag needs to be present to set
* SE_DACL_PROTECTED and SE_SACL_PRESENT needs to be present to set
* SE_SACL_PROTECTED.
*
* SE_SELF_RELATIVE indicates that the security descriptor is in self-
* relative form. In this form, all fields of the security descriptor
* are contiguous in memory and all pointer fields are expressed as
* offsets from the beginning of the security descriptor.
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---------------------------------------------------------------+
* | Control |Reserved1 (SBZ)| Revision |
* +---------------------------------------------------------------+
* | Owner |
* +---------------------------------------------------------------+
* | Group |
* +---------------------------------------------------------------+
* | Sacl |
* +---------------------------------------------------------------+
* | Dacl |
* +---------------------------------------------------------------+
*
*/
/*
* Security descriptor structures:
*
* smb_sd_t SD in SMB pointer form
* smb_fssd_t SD in filesystem form
*
* to SD. The items comprising a SMB SD are kept separately in
* filesystem. smb_fssd_t is introduced as a helper to provide
* the required abstraction for CIFS code.
*/
typedef struct smb_sd {
} smb_sd_t;
/*
* SD header size as it appears on the wire
*/
/*
* values for smb_fssd.sd_flags
*/
typedef struct smb_fssd {
} smb_fssd_t;
void smb_sd_term(smb_sd_t *);
void smb_fssd_term(smb_fssd_t *);
void smb_acl_sort(smb_acl_t *);
void smb_acl_free(smb_acl_t *);
void smb_fsacl_free(acl_t *);
acl_t *smb_fsacl_alloc(int, int);
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_NTIFS_H */