From 815a19c606cfe822be3e8b8215809bbbfd065be1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 4 Oct 2019 11:15:27 +0200 Subject: [PATCH] smbXsrv_connection->connect_time --- source3/smbd/globals.h | 3 ++- source3/smbd/process.c | 5 +++-- source3/smbd/smbXsrv_client.c | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 42ff49713820..1f79eac64262 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -230,7 +230,7 @@ bool smbd_is_smb2_header(const uint8_t *inbuf, size_t size); bool smbd_smb2_is_compound(const struct smbd_smb2_request *req); NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd, - struct smbXsrv_connection **_xconn); + NTTIME now, struct smbXsrv_connection **_xconn); NTSTATUS reply_smb2002(struct smb_request *req, uint16_t choice); NTSTATUS reply_smb20ff(struct smb_request *req, uint16_t choice); @@ -346,6 +346,7 @@ struct smbXsrv_connection { struct smbXsrv_client *client; + NTTIME connect_time; const struct tsocket_address *local_address; const struct tsocket_address *remote_address; const char *remote_hostname; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 70398b4967e3..6ae6d0abc413 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -3721,7 +3721,7 @@ const char *smbXsrv_connection_dbg(const struct smbXsrv_connection *xconn) } NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd, - struct smbXsrv_connection **_xconn) + NTTIME now, struct smbXsrv_connection **_xconn) { TALLOC_CTX *frame = talloc_stackframe(); struct smbXsrv_connection *xconn; @@ -3751,6 +3751,7 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd, return NT_STATUS_NO_MEMORY; } talloc_steal(frame, xconn); + xconn->connect_time = now; xconn->transport.sock = sock_fd; smbd_echo_init(xconn); @@ -3993,7 +3994,7 @@ void smbd_process(struct tevent_context *ev_ctx, smbd_setup_sig_hup_handler(sconn); } - status = smbd_add_connection(client, sock_fd, &xconn); + status = smbd_add_connection(client, sock_fd, now, &xconn); if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) { /* * send a negative session response "not listening on calling diff --git a/source3/smbd/smbXsrv_client.c b/source3/smbd/smbXsrv_client.c index 02754a88dd53..098f02a34c46 100644 --- a/source3/smbd/smbXsrv_client.c +++ b/source3/smbd/smbXsrv_client.c @@ -662,7 +662,10 @@ static void smbXsrv_client_connection_pass_loop(struct tevent_req *subreq) DBG_ERR("got connection sockfd[%d]\n", sock_fd); NDR_PRINT_DEBUG(smbXsrv_connection_passB, &pass_blob); - status = smbd_add_connection(client, sock_fd, &xconn); + status = smbd_add_connection(client, + sock_fd, + pass_info0->initial_connect_time, + &xconn); if (!NT_STATUS_IS_OK(status)) { close(sock_fd); sock_fd = -1; -- 2.34.1