1da6c28aaSamw /* 2da6c28aaSamw * CDDL HEADER START 3da6c28aaSamw * 4da6c28aaSamw * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 7da6c28aaSamw * 8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da6c28aaSamw * or http://www.opensolaris.org/os/licensing. 10da6c28aaSamw * See the License for the specific language governing permissions 11da6c28aaSamw * and limitations under the License. 12da6c28aaSamw * 13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each 14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the 16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying 17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner] 18da6c28aaSamw * 19da6c28aaSamw * CDDL HEADER END 20da6c28aaSamw */ 21da6c28aaSamw /* 22f96bd5c8SAlan Wright * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23da6c28aaSamw * Use is subject to license terms. 24*b819cea2SGordon Ross * 25*b819cea2SGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved. 26da6c28aaSamw */ 27da6c28aaSamw 28da6c28aaSamw #ifndef _SMB_IDMAP_H 29da6c28aaSamw #define _SMB_IDMAP_H 30da6c28aaSamw 31*b819cea2SGordon Ross #if defined(_KERNEL) /* intentionally not || defined(_FAKE_KERNEL) */ 32da6c28aaSamw #include <sys/kidmap.h> 33da6c28aaSamw #else 34da6c28aaSamw #include <idmap.h> 35da6c28aaSamw #endif 36da6c28aaSamw 376537f381Sas200622 #include <smbsrv/smb_sid.h> 38da6c28aaSamw 39da6c28aaSamw #ifdef __cplusplus 40da6c28aaSamw extern "C" { 41da6c28aaSamw #endif 42da6c28aaSamw 43da6c28aaSamw /* 44da6c28aaSamw * SMB ID mapping 45da6c28aaSamw * 46da6c28aaSamw * Solaris ID mapping service (aka Winchester) works with domain SIDs 47da6c28aaSamw * and RIDs where domain SIDs are in string format. CIFS service works 48da6c28aaSamw * with binary SIDs understanable by CIFS clients. A layer of SMB ID 49da6c28aaSamw * mapping functions are implemeted to hide the SID conversion details 50da6c28aaSamw * and also hide the handling of array of batch mapping requests. 51da6c28aaSamw */ 52da6c28aaSamw 53da6c28aaSamw #define SMB_IDMAP_UNKNOWN -1 54da6c28aaSamw #define SMB_IDMAP_GROUP 0 55da6c28aaSamw #define SMB_IDMAP_USER 1 56f96bd5c8SAlan Wright #define SMB_IDMAP_OWNERAT 2 57f96bd5c8SAlan Wright #define SMB_IDMAP_GROUPAT 3 58f96bd5c8SAlan Wright #define SMB_IDMAP_EVERYONE 4 59da6c28aaSamw 60da6c28aaSamw #define SMB_IDMAP_SID2ID 0x0001 61da6c28aaSamw #define SMB_IDMAP_ID2SID 0x0002 62da6c28aaSamw 63da6c28aaSamw /* 64da6c28aaSamw * smb_idmap_t 65da6c28aaSamw * 66da6c28aaSamw * sim_idtype: ID type (output in sid->uid mapping) 67da6c28aaSamw * sim_id: UID/GID (output in sid->uid mapping) 68da6c28aaSamw */ 69da6c28aaSamw typedef struct smb_idmap { 70da6c28aaSamw int sim_idtype; 71da6c28aaSamw uid_t *sim_id; 72da6c28aaSamw char *sim_domsid; 73da6c28aaSamw uint32_t sim_rid; 746537f381Sas200622 smb_sid_t *sim_sid; 75da6c28aaSamw idmap_stat sim_stat; 76da6c28aaSamw } smb_idmap_t; 77da6c28aaSamw 78da6c28aaSamw typedef struct smb_idmap_batch { 79da6c28aaSamw uint16_t sib_nmap; 80da6c28aaSamw uint32_t sib_flags; 81da6c28aaSamw uint32_t sib_size; 82da6c28aaSamw smb_idmap_t *sib_maps; 83da6c28aaSamw idmap_get_handle_t *sib_idmaph; 84da6c28aaSamw } smb_idmap_batch_t; 85da6c28aaSamw 866537f381Sas200622 idmap_stat smb_idmap_getsid(uid_t, int, smb_sid_t **); 876537f381Sas200622 idmap_stat smb_idmap_getid(smb_sid_t *, uid_t *, int *); 88da6c28aaSamw 89da6c28aaSamw void smb_idmap_batch_destroy(smb_idmap_batch_t *); 90da6c28aaSamw idmap_stat smb_idmap_batch_create(smb_idmap_batch_t *, uint16_t, int); 91da6c28aaSamw idmap_stat smb_idmap_batch_getmappings(smb_idmap_batch_t *); 92da6c28aaSamw idmap_stat smb_idmap_batch_getid(idmap_get_handle_t *, smb_idmap_t *, 936537f381Sas200622 smb_sid_t *, int); 94da6c28aaSamw idmap_stat smb_idmap_batch_getsid(idmap_get_handle_t *, smb_idmap_t *, 95da6c28aaSamw uid_t, int); 96da6c28aaSamw 97da6c28aaSamw #ifdef __cplusplus 98da6c28aaSamw } 99da6c28aaSamw #endif 100da6c28aaSamw 101da6c28aaSamw 102da6c28aaSamw #endif /* _SMB_IDMAP_H */ 103