4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Windows to Solaris Identity Mapping kernel API
29 * This header defines an API to map Windows SIDs to
30 * Solaris UID and GIDs and versa visa.
36 #pragma ident "%Z%%M% %I% %E% SMI"
38 #include <sys/idmap.h>
46 /* Opaque get handle */
47 typedef struct idmap_get_handle idmap_get_handle_t
;
50 typedef int32_t idmap_stat
;
53 * In all the routines a Windows SID is handled as a
54 * string SID prefix plus a RID. For example
56 * S-1-5-5-12-34-568 will be passed as SID prefix
57 * S-1-5-5-12-34 and RID 568
59 * Certain routines returns pointers to a SID prefix string.
60 * These strings are stored internally and should not be modified
66 * The following routines are simple get ID mapping routines.
71 kidmap_getuidbysid(zone_t
*zone
, const char *sid_prefix
, uint32_t rid
,
75 kidmap_getgidbysid(zone_t
*zone
, const char *sid_prefix
, uint32_t rid
,
79 kidmap_getpidbysid(zone_t
*zone
, const char *sid_prefix
, uint32_t rid
,
80 uid_t
*pid
, int *is_user
);
83 kidmap_getsidbyuid(zone_t
*zone
, uid_t uid
, const char **sid_prefix
,
87 kidmap_getsidbygid(zone_t
*zone
, gid_t gid
, const char **sid_prefix
,
93 * The following routines provide a batch interface for mapping IDs.
97 * Create a batch "get mapping" handle for batch mappings.
100 kidmap_get_create(zone_t
*zone
);
103 * These routines queue the request to the "get mapping" handle
107 kidmap_batch_getuidbysid(idmap_get_handle_t
*get_handle
,
108 const char *sid_prefix
, uint32_t rid
,
109 uid_t
*uid
, idmap_stat
*stat
);
112 kidmap_batch_getgidbysid(idmap_get_handle_t
*get_handle
,
113 const char *sid_prefix
, uint32_t rid
,
114 gid_t
*gid
, idmap_stat
*stat
);
117 kidmap_batch_getpidbysid(idmap_get_handle_t
*get_handle
,
118 const char *sid_prefix
, uint32_t rid
,
119 uid_t
*pid
, int *is_user
, idmap_stat
*stat
);
122 kidmap_batch_getsidbyuid(idmap_get_handle_t
*get_handle
, uid_t uid
,
123 const char **sid_prefix
, uint32_t *rid
, idmap_stat
*stat
);
126 kidmap_batch_getsidbygid(idmap_get_handle_t
*get_handle
, gid_t gid
,
127 const char **sid_prefix
, uint32_t *rid
, idmap_stat
*stat
);
130 * Process the queued "get mapping" requests. The results (i.e.
131 * status and identity) will be available in the data areas
132 * provided by individual requests.
135 kidmap_get_mappings(idmap_get_handle_t
*get_handle
);
138 * Destroy the "get mapping" handle
141 kidmap_get_destroy(idmap_get_handle_t
*get_handle
);
144 * Functions that do the hard part of door registration/unregistration
145 * for the idmap_reg()/idmap_unreg() syscalls
147 int idmap_reg_dh(zone_t
*zone
, door_handle_t dh
);
148 int idmap_unreg_dh(zone_t
*zone
, door_handle_t dh
);
151 * Function needed by allocids() to ensure only the daemon that owns
152 * the door gets ephemeral IDS
154 door_handle_t
idmap_get_door(zone_t
*zone
);
157 * Function used by system call allocids() to purge the
160 void idmap_purge_cache(zone_t
*zone
);
167 #endif /* _SYS_KIDMAP_H */