Fixing the cli_initialize() interface.
jra at samba.org
Sat May 27 06:44:22 GMT 2006
The current cli_initialize/cli_shutdown
interface in the client code is broken
(IMHO). Currently it's architected so
that you can pass in an existing cli_state
struct, possibly partially initialized,
possibly defined on the stack, and have
it cleaned up and re-initialized, or
This is just silly and broken. It *must*
be a simple :
struct cli_state *cli_initialise(void)
that *always* returns a malloced struct.
For symmetry, cli_shutdown should look
NSTATUS cli_shutdown(struct cli_state **pp_cli)
that *always* frees what is pointed to by
pp_cli and NULLs out the pointer.
Trying to maintain the legacy uses is costing
us time, effort and bugs (especially in winbindd)
with half-initialized cli states. There are only
6 on the stack users of cli_initialize in the
code and we must remove them.
Derrell, will this cause you problems in
libsmbclient maintaining binary compatibility ?
I don't think so although you are a stack user
of cli_initialize() - just in one place, this
will need to be fixed.
I'm intending to fix this in HEAD, and move
the code over after the 3.0.23 release as it
is too invasive at this point for the release
Please give me feedback on this - I don't want
to break anything for people but we need to
tidy this up as soon as possible (IMHO).
More information about the samba-technical