1185029Spjd/*
2185029Spjd * CDDL HEADER START
3185029Spjd *
4185029Spjd * The contents of this file are subject to the terms of the
5185029Spjd * Common Development and Distribution License (the "License").
6185029Spjd * You may not use this file except in compliance with the License.
7185029Spjd *
8185029Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9185029Spjd * or http://www.opensolaris.org/os/licensing.
10185029Spjd * See the License for the specific language governing permissions
11185029Spjd * and limitations under the License.
12185029Spjd *
13185029Spjd * When distributing Covered Code, include this CDDL HEADER in each
14185029Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15185029Spjd * If applicable, add the following below this CDDL HEADER, with the
16185029Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17185029Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18185029Spjd *
19185029Spjd * CDDL HEADER END
20185029Spjd */
21185029Spjd/*
22219089Spjd * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23185029Spjd * Use is subject to license terms.
24185029Spjd */
25185029Spjd
26185029Spjd#ifndef _SYS_IDMAP_H
27185029Spjd#define	_SYS_IDMAP_H
28185029Spjd
29185029Spjd
30185029Spjd/* Idmap status codes */
31185029Spjd#define	IDMAP_SUCCESS			0
32185029Spjd#define	IDMAP_NEXT			1
33185029Spjd#define	IDMAP_ERR_OTHER			-10000
34185029Spjd#define	IDMAP_ERR_INTERNAL		-9999
35185029Spjd#define	IDMAP_ERR_MEMORY		-9998
36185029Spjd#define	IDMAP_ERR_NORESULT		-9997
37185029Spjd#define	IDMAP_ERR_NOTUSER		-9996
38185029Spjd#define	IDMAP_ERR_NOTGROUP		-9995
39185029Spjd#define	IDMAP_ERR_NOTSUPPORTED		-9994
40185029Spjd#define	IDMAP_ERR_W2U_NAMERULE		-9993
41185029Spjd#define	IDMAP_ERR_U2W_NAMERULE		-9992
42185029Spjd#define	IDMAP_ERR_CACHE			-9991
43185029Spjd#define	IDMAP_ERR_DB			-9990
44185029Spjd#define	IDMAP_ERR_ARG			-9989
45185029Spjd#define	IDMAP_ERR_SID			-9988
46185029Spjd#define	IDMAP_ERR_IDTYPE		-9987
47185029Spjd#define	IDMAP_ERR_RPC_HANDLE		-9986
48185029Spjd#define	IDMAP_ERR_RPC			-9985
49185029Spjd#define	IDMAP_ERR_CLIENT_HANDLE		-9984
50185029Spjd#define	IDMAP_ERR_BUSY			-9983
51185029Spjd#define	IDMAP_ERR_PERMISSION_DENIED	-9982
52185029Spjd#define	IDMAP_ERR_NOMAPPING		-9981
53185029Spjd#define	IDMAP_ERR_NEW_ID_ALLOC_REQD	-9980
54185029Spjd#define	IDMAP_ERR_DOMAIN		-9979
55185029Spjd#define	IDMAP_ERR_SECURITY		-9978
56185029Spjd#define	IDMAP_ERR_NOTFOUND		-9977
57185029Spjd#define	IDMAP_ERR_DOMAIN_NOTFOUND	-9976
58185029Spjd#define	IDMAP_ERR_UPDATE_NOTALLOWED	-9975
59185029Spjd#define	IDMAP_ERR_CFG			-9974
60185029Spjd#define	IDMAP_ERR_CFG_CHANGE		-9973
61185029Spjd#define	IDMAP_ERR_NOTMAPPED_WELLKNOWN	-9972
62185029Spjd#define	IDMAP_ERR_RETRIABLE_NET_ERR	-9971
63185029Spjd#define	IDMAP_ERR_W2U_NAMERULE_CONFLICT	-9970
64185029Spjd#define	IDMAP_ERR_U2W_NAMERULE_CONFLICT	-9969
65185029Spjd#define	IDMAP_ERR_BAD_UTF8		-9968
66219089Spjd#define	IDMAP_ERR_NONE_GENERATED	-9967
67185029Spjd#define	IDMAP_ERR_PROP_UNKNOWN		-9966
68185029Spjd#define	IDMAP_ERR_NS_LDAP_OP_FAILED	-9965
69185029Spjd#define	IDMAP_ERR_NS_LDAP_PARTIAL	-9964
70185029Spjd#define	IDMAP_ERR_NS_LDAP_CFG		-9963
71185029Spjd#define	IDMAP_ERR_NS_LDAP_BAD_WINNAME	-9962
72219089Spjd#define	IDMAP_ERR_NO_ACTIVEDIRECTORY	-9961
73185029Spjd
74185029Spjd/* Reserved GIDs for some well-known SIDs */
75185029Spjd#define	IDMAP_WK_LOCAL_SYSTEM_GID	2147483648U /* 0x80000000 */
76185029Spjd#define	IDMAP_WK_CREATOR_GROUP_GID	2147483649U
77185029Spjd#define	IDMAP_WK__MAX_GID		2147483649U
78185029Spjd
79185029Spjd/* Reserved UIDs for some well-known SIDs */
80185029Spjd#define	IDMAP_WK_CREATOR_OWNER_UID	2147483648U
81185029Spjd#define	IDMAP_WK__MAX_UID		2147483648U
82185029Spjd
83185029Spjd/* Reserved SIDs */
84185029Spjd#define	IDMAP_WK_CREATOR_SID_AUTHORITY	"S-1-3"
85185029Spjd
86185029Spjd/*
87185029Spjd * Max door RPC size for ID mapping (can't be too large relative to the
88185029Spjd * default user-land thread stack size, since clnt_door_call()
89185029Spjd * alloca()s).  See libidmap:idmap_init().
90185029Spjd */
91185029Spjd#define	IDMAP_MAX_DOOR_RPC		(256 * 1024)
92185029Spjd
93219089Spjd#define	IDMAP_SENTINEL_PID		UINT32_MAX
94219089Spjd#define	IDMAP_ID_IS_EPHEMERAL(pid)	\
95219089Spjd	(((pid) > INT32_MAX) && ((pid) != IDMAP_SENTINEL_PID))
96219089Spjd
97185029Spjd#endif /* _SYS_IDMAP_H */
98