]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Fix cli_state_has_tcon() to cope with SMB2 connections.
authorJeremy Allison <jra@samba.org>
Tue, 13 Jun 2017 23:36:54 +0000 (16:36 -0700)
committerKarolin Seeger <kseeger@samba.org>
Fri, 30 Jun 2017 08:46:22 +0000 (10:46 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
(cherry picked from commit c9178ed9cc69b9089292db28ac1a0b7a0519bc2c)

source3/libsmb/clientgen.c

index 25f7299195677244ab59411f81eeb5264529231c..4541763ea3f2ce4bebc41629ad3530b4b68b4f1d 100644 (file)
@@ -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;
 }