From c9178ed9cc69b9089292db28ac1a0b7a0519bc2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Jun 2017 16:36:54 -0700 Subject: [PATCH] s3: libsmb: Fix cli_state_has_tcon() to cope with SMB2 connections. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831 Signed-off-by: Jeremy Allison Reviewed-by: Richard Sharpe --- source3/libsmb/clientgen.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 25f72991956..4541763ea3f 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -341,12 +341,24 @@ uint32_t cli_getpid(struct cli_state *cli) bool cli_state_has_tcon(struct cli_state *cli) { - uint32_t tid = cli_state_get_tid(cli); - - if (tid == UINT16_MAX) { - return false; + uint32_t tid; + if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { + if (cli->smb2.tcon == NULL) { + return false; + } + tid = cli_state_get_tid(cli); + if (tid == UINT32_MAX) { + return false; + } + } else { + if (cli->smb1.tcon == NULL) { + return false; + } + tid = cli_state_get_tid(cli); + if (tid == UINT16_MAX) { + return false; + } } - return true; } -- 2.11.4.GIT