libsmbclient: POLICY_HND not initialized for cached servers

Lautier, Marc LautiM at
Mon Feb 9 13:28:55 GMT 2004


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
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).

Does anybody have any insight as to the best way to fix that issue ?

Software Engineer
(+33)5 62 17 31 07 phone
Email: LautiM at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testacl.diff
Type: application/octet-stream
Size: 890 bytes
Desc: not available
Url :

More information about the samba-technical mailing list