14520Snw141292 /* 24520Snw141292 * CDDL HEADER START 34520Snw141292 * 44520Snw141292 * The contents of this file are subject to the terms of the 54520Snw141292 * Common Development and Distribution License (the "License"). 64520Snw141292 * You may not use this file except in compliance with the License. 74520Snw141292 * 84520Snw141292 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 94520Snw141292 * or http://www.opensolaris.org/os/licensing. 104520Snw141292 * See the License for the specific language governing permissions 114520Snw141292 * and limitations under the License. 124520Snw141292 * 134520Snw141292 * When distributing Covered Code, include this CDDL HEADER in each 144520Snw141292 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 154520Snw141292 * If applicable, add the following below this CDDL HEADER, with the 164520Snw141292 * fields enclosed by brackets "[]" replaced with your own identifying 174520Snw141292 * information: Portions Copyright [yyyy] [name of copyright owner] 184520Snw141292 * 194520Snw141292 * CDDL HEADER END 204520Snw141292 */ 214520Snw141292 224520Snw141292 /* 23*5771Sjp151216 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 244520Snw141292 * Use is subject to license terms. 254520Snw141292 */ 264520Snw141292 274520Snw141292 /* 284520Snw141292 * Windows to Solaris Identity Mapping kernel API 294520Snw141292 * This header defines an API to map Windows SIDs to 304520Snw141292 * Solaris UID and GIDs and versa visa. 314520Snw141292 */ 324520Snw141292 334520Snw141292 #ifndef _SYS_KIDMAP_H 344520Snw141292 #define _SYS_KIDMAP_H 354520Snw141292 364520Snw141292 #pragma ident "%Z%%M% %I% %E% SMI" 374520Snw141292 384520Snw141292 #include <sys/idmap.h> 394520Snw141292 #include <sys/door.h> 40*5771Sjp151216 #include <sys/zone.h> 414520Snw141292 424520Snw141292 #ifdef __cplusplus 434520Snw141292 extern "C" { 444520Snw141292 #endif 454520Snw141292 464520Snw141292 /* Opaque get handle */ 474520Snw141292 typedef struct idmap_get_handle idmap_get_handle_t; 484520Snw141292 494520Snw141292 /* Return status */ 504520Snw141292 typedef int32_t idmap_stat; 514520Snw141292 524520Snw141292 /* 534520Snw141292 * In all the routines a Windows SID is handled as a 544520Snw141292 * string SID prefix plus a RID. For example 554520Snw141292 * 564520Snw141292 * S-1-5-5-12-34-568 will be passed as SID prefix 574520Snw141292 * S-1-5-5-12-34 and RID 568 584520Snw141292 * 594520Snw141292 * Certain routines returns pointers to a SID prefix string. 604520Snw141292 * These strings are stored internally and should not be modified 614520Snw141292 * or freed. 624520Snw141292 */ 634520Snw141292 644520Snw141292 654520Snw141292 /* 664520Snw141292 * The following routines are simple get ID mapping routines. 674520Snw141292 */ 684520Snw141292 694520Snw141292 704520Snw141292 idmap_stat 71*5771Sjp151216 kidmap_getuidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid, 72*5771Sjp151216 uid_t *uid); 734520Snw141292 744520Snw141292 idmap_stat 75*5771Sjp151216 kidmap_getgidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid, 76*5771Sjp151216 gid_t *gid); 774520Snw141292 784520Snw141292 idmap_stat 79*5771Sjp151216 kidmap_getpidbysid(zone_t *zone, const char *sid_prefix, uint32_t rid, 80*5771Sjp151216 uid_t *pid, int *is_user); 814520Snw141292 824520Snw141292 idmap_stat 83*5771Sjp151216 kidmap_getsidbyuid(zone_t *zone, uid_t uid, const char **sid_prefix, 84*5771Sjp151216 uint32_t *rid); 854520Snw141292 864520Snw141292 idmap_stat 87*5771Sjp151216 kidmap_getsidbygid(zone_t *zone, gid_t gid, const char **sid_prefix, 88*5771Sjp151216 uint32_t *rid); 894520Snw141292 904520Snw141292 914520Snw141292 924520Snw141292 /* 934520Snw141292 * The following routines provide a batch interface for mapping IDs. 944520Snw141292 */ 954520Snw141292 964520Snw141292 /* 974520Snw141292 * Create a batch "get mapping" handle for batch mappings. 984520Snw141292 */ 994520Snw141292 idmap_get_handle_t * 100*5771Sjp151216 kidmap_get_create(zone_t *zone); 1014520Snw141292 1024520Snw141292 /* 1034520Snw141292 * These routines queue the request to the "get mapping" handle 1044520Snw141292 */ 1054520Snw141292 1064520Snw141292 idmap_stat 1074520Snw141292 kidmap_batch_getuidbysid(idmap_get_handle_t *get_handle, 1084520Snw141292 const char *sid_prefix, uint32_t rid, 1094520Snw141292 uid_t *uid, idmap_stat *stat); 1104520Snw141292 1114520Snw141292 idmap_stat 1124520Snw141292 kidmap_batch_getgidbysid(idmap_get_handle_t *get_handle, 1134520Snw141292 const char *sid_prefix, uint32_t rid, 1144520Snw141292 gid_t *gid, idmap_stat *stat); 1154520Snw141292 1164520Snw141292 idmap_stat 1174520Snw141292 kidmap_batch_getpidbysid(idmap_get_handle_t *get_handle, 1184520Snw141292 const char *sid_prefix, uint32_t rid, 1194520Snw141292 uid_t *pid, int *is_user, idmap_stat *stat); 1204520Snw141292 1214520Snw141292 idmap_stat 1224520Snw141292 kidmap_batch_getsidbyuid(idmap_get_handle_t *get_handle, uid_t uid, 1234520Snw141292 const char **sid_prefix, uint32_t *rid, idmap_stat *stat); 1244520Snw141292 1254520Snw141292 idmap_stat 1264520Snw141292 kidmap_batch_getsidbygid(idmap_get_handle_t *get_handle, gid_t gid, 1274520Snw141292 const char **sid_prefix, uint32_t *rid, idmap_stat *stat); 1284520Snw141292 1294520Snw141292 /* 1304520Snw141292 * Process the queued "get mapping" requests. The results (i.e. 1314520Snw141292 * status and identity) will be available in the data areas 1324520Snw141292 * provided by individual requests. 1334520Snw141292 */ 1344520Snw141292 idmap_stat 1354520Snw141292 kidmap_get_mappings(idmap_get_handle_t *get_handle); 1364520Snw141292 1374520Snw141292 /* 1384520Snw141292 * Destroy the "get mapping" handle 1394520Snw141292 */ 1404520Snw141292 void 1414520Snw141292 kidmap_get_destroy(idmap_get_handle_t *get_handle); 1424520Snw141292 1434520Snw141292 /* 1444520Snw141292 * Functions that do the hard part of door registration/unregistration 1454520Snw141292 * for the idmap_reg()/idmap_unreg() syscalls 1464520Snw141292 */ 147*5771Sjp151216 int idmap_reg_dh(zone_t *zone, door_handle_t dh); 148*5771Sjp151216 int idmap_unreg_dh(zone_t *zone, door_handle_t dh); 1494520Snw141292 1504520Snw141292 /* 151*5771Sjp151216 * Function needed by allocids() to ensure only the daemon that owns 1524520Snw141292 * the door gets ephemeral IDS 1534520Snw141292 */ 154*5771Sjp151216 door_handle_t idmap_get_door(zone_t *zone); 1554520Snw141292 156*5771Sjp151216 /* 157*5771Sjp151216 * Function used by system call allocids() to purge the 158*5771Sjp151216 * ID mapping cache 159*5771Sjp151216 */ 160*5771Sjp151216 void idmap_purge_cache(zone_t *zone); 161*5771Sjp151216 1624520Snw141292 1634520Snw141292 #ifdef __cplusplus 1644520Snw141292 } 1654520Snw141292 #endif 1664520Snw141292 1674520Snw141292 #endif /* _SYS_KIDMAP_H */ 168