uint32_t highest_id,
uint32_t max_opens)
{
+ struct smbXsrv_client *client = conn->client;
struct smbXsrv_open_table *table;
NTSTATUS status;
uint64_t max_range;
return NT_STATUS_INTERNAL_ERROR;
}
- table = talloc_zero(conn, struct smbXsrv_open_table);
+ table = talloc_zero(client, struct smbXsrv_open_table);
if (table == NULL) {
return NT_STATUS_NO_MEMORY;
}
table->global.db_ctx = smbXsrv_open_global_db_ctx;
- conn->open_table = table;
+ client->open_table = table;
return NT_STATUS_OK;
}
NTTIME now,
struct smbXsrv_open **_open)
{
- struct smbXsrv_open_table *table = conn->open_table;
+ struct smbXsrv_open_table *table = conn->client->open_table;
struct db_record *local_rec = NULL;
struct smbXsrv_open *op = NULL;
void *ptr = NULL;
uint16_t fnum, NTTIME now,
struct smbXsrv_open **_open)
{
- struct smbXsrv_open_table *table = conn->open_table;
+ struct smbXsrv_open_table *table = conn->client->open_table;
uint32_t local_id = fnum;
uint32_t global_id = 0;
NTTIME now,
struct smbXsrv_open **_open)
{
- struct smbXsrv_open_table *table = conn->open_table;
+ struct smbXsrv_open_table *table = conn->client->open_table;
uint32_t local_id = volatile_id & UINT32_MAX;
uint64_t local_zeros = volatile_id & 0xFFFFFFFF00000000LLU;
uint32_t global_id = persistent_id & UINT32_MAX;
NTTIME now,
struct smbXsrv_open **_open)
{
- struct smbXsrv_open_table *table = conn->open_table;
+ struct smbXsrv_open_table *table = conn->client->open_table;
struct db_record *local_rec = NULL;
struct smbXsrv_open *op = NULL;
void *ptr = NULL;
} global;
};
+static NTSTATUS smb2srv_session_lookup_raw(struct smbXsrv_session_table *table,
+ uint64_t session_id, NTTIME now,
+ struct smbXsrv_session **session);
+
static struct db_context *smbXsrv_session_global_db_ctx = NULL;
NTSTATUS smbXsrv_session_global_init(void)
uint32_t highest_id,
uint32_t max_sessions)
{
+ struct smbXsrv_client *client = conn->client;
struct smbXsrv_session_table *table;
NTSTATUS status;
struct tevent_req *subreq;
return NT_STATUS_INTERNAL_ERROR;
}
- table = talloc_zero(conn, struct smbXsrv_session_table);
+ table = talloc_zero(client, struct smbXsrv_session_table);
if (table == NULL) {
return NT_STATUS_NO_MEMORY;
}
table->global.db_ctx = smbXsrv_session_global_db_ctx;
- dbwrap_watch_db(table->global.db_ctx, conn->msg_ctx);
+ dbwrap_watch_db(table->global.db_ctx, client->msg_ctx);
- subreq = messaging_read_send(table, conn->ev_ctx, conn->msg_ctx,
+ subreq = messaging_read_send(table, client->ev_ctx, client->msg_ctx,
MSG_SMBXSRV_SESSION_CLOSE);
if (subreq == NULL) {
TALLOC_FREE(table);
return NT_STATUS_NO_MEMORY;
}
- tevent_req_set_callback(subreq, smbXsrv_session_close_loop, conn);
+ tevent_req_set_callback(subreq, smbXsrv_session_close_loop, client);
- conn->session_table = table;
+ client->session_table = table;
return NT_STATUS_OK;
}
static void smbXsrv_session_close_loop(struct tevent_req *subreq)
{
- struct smbXsrv_connection *conn =
+ struct smbXsrv_client *client =
tevent_req_callback_data(subreq,
- struct smbXsrv_connection);
- struct smbXsrv_session_table *table = conn->session_table;
+ struct smbXsrv_client);
+ struct smbXsrv_session_table *table = client->session_table;
int ret;
struct messaging_rec *rec = NULL;
struct smbXsrv_session_closeB close_blob;
goto next;
}
- status = smb2srv_session_lookup(conn, close_info0->old_session_wire_id,
- now, &session);
+ status = smb2srv_session_lookup_raw(client->session_table,
+ close_info0->old_session_wire_id,
+ now, &session);
if (NT_STATUS_EQUAL(status, NT_STATUS_USER_SESSION_DELETED)) {
DEBUG(4,("smbXsrv_session_close_loop: "
"old_session_wire_id %llu not found\n",
next:
TALLOC_FREE(rec);
- subreq = messaging_read_send(table, conn->ev_ctx, conn->msg_ctx,
+ subreq = messaging_read_send(table, client->ev_ctx, client->msg_ctx,
MSG_SMBXSRV_SESSION_CLOSE);
if (subreq == NULL) {
- smbd_server_connection_terminate(conn,
- "msg_read_send() failed");
+ const char *r;
+ r = "messaging_read_send(MSG_SMBXSRV_SESSION_CLOSE) failed";
+ exit_server_cleanly(r);
return;
}
- tevent_req_set_callback(subreq, smbXsrv_session_close_loop, conn);
+ tevent_req_set_callback(subreq, smbXsrv_session_close_loop, client);
}
struct smb1srv_session_local_allocate_state {
struct smb2srv_session_close_previous_state *state;
uint32_t global_id = previous_session_id & UINT32_MAX;
uint64_t global_zeros = previous_session_id & 0xFFFFFFFF00000000LLU;
- struct smbXsrv_session_table *table = conn->session_table;
+ struct smbXsrv_session_table *table = conn->client->session_table;
struct security_token *current_token = NULL;
uint8_t key_buf[SMBXSRV_SESSION_GLOBAL_TDB_KEY_SIZE];
TDB_DATA key;
NTTIME now,
struct smbXsrv_session **_session)
{
- struct smbXsrv_session_table *table = conn->session_table;
+ struct smbXsrv_session_table *table = conn->client->session_table;
struct db_record *local_rec = NULL;
struct smbXsrv_session *session = NULL;
void *ptr = NULL;
NTSTATUS smbXsrv_session_logoff_all(struct smbXsrv_connection *conn)
{
- struct smbXsrv_session_table *table = conn->session_table;
+ struct smbXsrv_session_table *table = conn->client->session_table;
struct smbXsrv_session_logoff_all_state state;
NTSTATUS status;
int count = 0;
uint16_t vuid, NTTIME now,
struct smbXsrv_session **session)
{
- struct smbXsrv_session_table *table = conn->session_table;
+ struct smbXsrv_session_table *table = conn->client->session_table;
uint32_t local_id = vuid;
return smbXsrv_session_local_lookup(table, local_id, now, session);
UINT16_MAX - 1);
}
-NTSTATUS smb2srv_session_lookup(struct smbXsrv_connection *conn,
- uint64_t session_id, NTTIME now,
- struct smbXsrv_session **session)
+static NTSTATUS smb2srv_session_lookup_raw(struct smbXsrv_session_table *table,
+ uint64_t session_id, NTTIME now,
+ struct smbXsrv_session **session)
{
- struct smbXsrv_session_table *table = conn->session_table;
uint32_t local_id = session_id & UINT32_MAX;
uint64_t local_zeros = session_id & 0xFFFFFFFF00000000LLU;
return smbXsrv_session_local_lookup(table, local_id, now, session);
}
+NTSTATUS smb2srv_session_lookup(struct smbXsrv_connection *conn,
+ uint64_t session_id, NTTIME now,
+ struct smbXsrv_session **session)
+{
+ struct smbXsrv_session_table *table = conn->client->session_table;
+ return smb2srv_session_lookup_raw(table, session_id, now, session);
+}
+
struct smbXsrv_session_global_traverse_state {
int (*fn)(struct smbXsrv_session_global0 *, void *);
void *private_data;
NTSTATUS smb1srv_tcon_table_init(struct smbXsrv_connection *conn)
{
+ struct smbXsrv_client *client = conn->client;
+
/*
* Allow a range from 1..65534 with 65534 values.
*/
- conn->tcon_table = talloc_zero(conn, struct smbXsrv_tcon_table);
- if (conn->tcon_table == NULL) {
+ client->tcon_table = talloc_zero(client, struct smbXsrv_tcon_table);
+ if (client->tcon_table == NULL) {
return NT_STATUS_NO_MEMORY;
}
- return smbXsrv_tcon_table_init(conn, conn->tcon_table,
+ return smbXsrv_tcon_table_init(client, client->tcon_table,
1, UINT16_MAX - 1,
UINT16_MAX - 1);
}
{
struct server_id id = messaging_server_id(conn->msg_ctx);
- return smbXsrv_tcon_create(conn->tcon_table,
+ return smbXsrv_tcon_create(conn->client->tcon_table,
conn->protocol,
id, now, _tcon);
}
{
uint32_t local_id = tree_id;
- return smbXsrv_tcon_local_lookup(conn->tcon_table,
+ return smbXsrv_tcon_local_lookup(conn->client->tcon_table,
local_id, now, tcon);
}
NTSTATUS smb1srv_tcon_disconnect_all(struct smbXsrv_connection *conn)
{
+ struct smbXsrv_client *client = conn->client;
+
/*
* We do not pass a vuid here,
* which means the vuid is taken from
* conn_close_all(), but we should think
* about how to fix this in future.
*/
- return smbXsrv_tcon_disconnect_all(conn->tcon_table, 0);
+ return smbXsrv_tcon_disconnect_all(client->tcon_table, 0);
}
NTSTATUS smb2srv_tcon_table_init(struct smbXsrv_session *session)