[SCM] Samba Shared Repository - branch master updated

Anoop C S anoopcs at samba.org
Wed Mar 5 16:22:02 UTC 2025


The branch, master has been updated
       via  e3830f2fe4d smbclient3: Replacing Echos in the cli status check with TCP status check.
      from  a3f129f6634 s3:smbd: disable "vfs mkdir use tmp name = auto" on OpenBSD

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e3830f2fe4d50402760de88695118a28c83c7f3b
Author: Felix Bussmann <feb at sernet.de>
Date:   Mon Mar 18 15:19:18 2024 +0100

    smbclient3: Replacing Echos in the cli status check with TCP status check.
    
    Replacing the echoes, which were being sent every 5 seconds by the client for a CLI status check, with a method that checks the status of the file descriptor instead, for a POLLHUP, POLLRDHUP, or a timeout.
    
    Signed-off-by: Felix Bussmann <feb at sernet.de>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Anoop C S <anoopcs at samba.org>
    Autobuild-Date(master): Wed Mar  5 16:21:34 UTC 2025 on atb-devel-224

-----------------------------------------------------------------------

Summary of changes:
 libcli/smb/smbXcli_base.c |  7 +++++++
 source3/client/client.c   | 39 ++++-----------------------------------
 2 files changed, 11 insertions(+), 35 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 6b479a78145..7f275b59991 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -474,6 +474,8 @@ struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
 
 bool smbXcli_conn_is_connected(struct smbXcli_conn *conn)
 {
+	int ret;
+
 	if (conn == NULL) {
 		return false;
 	}
@@ -482,6 +484,11 @@ bool smbXcli_conn_is_connected(struct smbXcli_conn *conn)
 		return false;
 	}
 
+	ret = samba_socket_poll_or_sock_error(conn->sock_fd);
+	if ( ret < 0) {
+		return false;
+	}
+
 	return true;
 }
 
diff --git a/source3/client/client.c b/source3/client/client.c
index d1ccc8cb54e..c15d9a9eb69 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -6124,42 +6124,11 @@ cleanup:
 
 static bool finished;
 
-/****************************************************************************
- Make sure we swallow keepalives during idle time.
-****************************************************************************/
-
-static void readline_callback(void)
+static void cli_status_check(void)
 {
-	static time_t last_t;
-	struct timespec now;
-	time_t t;
-	NTSTATUS status;
-	unsigned char garbage[16];
-
-	clock_gettime_mono(&now);
-	t = now.tv_sec;
-
-	if (t - last_t < 5)
-		return;
-
-	last_t = t;
-
-	/* Ping the server to keep the connection alive using SMBecho. */
-	memset(garbage, 0xf0, sizeof(garbage));
-	status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
-	if (NT_STATUS_IS_OK(status) ||
-			NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
-		/*
-		 * Even if server returns NT_STATUS_INVALID_PARAMETER
-		 * it still responded.
-		 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
-		 */
-		return;
-	}
-
 	if (!cli_state_is_connected(cli)) {
-		DEBUG(0,("SMBecho failed (%s). The connection is "
-			 "disconnected now\n", nt_errstr(status)));
+		DEBUG(0,("SMB echo failed (%s). The connection is "
+			 "disconnected now\n", nt_errstr(NT_STATUS_CONNECTION_DISCONNECTED)));
 		finished = true;
 		smb_readline_done();
 	}
@@ -6192,7 +6161,7 @@ static int process_stdin(void)
 			TALLOC_FREE(frame);
 			break;
 		}
-		line = smb_readline(the_prompt, readline_callback, completion_fn);
+		line = smb_readline(the_prompt, cli_status_check, completion_fn);
 		if (!line) {
 			TALLOC_FREE(frame);
 			break;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list