s3-client: Provide more information on protocol negotiation failures
authorAndrew Bartlett <abartlet@samba.org>
Tue, 14 Mar 2023 00:01:07 +0000 (13:01 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 11 Apr 2023 13:47:01 +0000 (13:47 +0000)
In particular, this may help track down REASON: Exception: Exception: protocol negotiation failed: NT_STATUS_IO_TIMEOUT

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 11 13:47:01 UTC 2023 on atb-devel-224

source3/libsmb/clidfs.c

index 9982f97d43a5603e942e0e372723ef4a4309620c..d111fce033a91e78cf7418fcd675e5beb114d9fa 100644 (file)
@@ -27,6 +27,7 @@
 #include "libsmb/nmblib.h"
 #include "../libcli/smb/smbXcli_base.h"
 #include "auth/credentials/credentials.h"
+#include "lib/param/param.h"
 
 /********************************************************************
  Important point.
@@ -196,8 +197,16 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx,
                                 lp_client_min_protocol(),
                                 lp_client_max_protocol());
 
-       if (!NT_STATUS_IS_OK(status)) {
-               d_printf("protocol negotiation failed: %s\n",
+       if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+               d_printf("Protocol negotiation (with timeout %d ms) timed out against server %s\n",
+                        c->timeout,
+                        smbXcli_conn_remote_name(c->conn));
+               cli_shutdown(c);
+       } else if (!NT_STATUS_IS_OK(status)) {
+               d_printf("Protocol negotiation to server %s (for a protocol between %s and %s) failed: %s\n",
+                        smbXcli_conn_remote_name(c->conn),
+                        lpcfg_get_smb_protocol(lp_client_min_protocol()),
+                        lpcfg_get_smb_protocol(lp_client_max_protocol()),
                         nt_errstr(status));
                cli_shutdown(c);
                return status;