libsmbclient: Allow server (NetApp) to return STATUS_INVALID_PARAMETER from an echo.
authorJeremy Allison <jra@samba.org>
Fri, 8 Sep 2017 23:20:34 +0000 (16:20 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 11 Nov 2017 07:44:36 +0000 (08:44 +0100)
It does this if we send a session ID of zero. The server still replied.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Nov 11 08:44:37 CET 2017 on sn-devel-144

source3/client/client.c
source3/libsmb/libsmb_server.c

index 8f449e813118bc23cc7f7fc371e7a815d299c31a..754907d2e095c902667d42fd6a33e229fc04f1ec 100644 (file)
@@ -6027,7 +6027,13 @@ static void readline_callback(void)
        /* 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)) {
+       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;
        }
 
index 93b9e80091061f8558b011909abfae26e69a2a36..e6067be2013025b8517fef912e44c548cb807d75 100644 (file)
@@ -61,7 +61,16 @@ SMBC_check_server(SMBCCTX * context,
                                        1,
                                        data_blob_const(data, sizeof(data)));
                if (!NT_STATUS_IS_OK(status)) {
-                       return 1;
+                       /*
+                        * Some NetApp servers return
+                        * NT_STATUS_INVALID_PARAMETER.That's OK, they still
+                        * replied.
+                        * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
+                        */
+                       if (!NT_STATUS_EQUAL(status,
+                                       NT_STATUS_INVALID_PARAMETER)) {
+                               return 1;
+                       }
                }
                server->last_echo_time = now;
        }