Patch for winbindd memory leaks

Kim R. Pedersen krp at filanet.dk
Mon Sep 23 13:16:01 GMT 2002


Hello Winbindd-Fans,

During my port of winbindd to my company's new platform, I have come across 
three memory leaks in winbindd.

They are all related to misconfigured "password server" parameter, and 
therefore not critical for "normal" environments.

As I'm working on an Internet Appliance, they are however critical for me, and 
perhaps for others doing "ever-running appliance" devices.

Here we go:

1) A simple missing free(ip_list) in cm_get_dc_name() file winbindd_cm.c.

2) A wrong sequence of caching additions in cm_open_connection() file 
winbindd_cm.c

3) A potential endless loop in init_domain_list() file winbindd_util.c that 
never calls lp_talloc_free().

I have attached the patches to winbindd_cm.c as the fixes are fairly simple 
and obvious, but bug #3 is more problematic. One could simply add the missing 
call to lp_talloc_free(), but I feel that there is something fundamentally 
wrong with having this endless loop that doesn't take SIGHUP handling into 
consideration or the fact that other non-domain related requests should be 
serviced by winbindd.

In my own version of winbindd I simply return an error from init_domain_list() 
and return back to the main loop, so reconfiguration can take place.

File winbindd_util.c function init_domain_list() :
-------------------------------------------------------------------------------------------------------------
#ifdef FILANET
	if (!NT_STATUS_IS_OK(result)) {
		DEBUG(0, ("Cannot get SID for domain %s (using password server \"%s\") error 
was %s (0x%x)\n",
			  domain->name, lp_passwordserver(),
			  get_nt_error_msg(result), (unsigned int)NT_STATUS_V(result)));
		free_domain_list();
		talloc_destroy(mem_ctx);
		return False;
	}
#else
	while (!NT_STATUS_IS_OK(result)) {
		sleep(10);
		DEBUG(1,("Retrying startup domain sid fetch for %s\n",
			 domain->name));
		result = cache_methods.domain_sid(domain, &domain->sid);
	}
#endif /* FILANET */

Regards
Kimrp, Filanet Europe
-------------------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winbindd_cm.c-patch
Type: text/x-diff
Size: 1402 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020923/e1201cbb/winbindd_cm.bin


More information about the samba-technical mailing list