[PATCH] winbindd: check if dcinfo from genache is expired

Jeremy Allison jra at samba.org
Wed Apr 27 20:50:40 UTC 2016


On Tue, Apr 26, 2016 at 10:20:59AM +0200, Ralph Boehme wrote:
> Hi!
> 
> I believe a gencache_parse() caller is missing a timeout check, patch
> attached.
> 
> Please review & push if ok.

Pushed with a slight change to

+     if (timeout <= time(NULL)) {

as <= is the same test used in gencache.c and
also in source3/lib/idmap_cache.c.

> From 9657023b3deee71480c9c539b5e5997f15ad70d3 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> Date: Tue, 26 Apr 2016 08:43:26 +0200
> Subject: [PATCH] winbindd: check if dcinfo from genache is expired
> 
> The gencache parse function dcinfo_parser() used by
> wb_dsgetdcname_gencache_get() misses a check for expired gencache
> entries.
> 
> Signed-off-by: Ralph Boehme <slow at samba.org>
> ---
>  source3/winbindd/wb_dsgetdcname.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/source3/winbindd/wb_dsgetdcname.c b/source3/winbindd/wb_dsgetdcname.c
> index 5aea7de..2d7e298 100644
> --- a/source3/winbindd/wb_dsgetdcname.c
> +++ b/source3/winbindd/wb_dsgetdcname.c
> @@ -176,6 +176,10 @@ static void dcinfo_parser(time_t timeout, DATA_BLOB blob, void *private_data)
>  	struct dcinfo_parser_state *state = private_data;
>  	enum ndr_err_code ndr_err;
>  
> +	if (timeout < time(NULL)) {
> +		return;
> +	}
> +
>  	state->dcinfo = talloc(state->mem_ctx, struct netr_DsRGetDCNameInfo);
>  	if (state->dcinfo == NULL) {
>  		state->status = NT_STATUS_NO_MEMORY;
> -- 
> 2.5.0
> 




More information about the samba-technical mailing list