/*
* 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.
*/
#ifndef _SMB_SID_H
#define _SMB_SID_H
/*
* Security Identifier (SID) interface definition.
*/
#include <smbsrv/wintypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Predefined global user RIDs.
*/
/*
* Predefined global group RIDs.
*/
/*
* Predefined local alias RIDs.
*/
/*
* Universal and NT well-known SIDs
*/
/*
* SID type indicators (SID_NAME_USE).
*/
#define SidTypeNull 0
/*
* Identifier authorities for various domains.
*/
#define NT_SID_NULL_AUTH 0
#define NT_SECURITY_NULL_AUTH {0, 0, 0, 0, 0, 0}
/*
* Common definition for a SID.
*/
/*
* Security Identifier (SID)
*
* The security identifier (SID) uniquely identifies a user, group or
* a domain. It consists of a revision number, the identifier authority,
* and a list of sub-authorities. The revision number is currently 1.
* The identifier authority identifies which system issued the SID. The
* sub-authorities of a domain SID uniquely identify a domain. A user
* or group SID consists of a domain SID with the user or group id
* appended. The user or group id (also known as a relative id (RID)
* uniquely identifies a user within a domain. A user or group SID
* uniquely identifies a user or group across all domains. The SidType
* values identify the various types of SID.
*
* 1 1 1 1 1 1
* 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---------------------------------------------------------------+
* | SubAuthorityCount |Reserved1 (SBZ)| Revision |
* +---------------------------------------------------------------+
* | IdentifierAuthority[0] |
* +---------------------------------------------------------------+
* | IdentifierAuthority[1] |
* +---------------------------------------------------------------+
* | IdentifierAuthority[2] |
* +---------------------------------------------------------------+
* | |
* +- - - - - - - - SubAuthority[] - - - - - - - - -+
* | |
* +---------------------------------------------------------------+
*
*/
/*
* Note: NT defines the Identifier Authority as a separate
* structure (SID_IDENTIFIER_AUTHORITY) containing a literal
* definition of a 6 byte vector but the effect is the same
* as defining it as a member value.
* See also: smb_sid_xdr()
*/
typedef struct smb_sid {
} smb_sid_t;
(NT_SID_AUTH_MAX * sizeof (uint8_t)) + \
(NT_SID_SUBAUTH_MAX * sizeof (uint32_t)))
/*
* Estimated number of sid_subauth is SECURITY_LOGON_IDS_RID_COUNT
* plus the DOMAIN_RID and the RID.
*/
(NT_SID_AUTH_MAX * sizeof (uint8_t)) + \
/*
* Only group attributes are defined. No user attributes defined.
*/
/*
* smb_id_t consists of both the Windows security identifier
* See also: smb_id_xdr()
*/
typedef struct smb_id {
} smb_id_t;
/*
* Array of smb_id_t
* See also: smb_ids_xdr()
*/
typedef struct smb_ids {
} smb_ids_t;
/*
* The maximum size of a SID in string format
*/
int smb_sid_len(smb_sid_t *);
void smb_sid_free(smb_sid_t *);
int smb_sid_splitstr(char *, uint32_t *);
void smb_sid_tostr(const smb_sid_t *, char *);
smb_sid_t *smb_sid_fromstr(const char *);
char *smb_sid_type2str(uint16_t);
void smb_ids_free(smb_ids_t *);
#ifdef __cplusplus
}
#endif
#endif /* _SMB_SID_H */