mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
smbXsrv_session: add smbXsrv_session_create_auth()
Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
e9885cfd0e
commit
2c39036806
@ -545,6 +545,12 @@ NTSTATUS smbXsrv_session_find_auth(const struct smbXsrv_session *session,
|
||||
const struct smbXsrv_connection *conn,
|
||||
NTTIME now,
|
||||
struct smbXsrv_session_auth0 **_a);
|
||||
NTSTATUS smbXsrv_session_create_auth(struct smbXsrv_session *session,
|
||||
struct smbXsrv_connection *conn,
|
||||
NTTIME now,
|
||||
uint8_t in_flags,
|
||||
uint8_t in_security_mode,
|
||||
struct smbXsrv_session_auth0 **_a);
|
||||
struct tevent_req *smb2srv_session_shutdown_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct smbXsrv_session *session,
|
||||
|
@ -1407,6 +1407,59 @@ NTSTATUS smbXsrv_session_find_auth(const struct smbXsrv_session *session,
|
||||
return NT_STATUS_USER_SESSION_DELETED;
|
||||
}
|
||||
|
||||
static int smbXsrv_session_auth0_destructor(struct smbXsrv_session_auth0 *a)
|
||||
{
|
||||
if (a->session == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DLIST_REMOVE(a->session->pending_auth, a);
|
||||
a->session = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NTSTATUS smbXsrv_session_create_auth(struct smbXsrv_session *session,
|
||||
struct smbXsrv_connection *conn,
|
||||
NTTIME now,
|
||||
uint8_t in_flags,
|
||||
uint8_t in_security_mode,
|
||||
struct smbXsrv_session_auth0 **_a)
|
||||
{
|
||||
struct smbXsrv_session_auth0 *a;
|
||||
NTSTATUS status;
|
||||
|
||||
status = smbXsrv_session_find_auth(session, conn, 0, &a);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
a = talloc_zero(session, struct smbXsrv_session_auth0);
|
||||
if (a == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
a->session = session;
|
||||
a->connection = conn;
|
||||
a->in_flags = in_flags;
|
||||
a->in_security_mode = in_security_mode;
|
||||
a->creation_time = now;
|
||||
a->idle_time = now;
|
||||
|
||||
if (conn->protocol >= PROTOCOL_SMB3_10) {
|
||||
a->preauth = talloc(a, struct smbXsrv_preauth);
|
||||
if (a->preauth == NULL) {
|
||||
TALLOC_FREE(session);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
*a->preauth = conn->smb2.preauth;
|
||||
}
|
||||
|
||||
talloc_set_destructor(a, smbXsrv_session_auth0_destructor);
|
||||
DLIST_ADD_END(session->pending_auth, a, NULL);
|
||||
|
||||
*_a = a;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
struct smb2srv_session_shutdown_state {
|
||||
struct tevent_queue *wait_queue;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user