r4951: some of the code dealing with libcli was getting too complex trying to
authorAndrew Tridgell <tridge@samba.org>
Mon, 24 Jan 2005 00:57:14 +0000 (00:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:09 +0000 (13:09 -0500)
commit3e44c4a3ba6acd7d9bc997c012d1863377e9d873
tree3d5dc90c700fa4e10f563f318368efd0df85e8c2
parent46b5a3d7542b5e0960e6ef3ac9cbd7fcf142ac3f
r4951: some of the code dealing with libcli was getting too complex trying to
handle the inverted memory hierarchy that a normal session
establishment gave. The inverted hierarchy came from that fact that
you first establish a socket, then a transport, then a session and
finally a tree. That leads to the socket being at the top of the
memory hierarchy and the tree at the bottom, which makes no sense from
the users point of view, as they want to be able to free the tree and
have everything disappear.

The core problem was that the libcli interface didn't distinguish
between establishing a primary context and a secondary context. If you
establish a 2nd session on a transport then you want the transport to
be referenced by the session, whereas if you establish a primary
session then you want the transport to be a child of the session.

To fix this I have added "parent_ctx" and "primary" arguments to the
libcli intialisation functions. This makes using the library much
easier, and gives us a memory hierarchy that makes much more sense.

I was prompted to do this by a bug in the cifs backend, which was
caused by the socket not being properly torn down on a disconnect due
to the inverted memory hierarchy.
(This used to be commit 5e8fd5f70178992e249805c2e1ddafaf6840739b)
source4/libcli/cliconnect.c
source4/libcli/composite/connect.c
source4/libcli/raw/clisession.c
source4/libcli/raw/clitransport.c
source4/libcli/raw/clitree.c
source4/libcli/util/clilsa.c
source4/torture/basic/secleak.c
source4/torture/raw/context.c
source4/torture/rpc/xplogin.c