mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
smbd: introduce smbXsrv_session_info_lookup()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
96fd0ddd02
commit
e80aca0427
@ -573,6 +573,9 @@ NTSTATUS smb1srv_session_table_init(struct smbXsrv_connection *conn);
|
||||
NTSTATUS smb1srv_session_lookup(struct smbXsrv_connection *conn,
|
||||
uint16_t vuid, NTTIME now,
|
||||
struct smbXsrv_session **session);
|
||||
NTSTATUS smbXsrv_session_info_lookup(struct smbXsrv_client *client,
|
||||
uint64_t session_wire_id,
|
||||
struct auth_session_info **si);
|
||||
NTSTATUS smb2srv_session_table_init(struct smbXsrv_connection *conn);
|
||||
NTSTATUS smb2srv_session_lookup_conn(struct smbXsrv_connection *conn,
|
||||
uint64_t session_id, NTTIME now,
|
||||
|
@ -1854,6 +1854,51 @@ NTSTATUS smb1srv_session_lookup(struct smbXsrv_connection *conn,
|
||||
session);
|
||||
}
|
||||
|
||||
NTSTATUS smbXsrv_session_info_lookup(struct smbXsrv_client *client,
|
||||
uint64_t session_wire_id,
|
||||
struct auth_session_info **si)
|
||||
{
|
||||
struct smbXsrv_session_table *table = client->session_table;
|
||||
uint8_t key_buf[SMBXSRV_SESSION_LOCAL_TDB_KEY_SIZE];
|
||||
struct smbXsrv_session_local_fetch_state state = {
|
||||
.session = NULL,
|
||||
.status = NT_STATUS_INTERNAL_ERROR,
|
||||
};
|
||||
TDB_DATA key;
|
||||
NTSTATUS status;
|
||||
|
||||
if (session_wire_id == 0) {
|
||||
return NT_STATUS_USER_SESSION_DELETED;
|
||||
}
|
||||
|
||||
if (table == NULL) {
|
||||
/* this might happen before the end of negprot */
|
||||
return NT_STATUS_USER_SESSION_DELETED;
|
||||
}
|
||||
|
||||
if (table->local.db_ctx == NULL) {
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
key = smbXsrv_session_local_id_to_key(session_wire_id, key_buf);
|
||||
|
||||
status = dbwrap_parse_record(table->local.db_ctx, key,
|
||||
smbXsrv_session_local_fetch_parser,
|
||||
&state);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
if (!NT_STATUS_IS_OK(state.status)) {
|
||||
return state.status;
|
||||
}
|
||||
if (state.session->global->auth_session_info == NULL) {
|
||||
return NT_STATUS_USER_SESSION_DELETED;
|
||||
}
|
||||
|
||||
*si = state.session->global->auth_session_info;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS smb2srv_session_table_init(struct smbXsrv_connection *conn)
|
||||
{
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user