s3: smbd: Move the setting of the destructor of struct smb_Dir * up two levels.
authorJeremy Allison <jra@samba.org>
Wed, 17 Jul 2019 16:11:25 +0000 (09:11 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 24 Jul 2019 07:40:23 +0000 (07:40 +0000)
commitd1441089722b7985df417494f6542e6560e99330
treed5908c444297e1ff7c8564cad651751d89d42ff5
parent41c94b8b1f0ba312711b5b6c2ba2f27c696b445b
s3: smbd: Move the setting of the destructor of struct smb_Dir * up two levels.

Previously, open_dir_safely() called OpenDir_internal() which
set the destructor.

Move setting the destructor into the callers of open_dir_safely()
as this will allow us to have different destructors for handle-based
calls.

The reason this is important is that I have a follow up patchset
that depends on this which makes all client directory enumerations
handle-based, calling OpenDir_fsp() only, and so the destructor there
will take care of the fsp back pointer.

Trying to keep a common destructor for handle-based and non-handle
based calls broke my brain when trying to separate the handle-based
calls from the non-handle based ones in my later patchset.

NB. The change in OpenDir_fsp() isn't a logic change as instead
of doing an early return from a function that sets the destructor,
we now fallthrough to setting the destructor then return, which
is identical.

Eventually the whole codepath using the fallback for non-handle
opens inside dptr_create() will go away and this simplifies the
code immensely. Some short term pain for long-term gain :-).

Added doxygen documentation as requested.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/smbd/dir.c