libsmbclient: POLICY_HND not initialized for cached servers

Richard Sharpe rsharpe at richardsharpe.com
Mon Feb 9 13:38:52 GMT 2004


On Mon, 9 Feb 2004, Lautier, Marc wrote:

> 
> Hi,
> 
> I'm currently working on some customization of the libsmbclient.
> 
> During some tests, I encountered difficulties executing some requests past
> the first one.
> 
> When tracking down the problem, I discovered that the stack "allocated" pol
> variable (of type POLICY_HND), is not properly initialized in function
> smbc_attr_server when the server is retrieved from the server cache.
> 
> This will cause some calls to fail past the first one, especially if the
> stackspace where pol is allocated is overwritten between the calls (so it's
> not necessarily evident by doing a loop to generate lots of calls).
> I could reproduce this issue with a custom testacl.c (from the libsmbclient
> examples)
> Attached is the diff to get a testacl that fails (on the default get
> request, it performs two get, the second one failing to resolve SIDs into
> names properly)
> 
> 
> 
> What is (or should be) the lifecycle of the POLICY_HND here ?
> 
> I see two possible fixes here:
> 	- reinitialize a new POLICY_HND in smbc_attr_server when a server is
> retrieved from the cache.
> 	- cache the POLICY_HND along with the SMBCSRV object, perhaps by
> putting it directly in the SMBCSRV when pertinent (for "IPC$$" servers).

Hmmm, given that policy handles are used by only a few operations, I would 
suggest perhaps that we reinitialize them when a server is retrieved from 
the cache, although if that initialization is expensive, then perhaps we 
should reserve space in the SMBCSRV object.

Regards
-----
Richard Sharpe, rsharpe[at]richardsharpe.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testacl.diff
Type: application/octet-stream
Size: 890 bytes
Desc: 
Url : http://lists.samba.org/archive/samba-technical/attachments/20040209/52aad537/testacl.obj


More information about the samba-technical mailing list