Print this page
1575 untangle libmlrpc ... (smbsrv)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/smbsrv/smb_share.h
+++ new/usr/src/uts/common/smbsrv/smb_share.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 /*
23 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 25 * Copyright (c) 2016 by Delphix. All rights reserved.
26 26 */
27 27
28 28 #ifndef _SMB_SHARE_H
29 29 #define _SMB_SHARE_H
30 30
31 31 #include <sys/param.h>
32 +#include <smb/lmerr.h>
33 +#include <smb/wintypes.h>
32 34 #include <smbsrv/string.h>
33 35 #include <smbsrv/smb_inet.h>
34 36 #include <smbsrv/hash_table.h>
35 -#include <smbsrv/wintypes.h>
36 -#include <smb/lmerr.h>
37 37
38 38 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
39 39 #include <libshare.h>
40 40 #endif
41 41
42 42 #ifdef __cplusplus
43 43 extern "C" {
44 44 #endif
45 45
46 46 #define SMB_CVOL "/var/smb/cvol"
47 47 #define SMB_SYSROOT SMB_CVOL "/windows"
48 48 #define SMB_SYSTEM32 SMB_SYSROOT "/system32"
49 49 #define SMB_VSS SMB_SYSTEM32 "/vss"
50 50
51 51 /* Exported named pipes are in... */
52 52 #define SMB_PIPE_DIR "/var/smb/pipe"
53 53
54 54 /*
55 55 * Share Properties:
56 56 *
57 57 * name Advertised name of the share
58 58 *
59 59 * ad-container Active directory container in which the share
60 60 * will be published
61 61 *
62 62 * abe Determines whether Access Based Enumeration is applied
63 63 * to a share
64 64 *
65 65 * csc Client-side caching (CSC) options applied to this share
66 66 * disabled The client MUST NOT cache any files
67 67 * manual The client should not automatically cache every file
68 68 * that it opens
69 69 * auto The client may cache every file that it opens
70 70 * vdo The client may cache every file that it opens
71 71 * and satisfy file requests from its local cache.
72 72 *
73 73 * catia CATIA character substitution
74 74 *
75 75 * guestok Determines whether guest access is allowed
76 76 *
77 77 * next three properties use access-list a al NFS
78 78 *
79 79 * ro list of hosts that will have read-only access
80 80 * rw list of hosts that will have read/write access
81 81 * none list of hosts that won't be allowed access
82 82 */
83 83 #define SHOPT_AD_CONTAINER "ad-container"
84 84 #define SHOPT_ABE "abe"
85 85 #define SHOPT_NAME "name"
86 86 #define SHOPT_CSC "csc"
87 87 #define SHOPT_CATIA "catia"
88 88 #define SHOPT_GUEST "guestok"
89 89 #define SHOPT_RO "ro"
90 90 #define SHOPT_RW "rw"
91 91 #define SHOPT_NONE "none"
92 92 #define SHOPT_DFSROOT "dfsroot"
93 93 #define SHOPT_DESCRIPTION "description"
94 94
95 95 #define SMB_DEFAULT_SHARE_GROUP "smb"
96 96 #define SMB_PROTOCOL_NAME "smb"
97 97
98 98 /*
99 99 * RAP protocol share related commands only understand
100 100 * share names in OEM format and there is a 13 char size
101 101 * limitation
102 102 */
103 103 #define SMB_SHARE_OEMNAME_MAX 13
104 104 #define SMB_SHARE_NTNAME_MAX 81
105 105 #define SMB_SHARE_CMNT_MAX (64 * MTS_MB_CHAR_MAX)
106 106
107 107 /*
108 108 * struct SHARE_INFO_1 {
109 109 * char shi1_netname[13]
110 110 * char shi1_pad;
111 111 * unsigned short shi1_type
112 112 * char *shi1_remark;
113 113 * }
114 114 */
115 115 #define SHARE_INFO_1_SIZE (SMB_SHARE_OEMNAME_MAX + 1 + 2 + 4)
116 116
117 117 /*
118 118 * Share flags:
119 119 *
120 120 * There are two types of flags:
121 121 *
122 122 * - flags that represent a share property
123 123 * - other flags set at runtime
124 124 *
125 125 * Property flags:
126 126 *
127 127 * SMB_SHRF_CSC_DISABLED Client-side caching is disabled for this share
128 128 * SMB_SHRF_CSC_MANUAL Manual client-side caching is allowed
129 129 * SMB_SHRF_CSC_AUTO Automatic client-side caching (CSC) is allowed
130 130 * SMB_SHRF_CSC_VDO Automatic CSC and local cache lookup is allowed
131 131 * SMB_SHRF_ACC_OPEN No restrictions set
132 132 * SMB_SHRF_ACC_NONE "none" property set
133 133 * SMB_SHRF_ACC_RO "ro" (readonly) property set
134 134 * SMB_SHRF_ACC_RW "rw" (read/write) property set
135 135 * SMB_SHRF_ACC_ALL All of the access bits
136 136 * SMB_SHRF_CATIA CATIA character translation on/off
137 137 * SMB_SHRF_GUEST_OK Guest access on/off
138 138 * SMB_SHRF_ABE Access Based Enumeration on/off
139 139 * SMB_SHRF_DFSROOT Share is a standalone DFS root
140 140 *
141 141 * Runtime flags:
142 142 *
143 143 * SMB_SHRF_TRANS Transient share
144 144 * SMB_SHRF_PERM Permanent share
145 145 * SMB_SHRF_AUTOHOME Autohome share.
146 146 * SMB_SHRF_ADMIN Admin share
147 147 *
148 148 * All autohome shares are transient but not all transient shares are autohome.
149 149 * IPC$ and drive letter shares (e.g. d$, e$, etc) are transient but
150 150 * not autohome.
151 151 */
152 152
153 153 /*
154 154 * Property flags
155 155 */
156 156 #define SMB_SHRF_DFSROOT 0x0001
157 157 #define SMB_SHRF_CATIA 0x0002
158 158 #define SMB_SHRF_GUEST_OK 0x0004
159 159 #define SMB_SHRF_ABE 0x0008
160 160
161 161 #define SMB_SHRF_CSC_DISABLED 0x0010
162 162 #define SMB_SHRF_CSC_MANUAL 0x0020
163 163 #define SMB_SHRF_CSC_AUTO 0x0040
164 164 #define SMB_SHRF_CSC_VDO 0x0080
165 165 #define SMB_SHRF_CSC_MASK 0x00F0
166 166
167 167 #define SMB_SHRF_ACC_OPEN 0x0000
168 168 #define SMB_SHRF_ACC_NONE 0x0100
169 169 #define SMB_SHRF_ACC_RO 0x0200
170 170 #define SMB_SHRF_ACC_RW 0x0400
171 171 #define SMB_SHRF_ACC_ALL 0x0F00
172 172
173 173 /*
174 174 * Runtime flags
175 175 */
176 176 #define SMB_SHRF_ADMIN 0x01000000
177 177 #define SMB_SHRF_TRANS 0x10000000
178 178 #define SMB_SHRF_PERM 0x20000000
179 179 #define SMB_SHRF_AUTOHOME 0x40000000
180 180
181 181 #define SMB_SHARE_PRINT "print$"
182 182 #define SMB_SHARE_PRINT_LEN 6
183 183 /*
184 184 * refcnt is currently only used for autohome. autohome needs a refcnt
185 185 * because a user can map their autohome share from more than one client
186 186 * at the same time and the share should only be removed when the last
187 187 * one is disconnected
188 188 */
189 189 typedef struct smb_share {
190 190 char shr_name[MAXNAMELEN];
191 191 char shr_path[MAXPATHLEN];
192 192 char shr_cmnt[SMB_SHARE_CMNT_MAX];
193 193 char shr_container[MAXPATHLEN];
194 194 uint32_t shr_flags;
195 195 uint32_t shr_type;
196 196 uint32_t shr_refcnt;
197 197 uint32_t shr_access_value; /* host return access value */
198 198 uid_t shr_uid; /* autohome only */
199 199 gid_t shr_gid; /* autohome only */
200 200 char shr_access_none[MAXPATHLEN];
201 201 char shr_access_ro[MAXPATHLEN];
202 202 char shr_access_rw[MAXPATHLEN];
203 203 } smb_share_t;
204 204
205 205 typedef struct smb_shriter {
206 206 smb_share_t si_share;
207 207 HT_ITERATOR si_hashiter;
208 208 boolean_t si_first;
209 209 } smb_shriter_t;
210 210
211 211 #define LMSHARES_PER_REQUEST 10
212 212 typedef struct smb_shrlist {
213 213 int sl_cnt;
214 214 smb_share_t sl_shares[LMSHARES_PER_REQUEST];
215 215 } smb_shrlist_t;
216 216
217 217 typedef struct smb_shr_execinfo {
218 218 char *e_sharename;
219 219 char *e_winname;
220 220 char *e_userdom;
221 221 smb_inaddr_t e_srv_ipaddr;
222 222 smb_inaddr_t e_cli_ipaddr;
223 223 char *e_cli_netbiosname;
224 224 uid_t e_uid;
225 225 int e_type;
226 226 } smb_shr_execinfo_t;
227 227
228 228 /*
229 229 * LanMan share API (for both SMB kernel module and GUI/CLI sub-system)
230 230 *
231 231 * NOTE: If any error is encounted by either the door server or client,
232 232 * NERR_InternalError will be returned by most functions, smb_share_count
233 233 * will return -1.
234 234 */
235 235
236 236 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
237 237
238 238 /*
239 239 * CIFS share management functions exported by libmlsvc
240 240 */
241 241 int smb_shr_start(void);
242 242 void smb_shr_stop(void);
243 243 void *smb_shr_load(void *);
244 244 void smb_shr_iterinit(smb_shriter_t *);
245 245 smb_share_t *smb_shr_iterate(smb_shriter_t *);
246 246 void smb_shr_list(int, smb_shrlist_t *);
247 247 int smb_shr_count(void);
248 248 uint32_t smb_shr_add(smb_share_t *);
249 249 uint32_t smb_shr_remove(char *);
250 250 uint32_t smb_shr_rename(char *, char *);
251 251 uint32_t smb_shr_get(char *, smb_share_t *);
252 252 uint32_t smb_shr_modify(smb_share_t *);
253 253 uint32_t smb_shr_get_realpath(const char *, char *, int);
254 254 uint32_t smb_shr_hostaccess(smb_inaddr_t *, char *, char *, char *, uint32_t);
255 255 int smb_shr_exec(smb_shr_execinfo_t *);
256 256
257 257 boolean_t smb_shr_exists(char *);
258 258 int smb_shr_is_special(char *);
259 259 boolean_t smb_shr_is_restricted(char *);
260 260 boolean_t smb_shr_is_admin(char *);
261 261 char smb_shr_drive_letter(const char *);
262 262
263 263 sa_handle_t smb_shr_sa_enter(void);
264 264 void smb_shr_sa_exit(void);
265 265 void smb_shr_sa_csc_option(const char *, smb_share_t *);
266 266 char *smb_shr_sa_csc_name(const smb_share_t *);
267 267 void smb_shr_sa_setflag(const char *, smb_share_t *, uint32_t);
268 268
269 269 /*
270 270 * CIFS share management API exported for other processes
271 271 */
272 272 uint32_t smb_share_list(int, smb_shrlist_t *);
273 273 int smb_share_count(void);
274 274 uint32_t smb_share_delete(char *);
275 275 uint32_t smb_share_rename(char *, char *);
276 276 uint32_t smb_share_create(smb_share_t *);
277 277 uint32_t smb_share_modify(smb_share_t *);
278 278
279 279 #endif /* _KERNEL */
280 280
281 281 #ifdef __cplusplus
282 282 }
283 283 #endif
284 284
285 285 #endif /* _SMB_SHARE_H */
↓ open down ↓ |
239 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX