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 file contains private definitions.
32 #ifndef _KIDMAP_PRIV_H
33 #define _KIDMAP_PRIV_H
41 typedef struct sid2pid
{
43 struct sid2pid
*flink
;
44 struct sid2pid
*blink
;
45 const char *sid_prefix
;
55 typedef struct pid2sid
{
57 struct pid2sid
*flink
;
58 struct pid2sid
*blink
;
59 const char *sid_prefix
;
67 typedef struct idmap_sid2pid_cache
{
75 } idmap_sid2pid_cache_t
;
78 typedef struct idmap_pid2sid_cache
{
83 } idmap_pid2sid_cache_t
;
87 * There is a cache for every mapping request because a group SID
88 * on Windows can be set in a file owner field and versa-visa.
89 * To stop this causing problems on Solaris a SID can map to
90 * both a UID and a GID.
92 typedef struct idmap_cache
{
93 idmap_sid2pid_cache_t sid2pid
;
94 idmap_pid2sid_cache_t uid2sid
;
95 idmap_pid2sid_cache_t gid2sid
;
100 kidmap_cache_create(idmap_cache_t
*cache
);
103 kidmap_cache_delete(idmap_cache_t
*cache
);
106 kidmap_cache_purge(idmap_cache_t
*cache
);
110 kidmap_cache_lookup_uidbysid(idmap_cache_t
*cache
, const char *sid_prefix
,
111 uint32_t rid
, uid_t
*uid
);
114 kidmap_cache_lookup_gidbysid(idmap_cache_t
*cache
, const char *sid_prefix
,
115 uint32_t rid
, gid_t
*gid
);
118 kidmap_cache_lookup_pidbysid(idmap_cache_t
*cache
, const char *sid_prefix
,
119 uint32_t rid
, uid_t
*pid
, int *is_user
);
122 kidmap_cache_lookup_sidbyuid(idmap_cache_t
*cache
, const char **sid_prefix
,
123 uint32_t *rid
, uid_t uid
);
126 kidmap_cache_lookup_sidbygid(idmap_cache_t
*cache
, const char **sid_prefix
,
127 uint32_t *rid
, gid_t gid
);
131 kidmap_cache_add_sid2uid(idmap_cache_t
*cache
, const char *sid_prefix
,
132 uint32_t rid
, uid_t uid
, int direction
);
135 kidmap_cache_add_sid2gid(idmap_cache_t
*cache
, const char *sid_prefix
,
136 uint32_t rid
, gid_t gid
, int direction
);
139 kidmap_cache_add_sid2pid(idmap_cache_t
*cache
, const char *sid_prefix
,
140 uint32_t rid
, uid_t pid
, int is_user
, int direction
);
142 kidmap_cache_get_data(idmap_cache_t
*cache
, size_t *uidbysid
, size_t *gidbysid
,
143 size_t *pidbysid
, size_t *sidbyuid
, size_t *sidbygid
);
151 kidmap_sid_prefix_store_init(void);
154 kidmap_find_sid_prefix(const char *sid_prefix
);
160 #endif /* _KIDMAP_PRIV_H */