s3: libsmb: cli_state_save_tcon(). Don't deepcopy tcon struct when temporarily swappi...
authorJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 19:08:48 +0000 (11:08 -0800)
committerKarolin Seeger <kseeger@samba.org>
Wed, 3 Feb 2021 22:32:58 +0000 (22:32 +0000)
commitdf0dd2ae007e96261fb98e3cf858543c116b81ab
treecae09cdacf7c19b20d32839652ed8eae47baec9f
parentb6a9277beaeb7dd113ee6eb95243af8701985216
s3: libsmb: cli_state_save_tcon(). Don't deepcopy tcon struct when temporarily swapping out a connection on a cli_state.

This used to make a deep copy of either
cli->smb2.tcon or cli->smb1.tcon, but this leaves
the original tcon pointer in place which will then get
TALLOC_FREE()'d when the new tree connection is made on
this cli_state.

As there may be pipes open on the old tree connection with
talloc'ed state allocated using the original tcon pointer as a
talloc parent we can't deep copy and then free this pointer
as that will fire the destructors on the pipe memory and
mark them as not connected.

This call is used to temporarily swap out a tcon pointer
(whilst keeping existing pipes open) to allow a new tcon
on the same cli_state and all users correctly call
cli_state_restore_tcon() once they are finished with
the new tree connection.

Just return the existing pointer and set the old value to NULL.
We know we MUST be calling cli_state_restore_tcon() below
to restore the original tcon tree connection pointer before
closing the session.

Remove the knownfail.d entry.

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>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb  2 21:05:25 UTC 2021 on sn-devel-184

(cherry picked from commit 4f80f5f9046b64a9e5e0503b1cb54f1492c4faec)

Autobuild-User(v4-14-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-14-test): Wed Feb  3 22:32:58 UTC 2021 on sn-devel-184
selftest/knownfail.d/bug-13992 [deleted file]
source3/libsmb/clientgen.c