Bad interface in libsmbclient
jra at samba.org
Fri Jan 15 18:03:04 MST 2010
On Fri, Jan 15, 2010 at 04:45:32PM -0800, Jeremy Allison wrote:
> On Thu, Jan 14, 2010 at 12:50:26PM -0600, Günther Deschner wrote:
> > +/* note the strdup for string options on smbc_set calls. I think libsmbclient is
> > + * really doing something wrong here: in smbc_free_context libsmbclient just
> > + * calls free() on the string options so it assumes the callers have malloced
> > + * them before setting them via smbc_set calls. */
> God you're right - that's *REALLY* horrible. libsmbclient
> should have been deep copying the strings from the start,
> not just stealing the pointers.
> Can we track down the gvfs backend code that calls this
> and see how hard it would be to fix this mess ?
Ok, that latest git code I can find for gvfs both say:
/* FIXME: is strdup() still needed here? -- removed */
if (default_workgroup != NULL)
smbc_setWorkgroup (smb_context, default_workgroup);
So it looks like we really need to make this a memory
duplicating interface asap and fix the calling code
I'll log a bug with this. Red Hat & Debian developers,
can you comment asap please ? Can we get some feedback
on the way this is being used inside gvfs ?
More information about the samba-technical