2011-12-15 14:45:56 +01:00
#include "idl_types.h"
2012-06-29 09:34:56 +02:00
import "misc.idl";
2012-05-08 15:57:22 +02:00
import "server_id.idl";
2011-12-15 14:45:56 +01:00
import "security.idl";
import "auth.idl";
2011-12-15 14:45:56 +01:00
[
uuid("07408340-ae31-11e1-97dc-539f7fddc06f"),
version(0.0),
pointer_default(unique),
helpstring("smbXsrv structures")
]
interface smbXsrv
{
2012-05-08 15:57:22 +02:00
/*
* smbXsrv_version* is designed to allow
* rolling code upgrades in future (within a cluster).
*
* This just adds the infrastructure,
2019-09-16 05:04:06 -07:00
* but it does not implement it yet!
2012-05-08 15:57:22 +02:00
*
* Currently it only prevents that
* nodes with a different version numbers
* cannot run at the same time.
*
* Each node checks at startup, if the version
* matches the version of all other nodes.
* And it exits if the version does not match
* to avoid corruption.
*
* While it would be possible to add versioning
* to each of our internal databases it is easier
* use a dedicated database "smbXsrv_version_global.tdb"
* to hold the global version information.
*
* This removes extra complexity from the individual
* databases and allows that we add/remove databases
* or use different indexing keys.
*
*/
typedef [v1_enum] enum {
/*
* NOTE: Version 0 is designed to be unstable and the format
* may change during development.
*/
SMBXSRV_VERSION_0 = 0x00000000
} smbXsrv_version_values;
const uint32 SMBXSRV_VERSION_CURRENT = SMBXSRV_VERSION_0;
typedef struct {
server_id server_id;
smbXsrv_version_values min_version;
smbXsrv_version_values max_version;
smbXsrv_version_values current_version;
} smbXsrv_version_node0;
typedef struct {
[range(1, 1024)] uint32 num_nodes;
smbXsrv_version_node0 nodes[num_nodes];
} smbXsrv_version_global0;
typedef union {
[case(0)] smbXsrv_version_global0 *info0;
[default] hyper *dummy;
} smbXsrv_version_globalU;
typedef [public] struct {
smbXsrv_version_values version;
uint32 seqnum;
[switch_is(version)] smbXsrv_version_globalU info;
} smbXsrv_version_globalB;
2014-05-20 19:47:13 +02:00
/* client */
2014-06-23 12:17:04 +02:00
typedef struct {
[ignore] db_record *db_rec;
server_id server_id;
[charset(UTF8),string] char local_address[];
[charset(UTF8),string] char remote_address[];
[charset(UTF8),string] char remote_name[];
NTTIME initial_connect_time;
GUID client_guid;
boolean8 stored;
} smbXsrv_client_global0;
typedef union {
[case(0)] smbXsrv_client_global0 *info0;
[default] hyper *dummy;
} smbXsrv_client_globalU;
2014-10-29 12:04:36 +01:00
typedef [public] struct {
2014-06-23 12:17:04 +02:00
smbXsrv_version_values version;
uint32 seqnum;
[switch_is(version)] smbXsrv_client_globalU info;
} smbXsrv_client_globalB;
typedef [public] struct {
[ignore] smbXsrv_client_table *table;
2018-03-22 10:54:41 +01:00
[ignore] struct tevent_context *raw_ev_ctx;
2014-05-20 19:47:13 +02:00
[ignore] struct messaging_context *msg_ctx;
2014-06-23 12:17:04 +02:00
[ref] smbXsrv_client_global0 *global;
2014-05-20 19:47:13 +02:00
/*
* There's just one 'sconn' per client.
* It holds the FSA layer details, which are global
* per client (process).
*/
[ignore] struct smbd_server_connection *sconn;
2014-06-12 20:22:54 +02:00
/*
* this session_table is used for SMB1 and SMB2,
*/
[ignore] struct smbXsrv_session_table *session_table;
/*
* this tcon_table is only used for SMB1.
*/
[ignore] struct smbXsrv_tcon_table *tcon_table;
/*
* this open_table is used for SMB1 and SMB2,
* because we have a global sconn->real_max_open_files
* limit.
*/
[ignore] struct smbXsrv_open_table *open_table;
2014-05-20 19:47:13 +02:00
/*
* For now this is only one connection!
* With multi-channel support we'll get more than
* one in future.
*/
[ignore] struct smbXsrv_connection *connections;
2016-01-22 12:51:15 +01:00
boolean8 server_multi_channel_enabled;
2019-10-04 10:02:56 +02:00
hyper next_channel_id;
2020-07-06 16:51:05 +02:00
[ignore] struct tevent_req *connection_pass_subreq;
2022-08-30 20:45:50 +02:00
[ignore] struct tevent_req *connection_drop_subreq;
2020-06-03 10:57:59 +02:00
/*
* A List of pending breaks.
*/
[ignore] struct smbXsrv_pending_break *pending_breaks;
2014-05-20 19:47:13 +02:00
} smbXsrv_client;
2014-06-23 12:17:04 +02:00
typedef union {
[case(0)] smbXsrv_client *info0;
[default] hyper *dummy;
} smbXsrv_clientU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_clientU info;
} smbXsrv_clientB;
2016-01-26 00:39:35 +01:00
/*
* smbXsrv_connection_pass is used in the MSG_SMBXSRV_CONNECTION_PASS
2020-07-06 17:27:05 +02:00
* message and echo'ed as MSG_SMBXSRV_CONNECTION_PASSED message with
* negotiate_request.length = 0.
2016-01-26 00:39:35 +01:00
*/
typedef struct {
GUID client_guid;
2020-07-06 17:27:05 +02:00
server_id src_server_id;
NTTIME xconn_connect_time;
server_id dst_server_id;
NTTIME client_connect_time;
2016-01-26 00:39:35 +01:00
DATA_BLOB negotiate_request;
} smbXsrv_connection_pass0;
typedef union {
[case(0)] smbXsrv_connection_pass0 *info0;
[default] hyper *dummy;
} smbXsrv_connection_passU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_connection_passU info;
} smbXsrv_connection_passB;
2022-08-30 20:45:50 +02:00
/*
* smbXsrv_connection_drop is used in the MSG_SMBXSRV_CONNECTION_DROP
* message as reaction the record is deleted.
*/
typedef struct {
GUID client_guid;
server_id src_server_id;
NTTIME xconn_connect_time;
server_id dst_server_id;
NTTIME client_connect_time;
} smbXsrv_connection_drop0;
typedef union {
[case(0)] smbXsrv_connection_drop0 *info0;
[default] hyper *dummy;
} smbXsrv_connection_dropU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_connection_dropU info;
} smbXsrv_connection_dropB;
2011-12-15 14:45:56 +01:00
/* sessions */
2015-11-09 17:23:29 +01:00
typedef [public,bitmap8bit] bitmap {
SMBXSRV_ENCRYPTION_REQUIRED = 0x01,
2015-11-13 10:30:50 +01:00
SMBXSRV_ENCRYPTION_DESIRED = 0x02,
SMBXSRV_PROCESSED_ENCRYPTED_PACKET = 0x04,
SMBXSRV_PROCESSED_UNENCRYPTED_PACKET = 0x08
2015-11-09 17:23:29 +01:00
} smbXsrv_encrpytion_flags;
2015-11-15 10:49:38 +01:00
typedef [public,bitmap8bit] bitmap {
2015-11-15 11:12:34 +01:00
SMBXSRV_SIGNING_REQUIRED = 0x01,
SMBXSRV_PROCESSED_SIGNED_PACKET = 0x02,
SMBXSRV_PROCESSED_UNSIGNED_PACKET = 0x04
2015-11-15 10:49:38 +01:00
} smbXsrv_signing_flags;
2011-12-15 14:45:56 +01:00
typedef struct {
server_id server_id;
2019-10-04 10:02:56 +02:00
hyper channel_id;
NTTIME creation_time;
2011-12-15 14:45:56 +01:00
[charset(UTF8),string] char local_address[];
[charset(UTF8),string] char remote_address[];
[charset(UTF8),string] char remote_name[];
2019-03-13 16:44:53 +01:00
[noprint] DATA_BLOB signing_key_blob;
2019-03-13 16:45:47 +01:00
[ignore] smb2_signing_key *signing_key;
2011-12-15 14:45:56 +01:00
uint32 auth_session_info_seqnum;
2014-06-12 09:51:18 +02:00
[ignore] smbXsrv_connection *connection;
2021-03-05 22:40:43 +01:00
uint16 signing_algo;
2015-11-13 10:35:58 +01:00
uint16 encryption_cipher;
2011-12-15 14:45:56 +01:00
} smbXsrv_channel_global0;
typedef struct {
[ignore] db_record *db_rec;
uint32 session_global_id;
hyper session_wire_id;
NTTIME creation_time;
NTTIME expiration_time;
/*
* auth_session is NULL until the
* session is valid for the first time.
*/
2014-06-12 09:49:28 +02:00
NTTIME auth_time;
2011-12-15 14:45:56 +01:00
uint32 auth_session_info_seqnum;
auth_session_info *auth_session_info;
uint16 connection_dialect;
2023-12-28 10:35:43 +01:00
GUID client_guid;
2015-11-15 10:49:38 +01:00
smbXsrv_signing_flags signing_flags;
2021-03-05 22:40:43 +01:00
uint16 signing_algo;
2015-11-09 17:23:29 +01:00
smbXsrv_encrpytion_flags encryption_flags;
2021-03-05 22:40:43 +01:00
uint16 encryption_cipher;
2019-03-13 16:44:53 +01:00
[noprint] DATA_BLOB signing_key_blob;
2019-03-13 16:45:47 +01:00
[ignore] smb2_signing_key *signing_key;
2019-03-13 16:44:53 +01:00
[noprint] DATA_BLOB encryption_key_blob;
2019-03-14 10:02:27 +01:00
[ignore] smb2_signing_key *encryption_key;
2019-03-13 16:44:53 +01:00
[noprint] DATA_BLOB decryption_key_blob;
2019-03-14 10:10:34 +01:00
[ignore] smb2_signing_key *decryption_key;
2021-03-05 22:40:43 +01:00
[noprint] DATA_BLOB application_key_blob;
[ignore] smb2_signing_key *application_key;
2011-12-15 14:45:56 +01:00
[range(1, 1024)] uint32 num_channels;
smbXsrv_channel_global0 channels[num_channels];
} smbXsrv_session_global0;
typedef union {
[case(0)] smbXsrv_session_global0 *info0;
[default] hyper *dummy;
} smbXsrv_session_globalU;
typedef [public] struct {
smbXsrv_version_values version;
uint32 seqnum;
[switch_is(version)] smbXsrv_session_globalU info;
} smbXsrv_session_globalB;
2012-08-10 11:55:13 +02:00
/*
* The main server code should just work with
* 'struct smbXsrv_session' and never use
* smbXsrv_session0, smbXsrv_sessionU
* and smbXsrv_sessionB directly.
*
* If we need to change the smbXsrv_session,
* we can just rename smbXsrv_session
* to smbXsrv_session0 and add a new
* smbXsrv_session for version 1
* and could implement transparent mapping.
*/
2014-06-25 13:30:59 +02:00
typedef struct {
[ignore] smbXsrv_session_auth0 *prev;
2020-02-07 15:18:45 +13:00
[max_recursion(20000)] smbXsrv_session_auth0 *next;
2014-06-25 13:30:59 +02:00
[ignore] smbXsrv_session *session;
[ignore] smbXsrv_connection *connection;
[ignore] gensec_security *gensec;
[ignore] smbXsrv_preauth *preauth;
uint8 in_flags;
uint8 in_security_mode;
NTTIME creation_time;
NTTIME idle_time;
2020-07-01 18:02:16 +02:00
hyper channel_id;
2014-06-25 13:30:59 +02:00
} smbXsrv_session_auth0;
2011-12-15 14:45:56 +01:00
typedef struct {
[ignore] smbXsrv_session_table *table;
[ignore] db_record *db_rec;
2014-06-12 09:30:24 +02:00
[ignore] smbXsrv_client *client;
2011-12-15 14:45:56 +01:00
uint32 local_id;
[ref] smbXsrv_session_global0 *global;
NTSTATUS status;
NTTIME idle_time;
2015-05-20 14:01:44 +02:00
hyper nonce_high_random;
hyper nonce_high_max;
2012-08-22 10:29:21 +02:00
hyper nonce_high;
hyper nonce_low;
2011-12-15 14:45:56 +01:00
[ignore] smbXsrv_tcon_table *tcon_table;
2019-12-29 08:31:45 +01:00
[ignore] uint32 homes_snum;
2014-06-25 13:30:59 +02:00
smbXsrv_session_auth0 *pending_auth;
2012-08-10 11:55:13 +02:00
} smbXsrv_session;
2011-12-15 14:45:56 +01:00
typedef union {
2012-08-10 11:55:13 +02:00
[case(0)] smbXsrv_session *info0;
2011-12-15 14:45:56 +01:00
[default] hyper *dummy;
} smbXsrv_sessionU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_sessionU info;
} smbXsrv_sessionB;
2012-06-11 19:29:25 +02:00
/*
2024-02-08 10:28:02 +01:00
* smbXsrv_session_close is used in the MSG_SMBXSRV_SESSION_CLOSE
2012-06-11 19:29:25 +02:00
* message
*/
typedef struct {
uint32 old_session_global_id;
hyper old_session_wire_id;
NTTIME old_creation_time;
hyper new_session_wire_id;
} smbXsrv_session_close0;
typedef union {
[case(0)] smbXsrv_session_close0 *info0;
[default] hyper *dummy;
} smbXsrv_session_closeU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_session_closeU info;
} smbXsrv_session_closeB;
2012-03-16 16:18:40 +01:00
/* tree connects */
typedef struct {
[ignore] db_record *db_rec;
uint32 tcon_global_id;
uint32 tcon_wire_id;
server_id server_id;
NTTIME creation_time;
[charset(UTF8),string] char share_name[];
2015-11-09 17:23:29 +01:00
smbXsrv_encrpytion_flags encryption_flags;
2012-10-18 13:38:34 +02:00
/*
* for SMB1 this is the session that the tcon was opened on
*/
uint32 session_global_id;
2015-11-15 11:12:34 +01:00
smbXsrv_signing_flags signing_flags;
2012-03-16 16:18:40 +01:00
} smbXsrv_tcon_global0;
typedef union {
[case(0)] smbXsrv_tcon_global0 *info0;
[default] hyper *dummy;
} smbXsrv_tcon_globalU;
typedef [public] struct {
smbXsrv_version_values version;
uint32 seqnum;
[switch_is(version)] smbXsrv_tcon_globalU info;
} smbXsrv_tcon_globalB;
2012-08-10 11:55:13 +02:00
/*
* The main server code should just work with
* 'struct smbXsrv_tcon' and never use
* smbXsrv_tcon0, smbXsrv_tconU
* and smbXsrv_tconB directly.
*
* If we need to change the smbXsrv_tcon,
* we can just rename smbXsrv_tcon
* to smbXsrv_tcon0 and add a new
* smbXsrv_tcon for version 1
* and could implement transparent mapping.
*/
2012-03-16 16:18:40 +01:00
typedef struct {
[ignore] smbXsrv_tcon_table *table;
[ignore] db_record *db_rec;
uint32 local_id;
[ref] smbXsrv_tcon_global0 *global;
NTSTATUS status;
NTTIME idle_time;
[ignore] connection_struct *compat;
2012-08-10 11:55:13 +02:00
} smbXsrv_tcon;
2012-03-16 16:18:40 +01:00
typedef union {
2012-08-10 11:55:13 +02:00
[case(0)] smbXsrv_tcon *info0;
2012-03-16 16:18:40 +01:00
[default] hyper *dummy;
} smbXsrv_tconU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_tconU info;
} smbXsrv_tconB;
2012-03-12 18:38:07 +01:00
/* open files */
2016-02-26 13:44:13 +01:00
typedef [public,bitmap8bit] bitmap {
SMBXSRV_OPEN_NEED_REPLAY_CACHE = 0x01,
SMBXSRV_OPEN_HAVE_REPLAY_CACHE = 0x02
} smbXsrv_open_flags;
2012-03-12 18:38:07 +01:00
typedef struct {
server_id server_id;
uint32 open_global_id;
hyper open_persistent_id;
hyper open_volatile_id;
dom_sid open_owner;
NTTIME open_time;
2012-06-29 09:34:56 +02:00
GUID create_guid;
GUID client_guid;
GUID app_instance_id;
2012-03-12 18:38:07 +01:00
/*
* TODO: for durable/resilient/persistent handles we need more
* things here. See [MS-SMB2] 3.3.1.10 Per Open
*
* NOTE: this is still version 0, which is not a stable format!
*/
2012-06-29 09:34:56 +02:00
NTTIME disconnect_time;
uint32 durable_timeout_msec;
boolean8 durable;
DATA_BLOB backend_cookie;
2018-01-11 15:34:45 +01:00
uint16 channel_sequence;
hyper channel_generation;
2012-10-24 15:06:54 +02:00
[flag(NDR_PAHEX)] uint8 lock_sequence_array[64];
2012-03-12 18:38:07 +01:00
} smbXsrv_open_global0;
typedef union {
[case(0)] smbXsrv_open_global0 *info0;
[default] hyper *dummy;
} smbXsrv_open_globalU;
typedef [public] struct {
smbXsrv_version_values version;
uint32 seqnum;
[switch_is(version)] smbXsrv_open_globalU info;
} smbXsrv_open_globalB;
2012-08-10 11:55:13 +02:00
/*
* The main server code should just work with
* 'struct smbXsrv_open' and never use
* smbXsrv_open0, smbXsrv_openU
* and smbXsrv_openB directly.
*
* If we need to change the smbXsrv_open,
* we can just rename smbXsrv_open
* to smbXsrv_open0 and add a new
* smbXsrv_open for version 1
* and could implement transparent mapping.
*/
2012-03-12 18:38:07 +01:00
typedef struct {
[ignore] smbXsrv_open_table *table;
uint32 local_id;
[ref] smbXsrv_open_global0 *global;
NTSTATUS status;
NTTIME idle_time;
[ignore] files_struct *compat;
2016-02-26 13:44:13 +01:00
smbXsrv_open_flags flags;
2016-02-29 02:11:26 +01:00
uint32 create_action;
2016-01-27 16:18:25 +01:00
hyper request_count;
hyper pre_request_count;
2012-08-10 11:55:13 +02:00
} smbXsrv_open;
2012-03-12 18:38:07 +01:00
typedef union {
2012-08-10 11:55:13 +02:00
[case(0)] smbXsrv_open *info0;
2012-03-12 18:38:07 +01:00
[default] hyper *dummy;
} smbXsrv_openU;
typedef [public] struct {
smbXsrv_version_values version;
[value(0)] uint32 reserved;
[switch_is(version)] smbXsrv_openU info;
} smbXsrv_openB;
2021-03-12 15:10:46 +01:00
const uint32 SMBXSRV_OPEN_REPLAY_CACHE_FIXED_SIZE = 28;
typedef [public] struct {
GUID holder_req_guid;
NTTIME idle_time;
uint32 local_id;
} smbXsrv_open_replay_cache;
2011-12-15 14:45:56 +01:00
}