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;
119 typedef [public,bitmap8bit] bitmap {
120 SMBXSRV_ENCRYPTION_REQUIRED = 0x01,
121 SMBXSRV_ENCRYPTION_DESIRED = 0x02,
122 SMBXSRV_PROCESSED_ENCRYPTED_PACKET = 0x04,
123 SMBXSRV_PROCESSED_UNENCRYPTED_PACKET = 0x08
124 } smbXsrv_encrpytion_flags;
126 typedef [public,bitmap8bit] bitmap {
127 SMBXSRV_SIGNING_REQUIRED = 0x01
128 } smbXsrv_signing_flags;
132 [charset(UTF8),string] char local_address[];
133 [charset(UTF8),string] char remote_address[];
134 [charset(UTF8),string] char remote_name[];
135 [noprint] DATA_BLOB signing_key;
136 uint32 auth_session_info_seqnum;
137 [ignore] smbXsrv_connection *connection;
138 uint16 encryption_cipher;
139 } smbXsrv_channel_global0;
142 [ignore] db_record *db_rec;
143 uint32 session_global_id;
144 hyper session_wire_id;
145 NTTIME creation_time;
146 NTTIME expiration_time;
148 * auth_session is NULL until the
149 * session is valid for the first time.
152 uint32 auth_session_info_seqnum;
153 auth_session_info *auth_session_info;
154 uint16 connection_dialect;
155 smbXsrv_signing_flags signing_flags;
156 smbXsrv_encrpytion_flags encryption_flags;
157 [noprint] DATA_BLOB signing_key;
158 [noprint] DATA_BLOB encryption_key;
159 [noprint] DATA_BLOB decryption_key;
160 [noprint] DATA_BLOB application_key;
161 [range(1, 1024)] uint32 num_channels;
162 smbXsrv_channel_global0 channels[num_channels];
163 } smbXsrv_session_global0;
166 [case(0)] smbXsrv_session_global0 *info0;
167 [default] hyper *dummy;
168 } smbXsrv_session_globalU;
170 typedef [public] struct {
171 smbXsrv_version_values version;
173 [switch_is(version)] smbXsrv_session_globalU info;
174 } smbXsrv_session_globalB;
176 void smbXsrv_session_global_decode(
177 [in] smbXsrv_session_globalB blob
181 * The main server code should just work with
182 * 'struct smbXsrv_session' and never use
183 * smbXsrv_session0, smbXsrv_sessionU
184 * and smbXsrv_sessionB directly.
186 * If we need to change the smbXsrv_session,
187 * we can just rename smbXsrv_session
188 * to smbXsrv_session0 and add a new
189 * smbXsrv_session for version 1
190 * and could implement transparent mapping.
194 [ignore] smbXsrv_session_auth0 *prev;
195 smbXsrv_session_auth0 *next;
196 [ignore] smbXsrv_session *session;
197 [ignore] smbXsrv_connection *connection;
198 [ignore] gensec_security *gensec;
199 [ignore] smbXsrv_preauth *preauth;
201 uint8 in_security_mode;
202 NTTIME creation_time;
204 } smbXsrv_session_auth0;
207 [ignore] smbXsrv_session_table *table;
208 [ignore] db_record *db_rec;
209 [ignore] smbXsrv_client *client;
211 [ref] smbXsrv_session_global0 *global;
214 hyper nonce_high_random;
215 hyper nonce_high_max;
218 [ignore] user_struct *compat;
219 [ignore] smbXsrv_tcon_table *tcon_table;
220 smbXsrv_session_auth0 *pending_auth;
224 [case(0)] smbXsrv_session *info0;
225 [default] hyper *dummy;
228 typedef [public] struct {
229 smbXsrv_version_values version;
230 [value(0)] uint32 reserved;
231 [switch_is(version)] smbXsrv_sessionU info;
234 void smbXsrv_session_decode(
235 [in] smbXsrv_sessionB blob
239 * smbXsrv_session_close is use in the MSG_SMBXSRV_SESSION_CLOSE
243 uint32 old_session_global_id;
244 hyper old_session_wire_id;
245 NTTIME old_creation_time;
246 hyper new_session_wire_id;
247 } smbXsrv_session_close0;
250 [case(0)] smbXsrv_session_close0 *info0;
251 [default] hyper *dummy;
252 } smbXsrv_session_closeU;
254 typedef [public] struct {
255 smbXsrv_version_values version;
256 [value(0)] uint32 reserved;
257 [switch_is(version)] smbXsrv_session_closeU info;
258 } smbXsrv_session_closeB;
260 void smbXsrv_session_close_decode(
261 [in] smbXsrv_session_closeB blob
267 [ignore] db_record *db_rec;
268 uint32 tcon_global_id;
271 NTTIME creation_time;
272 [charset(UTF8),string] char share_name[];
273 smbXsrv_encrpytion_flags encryption_flags;
275 * for SMB1 this is the session that the tcon was opened on
277 uint32 session_global_id;
278 } smbXsrv_tcon_global0;
281 [case(0)] smbXsrv_tcon_global0 *info0;
282 [default] hyper *dummy;
283 } smbXsrv_tcon_globalU;
285 typedef [public] struct {
286 smbXsrv_version_values version;
288 [switch_is(version)] smbXsrv_tcon_globalU info;
289 } smbXsrv_tcon_globalB;
291 void smbXsrv_tcon_global_decode(
292 [in] smbXsrv_tcon_globalB blob
296 * The main server code should just work with
297 * 'struct smbXsrv_tcon' and never use
298 * smbXsrv_tcon0, smbXsrv_tconU
299 * and smbXsrv_tconB directly.
301 * If we need to change the smbXsrv_tcon,
302 * we can just rename smbXsrv_tcon
303 * to smbXsrv_tcon0 and add a new
304 * smbXsrv_tcon for version 1
305 * and could implement transparent mapping.
308 [ignore] smbXsrv_tcon_table *table;
309 [ignore] db_record *db_rec;
311 [ref] smbXsrv_tcon_global0 *global;
314 [ignore] connection_struct *compat;
318 [case(0)] smbXsrv_tcon *info0;
319 [default] hyper *dummy;
322 typedef [public] struct {
323 smbXsrv_version_values version;
324 [value(0)] uint32 reserved;
325 [switch_is(version)] smbXsrv_tconU info;
328 void smbXsrv_tcon_decode(
329 [in] smbXsrv_tconB blob
335 [ignore] db_record *db_rec;
337 uint32 open_global_id;
338 hyper open_persistent_id;
339 hyper open_volatile_id;
344 GUID app_instance_id;
346 * TODO: for durable/resilient/persistent handles we need more
347 * things here. See [MS-SMB2] 3.3.1.10 Per Open
349 * NOTE: this is still version 0, which is not a stable format!
351 NTTIME disconnect_time;
352 uint32 durable_timeout_msec;
354 DATA_BLOB backend_cookie;
355 } smbXsrv_open_global0;
358 [case(0)] smbXsrv_open_global0 *info0;
359 [default] hyper *dummy;
360 } smbXsrv_open_globalU;
362 typedef [public] struct {
364 smbXsrv_version_values version;
366 [switch_is(version)] smbXsrv_open_globalU info;
367 } smbXsrv_open_globalB;
369 void smbXsrv_open_global_decode(
370 [in] smbXsrv_open_globalB blob
374 * The main server code should just work with
375 * 'struct smbXsrv_open' and never use
376 * smbXsrv_open0, smbXsrv_openU
377 * and smbXsrv_openB directly.
379 * If we need to change the smbXsrv_open,
380 * we can just rename smbXsrv_open
381 * to smbXsrv_open0 and add a new
382 * smbXsrv_open for version 1
383 * and could implement transparent mapping.
386 [ignore] smbXsrv_open_table *table;
387 [ignore] db_record *db_rec;
389 [ref] smbXsrv_open_global0 *global;
392 [ignore] files_struct *compat;
396 [case(0)] smbXsrv_open *info0;
397 [default] hyper *dummy;
400 typedef [public] struct {
401 smbXsrv_version_values version;
402 [value(0)] uint32 reserved;
403 [switch_is(version)] smbXsrv_openU info;
406 void smbXsrv_open_decode(
407 [in] smbXsrv_openB blob