libsmbclient: Allow server (NetApp) to return STATUS_INVALID_PARAMETER from an echo.
[nivanova/samba-autobuild/.git] / source3 / libsmb / libsmb_server.c
index b0e5926fa65613c7fc461be0967d82f42d4e371b..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;
        }
@@ -351,8 +360,8 @@ SMBC_server_internal(TALLOC_CTX *ctx,
                                                  "?????",
                                                  *pp_password);
                        if (!NT_STATUS_IS_OK(status)) {
-                                errno = map_errno_from_nt_status(status);
                                 cli_shutdown(srv->cli);
+                                errno = map_errno_from_nt_status(status);
                                srv->cli = NULL;
                                 smbc_getFunctionRemoveCachedServer(context)(context,
                                                                             srv);
@@ -562,8 +571,8 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
        status = cli_tree_connect_creds(c, share, "?????", creds);
        if (!NT_STATUS_IS_OK(status)) {
-               errno = map_errno_from_nt_status(status);
                cli_shutdown(c);
+               errno = map_errno_from_nt_status(status);
                return NULL;
        }