[PATCH] Do not reset the secrets.tdb SID and GUID when not required

Andrew Bartlett abartlet at samba.org
Mon May 19 15:21:49 MDT 2014


On Mon, 2014-05-19 at 22:55 +0200, Volker Lendecke wrote:
> On Wed, May 14, 2014 at 05:33:59PM +1200, Andrew Bartlett wrote:
> > This patch avoids a valigrind error caused because the memory from
> > get_global_sam_sid() was being cleared too often.
> 
> Can you describe what the valgrind error was?

get_global_sam_sid() is used as an input to passdb routines, but the
auto-initialisation of the secrets.tdb from the backing store in
pdb_samba_dsdb was called after get_global_sam_sid() was placed into the
stack. 

I then looked at how pdb_ldapsam handled it, and realised that it
(correctly) only reset the tdb if it had changed. 

> Also, a style comment:
> 
> > +	if (ret) {
> > +		if (dom_sid_equal(get_global_sam_sid(), sid) == false) {
> 
> I'd rather write !dom_sid_equal(). Any reason why you chose
> == false?

I won't claim to have put major thought into it, but it seems clearer,
particularly compared with the pattern of _cmp() routines that return <
or > 0.

Anyway, I do thank you for looking over it, because on re-examination 

if (ret || dom_sid_equal(&stored_sid, &dom_info->sid) == false) {
should have been:
if (ret == false || dom_sid_equal(&stored_sid, &dom_info->sid) ==
false) 

I'll submit a new patch shortly.

Andrew Bartlett

-- 
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba






More information about the samba-technical mailing list