c40e03
From 79381295b788a8196ccbf2ff378268286d7782d5 Mon Sep 17 00:00:00 2001
c40e03
From: Jeremy Allison <jra@samba.org>
c40e03
Date: Fri, 8 Sep 2017 16:20:34 -0700
c40e03
Subject: [PATCH] libsmbclient: Allow server (NetApp) to return
c40e03
 STATUS_INVALID_PARAMETER from an echo.
c40e03
c40e03
It does this if we send a session ID of zero. The server still replied.
c40e03
c40e03
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
c40e03
c40e03
Signed-off-by: Jeremy Allison <jra@samba.org>
c40e03
Reviewed-by: Andreas Schneider <asn@samba.org>
c40e03
c40e03
Autobuild-User(master): Jeremy Allison <jra@samba.org>
c40e03
Autobuild-Date(master): Sat Nov 11 08:44:37 CET 2017 on sn-devel-144
c40e03
c40e03
(cherry picked from commit a0f6ea8dec1ab3d19bc93da12a9b0a1c0ccf6142)
c40e03
---
c40e03
 source3/client/client.c        |  8 +++++++-
c40e03
 source3/libsmb/libsmb_server.c | 11 ++++++++++-
c40e03
 2 files changed, 17 insertions(+), 2 deletions(-)
c40e03
c40e03
diff --git a/source3/client/client.c b/source3/client/client.c
c40e03
index b4a6c7d0389..9c57375881d 100644
c40e03
--- a/source3/client/client.c
c40e03
+++ b/source3/client/client.c
c40e03
@@ -5900,7 +5900,13 @@ static void readline_callback(void)
c40e03
 	/* Ping the server to keep the connection alive using SMBecho. */
c40e03
 	memset(garbage, 0xf0, sizeof(garbage));
c40e03
 	status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
c40e03
-	if (NT_STATUS_IS_OK(status)) {
c40e03
+	if (NT_STATUS_IS_OK(status) ||
c40e03
+			NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
c40e03
+		/*
c40e03
+		 * Even if server returns NT_STATUS_INVALID_PARAMETER
c40e03
+		 * it still responded.
c40e03
+		 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
c40e03
+		 */
c40e03
 		return;
c40e03
 	}
c40e03
 
c40e03
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
c40e03
index b0e5926fa65..2d41f2facf3 100644
c40e03
--- a/source3/libsmb/libsmb_server.c
c40e03
+++ b/source3/libsmb/libsmb_server.c
c40e03
@@ -61,7 +61,16 @@ SMBC_check_server(SMBCCTX * context,
c40e03
 					1,
c40e03
 					data_blob_const(data, sizeof(data)));
c40e03
 		if (!NT_STATUS_IS_OK(status)) {
c40e03
-			return 1;
c40e03
+			/*
c40e03
+			 * Some NetApp servers return
c40e03
+			 * NT_STATUS_INVALID_PARAMETER.That's OK, they still
c40e03
+			 * replied.
c40e03
+			 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
c40e03
+			 */
c40e03
+			if (!NT_STATUS_EQUAL(status,
c40e03
+					NT_STATUS_INVALID_PARAMETER)) {
c40e03
+				return 1;
c40e03
+			}
c40e03
 		}
c40e03
 		server->last_echo_time = now;
c40e03
 	}
c40e03
-- 
c40e03
2.15.0.448.gf294e3d99a-goog
c40e03