s3: libsmb: Ensure we disconnect the temporary SMB1 tcon pointer on failure to set...
authorJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 22:32:53 +0000 (14:32 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 3 Feb 2021 21:23:55 +0000 (21:23 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13992

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit faba89ad59eaa189f325be17377645862080a965)

source3/libsmb/clidfs.c

index 26b5499cf7359817652614f14abe68a0b0b405ef..040b957e6f8c6d19d68fe4554471b611b580cd0d 100644 (file)
@@ -1203,6 +1203,13 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                                break;
                        case SMB_ENCRYPTION_REQUIRED:
                        default:
+                               /*
+                                * Failed to set up encryption.
+                                * Disconnect the temporary IPC$
+                                * tcon before restoring the original
+                                * tcon so we don't leak it.
+                                */
+                               cli_tdis(cli);
                                cli_state_restore_tcon(cli, orig_tcon);
                                return false;
                        }