smbXsrv_connection->connect_time
authorStefan Metzmacher <metze@samba.org>
Fri, 4 Oct 2019 09:15:27 +0000 (11:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 28 Jan 2020 12:26:51 +0000 (13:26 +0100)
source3/smbd/globals.h
source3/smbd/process.c
source3/smbd/smbXsrv_client.c

index 42ff497138204fcb284f0ae5c1e6d7018a48e297..1f79eac64262377951aa5338b2d24b4866b1cf8e 100644 (file)
@@ -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;
index 70398b4967e329512646380a07abdff3d453b449..6ae6d0abc41369baed603c397d7706d870175463 100644 (file)
@@ -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
index 02754a88dd53bc6fce22986d423cd1c61b1f6bfc..098f02a34c4654b64d3d24c2eec50f9902aaac2e 100644 (file)
@@ -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;