From 2726c1a1b0c69d618248b607eca2b0845ddda41d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 Jun 2017 08:49:05 +0200 Subject: [PATCH] s3:client: smbclient -L can't do workgroup listing over SMB2/3 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- source3/client/client.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 3285240d404..375d9e3e4d9 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -5646,16 +5646,21 @@ static int do_host_query(const char *query_host) goto out; } - if (port != NBT_SMB_PORT) { + if (port != NBT_SMB_PORT || + smbXcli_conn_protocol(cli->conn) > PROTOCOL_NT1) + { + int max_proto = MIN(max_protocol, PROTOCOL_NT1); - /* Workgroups simply don't make sense over anything - else but port 139... */ + /* + * Workgroups simply don't make sense over anything + * else but port 139 and SMB1. + */ cli_shutdown(cli); status = cli_cm_open(talloc_tos(), NULL, have_ip ? dest_ss_str : query_host, "IPC$", popt_get_cmdline_auth_info(), - true, smb_encrypt, max_protocol, + true, smb_encrypt, max_proto, NBT_SMB_PORT, name_type, &cli); if (!NT_STATUS_IS_OK(status)) { cli = NULL; -- 2.34.1