4 import
"server_id.idl";
9 uuid("07408340-ae31-11e1-97dc-539f7fddc06f"),
11 pointer_default(unique),
12 helpstring("smbXsrv structures")
17 * smbXsrv_version* is designed to allow
18 * rolling code upgrades in future (within a cluster).
20 * This just adds the infrastructure,
21 * but we does not implement it yet!
23 * Currently it only prevents that
24 * nodes with a different version numbers
25 * cannot run at the same time.
27 * Each node checks at startup, if the version
28 * matches the version of all other nodes.
29 * And it exits if the version does not match
30 * to avoid corruption.
32 * While it would be possible to add versioning
33 * to each of our internal databases it is easier
34 * use a dedicated database "smbXsrv_version_global.tdb"
35 * to hold the global version information.
37 * This removes extra complexity from the individual
38 * databases and allows that we add/remove databases
39 * or use different indexing keys.
42 typedef [v1_enum] enum {
44 * NOTE: Version 0 is designed to be unstable and the format
45 * may change during development.
47 SMBXSRV_VERSION_0
= 0x00000000
48 } smbXsrv_version_values
;
50 const uint32 SMBXSRV_VERSION_CURRENT
= SMBXSRV_VERSION_0
;
54 smbXsrv_version_values min_version
;
55 smbXsrv_version_values max_version
;
56 smbXsrv_version_values current_version
;
57 } smbXsrv_version_node0
;
60 [ignore] db_record
*db_rec
;
61 [range(1, 1024)] uint32 num_nodes
;
62 smbXsrv_version_node0 nodes
[num_nodes
];
63 } smbXsrv_version_global0
;
66 [case(0)] smbXsrv_version_global0
*info0
;
67 [default] hyper *dummy
;
68 } smbXsrv_version_globalU
;
70 typedef [public] struct {
71 smbXsrv_version_values
version;
73 [switch_is(version)] smbXsrv_version_globalU info
;
74 } smbXsrv_version_globalB
;
76 void smbXsrv_version_global_decode
(
77 [in] smbXsrv_version_globalB blob
82 typedef [public] struct {
83 [ignore] struct tevent_context
*ev_ctx
;
84 [ignore] struct messaging_context
*msg_ctx
;
87 * There's just one 'sconn' per client.
88 * It holds the FSA layer details, which are global
89 * per client (process).
91 [ignore] struct smbd_server_connection
*sconn
;
94 * this session_table is used for SMB1 and SMB2,
96 [ignore] struct smbXsrv_session_table
*session_table
;
97 [ignore] hyper last_session_id
;
99 * this tcon_table is only used for SMB1.
101 [ignore] struct smbXsrv_tcon_table
*tcon_table
;
103 * this open_table is used for SMB1 and SMB2,
104 * because we have a global sconn->real_max_open_files
107 [ignore] struct smbXsrv_open_table
*open_table
;
110 * For now this is only one connection!
111 * With multi-channel support we'll get more than
114 [ignore] struct smbXsrv_connection
*connections
;
121 [charset
(UTF8
),string] char local_address
[];
122 [charset
(UTF8
),string] char remote_address
[];
123 [charset
(UTF8
),string] char remote_name
[];
124 [noprint
] DATA_BLOB signing_key
;
125 uint32 auth_session_info_seqnum
;
126 [ignore] smbXsrv_connection
*connection
;
127 } smbXsrv_channel_global0
;
130 [ignore] db_record
*db_rec
;
131 uint32 session_global_id
;
132 hyper session_wire_id
;
133 NTTIME creation_time
;
134 NTTIME expiration_time
;
136 * auth_session is NULL until the
137 * session is valid for the first time.
140 uint32 auth_session_info_seqnum
;
141 auth_session_info
*auth_session_info
;
142 uint16 connection_dialect
;
143 boolean8 signing_required
;
144 boolean8 encryption_required
;
145 [noprint
] DATA_BLOB signing_key
;
146 [noprint
] DATA_BLOB encryption_key
;
147 [noprint
] DATA_BLOB decryption_key
;
148 [noprint
] DATA_BLOB application_key
;
149 [range(1, 1024)] uint32 num_channels
;
150 smbXsrv_channel_global0 channels
[num_channels
];
151 } smbXsrv_session_global0
;
154 [case(0)] smbXsrv_session_global0
*info0
;
155 [default] hyper *dummy
;
156 } smbXsrv_session_globalU
;
158 typedef [public] struct {
159 smbXsrv_version_values
version;
161 [switch_is(version)] smbXsrv_session_globalU info
;
162 } smbXsrv_session_globalB
;
164 void smbXsrv_session_global_decode
(
165 [in] smbXsrv_session_globalB blob
169 * The main server code should just work with
170 * 'struct smbXsrv_session' and never use
171 * smbXsrv_session0, smbXsrv_sessionU
172 * and smbXsrv_sessionB directly.
174 * If we need to change the smbXsrv_session,
175 * we can just rename smbXsrv_session
176 * to smbXsrv_session0 and add a new
177 * smbXsrv_session for version 1
178 * and could implement transparent mapping.
182 [ignore] smbXsrv_session_auth0
*prev
;
183 smbXsrv_session_auth0
*next
;
184 [ignore] smbXsrv_session
*session
;
185 [ignore] smbXsrv_connection
*connection
;
186 [ignore] gensec_security
*gensec
;
187 [ignore] smbXsrv_preauth
*preauth
;
189 uint8 in_security_mode
;
190 NTTIME creation_time
;
192 } smbXsrv_session_auth0
;
195 [ignore] smbXsrv_session_table
*table
;
196 [ignore] db_record
*db_rec
;
197 [ignore] smbXsrv_client
*client
;
199 [ref] smbXsrv_session_global0
*global
;
202 hyper nonce_high_random
;
203 hyper nonce_high_max
;
206 [ignore] user_struct
*compat
;
207 [ignore] smbXsrv_tcon_table
*tcon_table
;
208 smbXsrv_session_auth0
*pending_auth
;
209 boolean8 encryption_desired
;
213 [case(0)] smbXsrv_session
*info0
;
214 [default] hyper *dummy
;
217 typedef [public] struct {
218 smbXsrv_version_values
version;
219 [value
(0)] uint32 reserved
;
220 [switch_is(version)] smbXsrv_sessionU info
;
223 void smbXsrv_session_decode
(
224 [in] smbXsrv_sessionB blob
228 * smbXsrv_session_close is use in the MSG_SMBXSRV_SESSION_CLOSE
232 uint32 old_session_global_id
;
233 hyper old_session_wire_id
;
234 NTTIME old_creation_time
;
235 hyper new_session_wire_id
;
236 } smbXsrv_session_close0
;
239 [case(0)] smbXsrv_session_close0
*info0
;
240 [default] hyper *dummy
;
241 } smbXsrv_session_closeU
;
243 typedef [public] struct {
244 smbXsrv_version_values
version;
245 [value
(0)] uint32 reserved
;
246 [switch_is(version)] smbXsrv_session_closeU info
;
247 } smbXsrv_session_closeB
;
249 void smbXsrv_session_close_decode
(
250 [in] smbXsrv_session_closeB blob
256 [ignore] db_record
*db_rec
;
257 uint32 tcon_global_id
;
260 NTTIME creation_time
;
261 [charset
(UTF8
),string] char share_name
[];
262 boolean8 encryption_required
;
264 * for SMB1 this is the session that the tcon was opened on
266 uint32 session_global_id
;
267 } smbXsrv_tcon_global0
;
270 [case(0)] smbXsrv_tcon_global0
*info0
;
271 [default] hyper *dummy
;
272 } smbXsrv_tcon_globalU
;
274 typedef [public] struct {
275 smbXsrv_version_values
version;
277 [switch_is(version)] smbXsrv_tcon_globalU info
;
278 } smbXsrv_tcon_globalB
;
280 void smbXsrv_tcon_global_decode
(
281 [in] smbXsrv_tcon_globalB blob
285 * The main server code should just work with
286 * 'struct smbXsrv_tcon' and never use
287 * smbXsrv_tcon0, smbXsrv_tconU
288 * and smbXsrv_tconB directly.
290 * If we need to change the smbXsrv_tcon,
291 * we can just rename smbXsrv_tcon
292 * to smbXsrv_tcon0 and add a new
293 * smbXsrv_tcon for version 1
294 * and could implement transparent mapping.
297 [ignore] smbXsrv_tcon_table
*table
;
298 [ignore] db_record
*db_rec
;
300 [ref] smbXsrv_tcon_global0
*global
;
303 [ignore] connection_struct
*compat
;
304 boolean8 encryption_desired
;
308 [case(0)] smbXsrv_tcon
*info0
;
309 [default] hyper *dummy
;
312 typedef [public] struct {
313 smbXsrv_version_values
version;
314 [value
(0)] uint32 reserved
;
315 [switch_is(version)] smbXsrv_tconU info
;
318 void smbXsrv_tcon_decode
(
319 [in] smbXsrv_tconB blob
325 [ignore] db_record
*db_rec
;
327 uint32 open_global_id
;
328 hyper open_persistent_id
;
329 hyper open_volatile_id
;
334 GUID app_instance_id
;
336 * TODO: for durable/resilient/persistent handles we need more
337 * things here. See [MS-SMB2] 3.3.1.10 Per Open
339 * NOTE: this is still version 0, which is not a stable format!
341 NTTIME disconnect_time
;
342 uint32 durable_timeout_msec
;
344 DATA_BLOB backend_cookie
;
345 } smbXsrv_open_global0
;
348 [case(0)] smbXsrv_open_global0
*info0
;
349 [default] hyper *dummy
;
350 } smbXsrv_open_globalU
;
352 typedef [public] struct {
354 smbXsrv_version_values
version;
356 [switch_is(version)] smbXsrv_open_globalU info
;
357 } smbXsrv_open_globalB
;
359 void smbXsrv_open_global_decode
(
360 [in] smbXsrv_open_globalB blob
364 * The main server code should just work with
365 * 'struct smbXsrv_open' and never use
366 * smbXsrv_open0, smbXsrv_openU
367 * and smbXsrv_openB directly.
369 * If we need to change the smbXsrv_open,
370 * we can just rename smbXsrv_open
371 * to smbXsrv_open0 and add a new
372 * smbXsrv_open for version 1
373 * and could implement transparent mapping.
376 [ignore] smbXsrv_open_table
*table
;
377 [ignore] db_record
*db_rec
;
379 [ref] smbXsrv_open_global0
*global
;
382 [ignore] files_struct
*compat
;
386 [case(0)] smbXsrv_open
*info0
;
387 [default] hyper *dummy
;
390 typedef [public] struct {
391 smbXsrv_version_values
version;
392 [value
(0)] uint32 reserved
;
393 [switch_is(version)] smbXsrv_openU info
;
396 void smbXsrv_open_decode
(
397 [in] smbXsrv_openB blob