5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SMB_IDMAP_H
29 #define _SMB_IDMAP_H
30
31 #if defined(_KERNEL) /* intentionally not || defined(_FAKE_KERNEL) */
32 #include <sys/kidmap.h>
33 #else
34 #include <idmap.h>
35 #endif
36
37 #include <smbsrv/smb_sid.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * SMB ID mapping
45 *
46 * Solaris ID mapping service (aka Winchester) works with domain SIDs
47 * and RIDs where domain SIDs are in string format. CIFS service works
48 * with binary SIDs understanable by CIFS clients. A layer of SMB ID
49 * mapping functions are implemeted to hide the SID conversion details
50 * and also hide the handling of array of batch mapping requests.
51 */
52
53 #define SMB_IDMAP_UNKNOWN -1
54 #define SMB_IDMAP_GROUP 0
55 #define SMB_IDMAP_USER 1
56 #define SMB_IDMAP_OWNERAT 2
57 #define SMB_IDMAP_GROUPAT 3
58 #define SMB_IDMAP_EVERYONE 4
59
60 #define SMB_IDMAP_SID2ID 0x0001
61 #define SMB_IDMAP_ID2SID 0x0002
62
63 /*
64 * smb_idmap_t
65 *
66 * sim_idtype: ID type (output in sid->uid mapping)
67 * sim_id: UID/GID (output in sid->uid mapping)
68 */
69 typedef struct smb_idmap {
70 int sim_idtype;
71 uid_t *sim_id;
72 char *sim_domsid;
73 uint32_t sim_rid;
74 smb_sid_t *sim_sid;
75 idmap_stat sim_stat;
76 } smb_idmap_t;
77
78 typedef struct smb_idmap_batch {
79 uint16_t sib_nmap;
80 uint32_t sib_flags;
81 uint32_t sib_size;
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SMB_IDMAP_H
29 #define _SMB_IDMAP_H
30
31 #if defined(_KERNEL) /* intentionally not || defined(_FAKE_KERNEL) */
32 #include <sys/kidmap.h>
33 #else
34 #include <idmap.h>
35 #endif
36
37 #include <smbsrv/smb_sid.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * SMB ID mapping
45 *
46 * Solaris ID mapping service (aka Winchester) works with domain SIDs
47 * and RIDs where domain SIDs are in string format. CIFS service works
48 * with binary SIDs understanable by CIFS clients. A layer of SMB ID
49 * mapping functions are implemeted to hide the SID conversion details
50 * and also hide the handling of array of batch mapping requests.
51 */
52
53 #define SMB_IDMAP_UNKNOWN -1
54 #define SMB_IDMAP_GROUP 0
55 #define SMB_IDMAP_USER 1
56 #define SMB_IDMAP_OWNERAT 2
57 #define SMB_IDMAP_GROUPAT 3
58 #define SMB_IDMAP_EVERYONE 4
59
60 #define SMB_IDMAP_SID2ID 0x0001
61 #define SMB_IDMAP_ID2SID 0x0002
62 #define SMB_IDMAP_SKIP_ERRS 0x0004
63
64 /*
65 * smb_idmap_t
66 *
67 * sim_idtype: ID type (output in sid->uid mapping)
68 * sim_id: UID/GID (output in sid->uid mapping)
69 */
70 typedef struct smb_idmap {
71 int sim_idtype;
72 uid_t *sim_id;
73 char *sim_domsid;
74 uint32_t sim_rid;
75 smb_sid_t *sim_sid;
76 idmap_stat sim_stat;
77 } smb_idmap_t;
78
79 typedef struct smb_idmap_batch {
80 uint16_t sib_nmap;
81 uint32_t sib_flags;
82 uint32_t sib_size;
|