[PATCH] Remove fstring from wb_acct_info

Andrew Bartlett abartlet at samba.org
Wed Oct 31 22:15:12 UTC 2018


On Wed, 2018-10-31 at 17:45 +0100, Samuel Cabrero via samba-technical
wrote:
> Hi,
> 
> the attached patch removes two fstrings from wb_acct_info struct. The
> reason for this change is because the winbindd group enumeration
> backend functions (ADS in particular) try to allocate an array of
> wb_acct_info as long as the number of groups in the domain, which may
> result in a huge chunk of memory for domains with a large number of
> groups.
> 
> Branch:
> https://gitlab.com/samuelcabrero/samba/commits/winbind_enum_grp_nomem
> 
> CI:
> https://gitlab.com/samuelcabrero/samba/pipelines/34956873
> 
> 
> Please review and push if you agree.

I'm worried about memory lifetimes. 

Could you change the talloc_strdup() and normal assignments into
talloc_steal() onto the head of the array at the memory context?

This would ensure the strings stay around as long as the structure
pointing to them.

Thanks,

Andrew Bartlett

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







More information about the samba-technical mailing list